Project

General

Profile

1
<!DOCTYPE html>
2
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
3
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
4
<head>
5
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
    <meta name="viewport" content="width=device-width, initial-scale=1">
8
    <title>OpenAIRE - Personal token</title>
9
    <script src="./js/jquery.js"></script>
10
    <script src="./js/uikit.min.js"></script>
11
    <script src="./js/uikit-icons-max.js"></script>
12
    <script>
13
        function copy(id) {
14
            var element = document.getElementById(id);
15
            if (document.body.createTextRange) {
16
                range = document.body.createTextRange();
17
                range.moveToElementText(element);
18
                range.select();
19
            } else if (window.getSelection) {
20
                selection = window.getSelection();
21
                range = document.createRange();
22
                range.selectNodeContents(element);
23
                selection.removeAllRanges();
24
                selection.addRange(range);
25
            }
26
            try {
27
                document.execCommand('copy');
28
                UIkit.notification({message: 'Copied to clipboard!', status: 'primary', pos: 'top-right'});
29
            } catch (err) {
30
                console.error('unable to copy text');
31
            }
32
        }
33
        $(document).ready(function () {
34
            document.addEventListener('copy', (event) => {
35
                const selection = document.getSelection();
36
                event.clipboardData.setData('text/plain', selection.toString().trim());
37
                event.preventDefault();
38
            });
39
        });
40
    </script>
41
    <link rel="stylesheet" style="text/css" href="./css/theme.css">
42
    <link rel="stylesheet" style="text/css" href="./css/custom.css">
43
    <link rel="stylesheet" style="text/css" href="./css/aai-custom.css">
44
    <link rel="icon" type="image/png" sizes="32x32" href="images/favicon/favicon-32x32.png">
45
    <link rel="icon" type="image/png" sizes="96x96" href="images/favicon//favicon-96x96.png">
46
    <link rel="icon" type="image/png" sizes="16x16" href="images/favicon/favicon-16x16.png">
47
    <link href="images/favicon/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon"/>
48
</head>
49
<body class="" style="">
50
<div class="uk-offcanvas-content uk-height-viewport">
51
    <jsp:include page="header.jsp"/>
52
    <div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical">
53
        <div class="first_page_banner_headline uk-grid-collapse uk-flex-middle uk-margin-remove-vertical uk-grid"
54
             uk-grid="">
55
        </div>
56
    </div>
57
    <div class=" uk-section  uk-margin-small-top uk-container uk-container-large" id="tm-main">
58
        <div class="uk-grid ">
59
            <div class="uk-width-1-4@m">
60
                <div class="uk-card uk-card-default uk-card-body">
61
                    <div class="uk-h4">API Access</div>
62
                    <ul class="uk-nav uk-nav-default">
63
                        <li class="uk-active"><a href="./personalToken">Personal token</a></li>
64
                        <li class=""><a href="./registeredServices">Registered services</a></li>
65
                        <%--<li class="uk-parent">
66
                          <a href="#">Parent</a>
67
                          <ul class="uk-nav-sub">
68
                            <li><a href="#">Sub item</a></li>
69
                            <li>
70
                              <a href="#">Sub item</a>
71
                              <ul>
72
                                <li><a href="#">Sub item</a></li>
73
                                <li><a href="#">Sub item</a></li>
74
                              </ul>
75
                            </li>
76
                          </ul>
77
                        </li>--%>
78
                    </ul>
79
                </div>
80
            </div>
81
            <!-- CENTER SIDE -->
82
            <div class="uk-width-2-3@l uk-width-2-3@m">
83
                <div>
84
                    <span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span>
85
                    <c:remove var="message" scope="session"/>
86
                    <div class="uk-alert-primary uk-margin-remove-top uk-alert uk-flex uk-flex-middle">
87
                        <span uk-icon="info"></span>
88
                        <span class="uk-margin-small-left">
89
                            For further information on how to use the tokens please visit the
90
                            <a href="https://develop.openaire.eu/personalToken.html" target="_blank">OpenAIRE API Authentication documentation</a>.
91
                        </span>
92
                    </div>
93
                    <form id="revoke" name="revoke" action="./personalToken" method="post">
94
                        <!-- <a  class=" uk-text-danger uk-float-right" title="Revoke access token" onClick="document.revoke.submit();"><span uk-icon="refresh" ></span></a> -->
95
                        <h4 class="uk-margin-remove-top uk-text-bold uk-text-primary">Your personal access token is</h4>
96
                        <div class="uk-flex uk-flex-middle uk-margin-bottom">
97
                            <div class="uk-width-expand">
98
                                <pre class="uk-margin-remove-bottom"><code id="accessToken">${accessToken}</code></pre>
99
                            </div>
100
                            <div class="uk-width-auto uk-padding-small uk-text-center">
101
                                <a onclick="copy('accessToken')"
102
                                   title="Copy access token"><span uk-icon="copy"></span>
103
                                </a>
104
                            </div>
105
                        </div>
106
                        <div class="uk-flex uk-flex-middle">
107
                            <span uk-icon="info"></span>
108
                            <span class="uk-margin-small-left">
109
                                Your access token is <span class="uk-text-bold">valid for an hour</span>.
110
                            </span>
111
                        </div>
112
                        <div class="uk-text-danger uk-flex uk-flex-middle uk-margin-small-top">
113
                            <span uk-icon="warning"></span>
114
                            <span class="uk-margin-small-left">
115
                                Do not share your personal access token. Send your personal access token only over HTTPS.
116
                            </span>
117
                        </div>
118
                    </form>
119
                </div>
120
                <div class="uk-section">
121
                    <!--<a  class=" uk-text-danger uk-float-right" title="Revoke refresh token"><span uk-icon="refresh"></span></a>-->
122
                    <c:choose>
123
                        <c:when test="${showRefreshToken == true}">
124
                            <h4 class="uk-margin-remove-top uk-text-bold uk-text-primary">Your refresh token is</h4>
125
                            <div class="uk-flex uk-flex-middle uk-margin-bottom">
126
                                <div class="uk-width-expand">
127
                                    <pre class="uk-margin-remove-bottom"><code id="refreshToken">${refreshToken}</code></pre>
128
                                </div>
129
                                <div class="uk-width-auto uk-padding-small uk-text-center">
130
                                    <a onclick="copy('refreshToken')"
131
                                       title="Copy refreshToken token"><span uk-icon="copy"></span>
132
                                    </a>
133
                                </div>
134
                            </div>
135
                            <div class="uk-flex uk-flex-middle">
136
                                <span uk-icon="info"></span>
137
                                <span class="uk-margin-small-left">OpenAIRE refresh token <span class="uk-text-bold">expires after 1 month</span> and allows you to programmatically get a new access token.</span>
138
                            </div>
139
                            <div class="uk-text-danger uk-flex uk-flex-middle uk-margin-small-top">
140
                                <span uk-icon="warning"></span>
141
                                <div class="uk-margin-small-left">
142
                                    <div>Please copy your refresh token and store it confidentially. You will not be able to retrieve it.</div>
143
                                    <div>Do not share your refresh token. Send your refresh token only over HTTPS.</div>
144
                                </div>
145
                            </div>
146
                        </c:when>
147
                        <c:otherwise>
148
                            <h4 class="uk-margin-remove-top uk-text-bold uk-text-primary">Do you need a refresh token?</h4>
149
                            <div class="uk-flex uk-flex-middle">
150
                                <span uk-icon="info"></span>
151
                                <span class="uk-margin-small-left">OpenAIRE refresh token <span class="uk-text-bold">expires after 1 month</span> and allows you to programmatically get a new access token.</span>
152
                            </div>
153
                            <button type="submit" class="uk-button uk-button-primary uk-margin-medium-top" uk-toggle="target: #refreshWarning">Get a
154
                                refresh token
155
                            </button>
156
                        </c:otherwise>
157
                    </c:choose>
158

    
159
                </div>
160

    
161
                <!-- This is the modal -->
162
                <div id="refreshWarning" uk-modal>
163
                    <div class="uk-modal-dialog uk-modal-body">
164
                        <form id="refreshForm" action="./personalToken" method="POST">
165
                            <h2 class="uk-modal-title">Get refresh token</h2>
166
                            <p>In case you already have a refresh token, it will no longer be valid. Do you want to
167
                                proceed?</p>
168
                            <p class="uk-text-right">
169
                                <button class="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
170
                                <button class="uk-button uk-button-primary uk-margin-small-left" type="button" onclick="submit();">Get
171
                                    refresh token
172
                                </button>
173
                            </p>
174
                        </form>
175
                    </div>
176
                </div>
177
            </div>
178

    
179
            <!-- END OF CENTER SIDE -->
180
        </div>
181
    </div>
182
    <!-- CONTENT ENDS HERE -->
183
    <c:import url="footer.jsp"/>
184
</div>
185
</body>
186
</html>
(13-13/27)