[Users | Trunk]: Add header.jsp. Change personal token page
This commit is contained in:
parent
1bd9397c0e
commit
84006bd941
|
@ -53,12 +53,15 @@ public class PersonalTokenServlet extends HttpServlet {
|
|||
throws ServletException, IOException {
|
||||
response.setContentType("text/html");
|
||||
OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
|
||||
StringBuilder name = new StringBuilder().append(authentication.getUserInfo().getGivenName().charAt(0));
|
||||
name.append(authentication.getUserInfo().getFamilyName().charAt(0));
|
||||
request.getSession().setAttribute("name", name.toString());
|
||||
request.getSession().setAttribute("accessToken", authentication.getAccessTokenValue());
|
||||
request.getSession().setAttribute("refreshToken", authentication.getRefreshTokenValue());
|
||||
request.getRequestDispatcher("./personal.jsp").include(request, response);
|
||||
}
|
||||
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||
OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
|
||||
String refreshToken = authentication.getRefreshTokenValue();
|
||||
List<String> oldRefreshTokens = null;
|
||||
|
@ -71,7 +74,7 @@ public class PersonalTokenServlet extends HttpServlet {
|
|||
logger.error("Error deleting old refresh tokens.", e);
|
||||
//TODO should I let user know?
|
||||
}
|
||||
request.setAttribute("display_refresh_token", "display:block");
|
||||
request.getSession().setAttribute("showRefreshToken", true);
|
||||
response.sendRedirect("./personalToken");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
:root {
|
||||
--primary-color: #222080;
|
||||
--secondary-color: #4686E5;
|
||||
}
|
||||
|
||||
.aai-form-danger, .aai-form-danger:focus {
|
||||
color: #f0506e;
|
||||
border-color: #f0506e
|
||||
|
@ -24,14 +29,21 @@ h6, .aai-h6 {
|
|||
.uk-navbar-nav > li > a::before {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.login svg {
|
||||
fill: #222080;
|
||||
fill: var(--primary-color);
|
||||
}
|
||||
|
||||
.login:hover circle {
|
||||
fill: var(--secondary-color);
|
||||
}
|
||||
|
||||
.login text {
|
||||
stroke: #fff;
|
||||
fill: #fff;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
a:hover, .uk-link:hover {
|
||||
color: #222080;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<div class="tm-header tm-header-transparent" uk-header="">
|
||||
<div class="uk-container uk-container-expand">
|
||||
<nav class="uk-navbar" uk-navbar="{"align":"left"}">
|
||||
<div class="uk-navbar-center">
|
||||
<div class="uk-logo uk-navbar-item">
|
||||
<img alt="OpenAIRE" class="uk-responsive-height" src="./images/Logo_Horizontal.png">
|
||||
</div>
|
||||
</div>
|
||||
<!-- user menu -->
|
||||
<div class=uk-navbar-right>
|
||||
<ul class="uk-navbar-nav user_actions">
|
||||
<c:choose>
|
||||
<c:when test="${not authenticated}">
|
||||
<li><a href="./openid_connect_login"> Sign in </a></li>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<li>
|
||||
<a class="login" aria-expanded="false">
|
||||
<svg height="60" width="60">
|
||||
<circle cx="30" cy="30" r="20" stroke-width="2"></circle>
|
||||
<text dy=".4em" font-size="16" text-anchor="middle" x="50%" y="50%"
|
||||
class="ng-star-inserted">
|
||||
${name}
|
||||
</text>
|
||||
</svg>
|
||||
</a>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<div class="uk-navbar-dropdown uk-navbar-dropdown-bottom-right" id="userMenu"
|
||||
style="left: 344.433px; top: 100px;">
|
||||
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack"
|
||||
uk-grid="">
|
||||
<div class="uk-first-column uk-height-max-medium uk-overflow-auto">
|
||||
<ul class="uk-nav uk-navbar-dropdown-nav">
|
||||
<li class=""><a href="./personalToken">Personal token</a></li>
|
||||
<li class=""><a href="./registeredServices">Registered services</a></li>
|
||||
<li class="uk-nav-divider "></li>
|
||||
<li>
|
||||
<a href="./openid_logout" id="logout">Log out</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- USER MENU ENDS HERE -->
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
|
@ -26,8 +26,7 @@
|
|||
try {
|
||||
document.execCommand('copy');
|
||||
UIkit.notification({message: 'Copied to clipboard!', status: 'primary', pos: 'top-right'});
|
||||
}
|
||||
catch (err) {
|
||||
} catch (err) {
|
||||
console.error('unable to copy text');
|
||||
}
|
||||
}
|
||||
|
@ -42,56 +41,10 @@
|
|||
</head>
|
||||
<body class="" style="">
|
||||
<div class="uk-offcanvas-content uk-height-viewport">
|
||||
<!-- MENU STARTS HERE -->
|
||||
<!-- MAIN MENU STARTS HERE -->
|
||||
<div class="tm-header tm-header-transparent" uk-header="">
|
||||
<div class="uk-container uk-container-expand">
|
||||
<nav class="uk-navbar" uk-navbar="{"align":"left"}">
|
||||
<div class="uk-navbar-center">
|
||||
<div class="uk-logo uk-navbar-item">
|
||||
<img alt="OpenAIRE" class="uk-responsive-height" src="./images/Logo_Horizontal.png">
|
||||
</div>
|
||||
</div>
|
||||
<!-- user menu -->
|
||||
<div class=uk-navbar-right>
|
||||
<ul class="uk-navbar-nav user_actions">
|
||||
<c:choose>
|
||||
<c:when test="${not authenticated}">
|
||||
<li><a href="./openid_connect_login"> Sign in </a></li>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<li>
|
||||
<a class="login uk-icon" aria-expanded="false">
|
||||
<svg height="60" width="60">
|
||||
<span uk-icon="icon: user; ratio: 2"></span></svg>
|
||||
</a>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<div class="uk-navbar-dropdown uk-navbar-dropdown-bottom-right" id="userMenu" style="left: 344.433px; top: 100px;">
|
||||
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
|
||||
<div class="uk-first-column uk-height-max-medium uk-overflow-auto">
|
||||
<ul class="uk-nav uk-navbar-dropdown-nav">
|
||||
<li class=""><a href="./personalToken">Personal token</a></li>
|
||||
<li class=""><a href="./registeredServices">Registered services</a></li>
|
||||
<li class="uk-nav-divider "></li>
|
||||
<li>
|
||||
<a href="./openid_logout" id="logout">Log out</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- USER MENU ENDS HERE -->
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<!-- MENU ENDS HERE -->
|
||||
<!-- CONTENT STARTS HERE -->
|
||||
<jsp:include page="header.jsp"/>
|
||||
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical">
|
||||
<div class="first_page_banner_headline uk-grid-collapse uk-flex-middle uk-margin-remove-vertical uk-grid" uk-grid="">
|
||||
<div class="first_page_banner_headline uk-grid-collapse uk-flex-middle uk-margin-remove-vertical uk-grid"
|
||||
uk-grid="">
|
||||
</div>
|
||||
</div>
|
||||
<div class=" uk-section uk-margin-small-top uk-container uk-container-large" id="tm-main">
|
||||
|
@ -123,38 +76,79 @@
|
|||
<div>
|
||||
<span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span>
|
||||
<c:remove var="message" scope="session"/>
|
||||
<div class="uk-alert-primary uk-margin-remove-top uk-alert uk-flex uk-flex-middle">
|
||||
<span uk-icon="info"></span>
|
||||
<span class="uk-margin-small-left">
|
||||
For further information on how to use the tokens please visit the
|
||||
<a href="">OpenAIRE API Authentication documentation</a>.
|
||||
</span>
|
||||
</div>
|
||||
<form id="revoke" name="revoke" action="./personalToken" method="post">
|
||||
<!-- <a class=" uk-text-danger uk-float-right" title="Revoke access token" onClick="document.revoke.submit();"><span uk-icon="refresh" ></span></a> -->
|
||||
<a class=" uk-float-right uk-margin-small-left" onclick="copy('accessToken')" title="Copy access token"><span uk-icon="icon:copy"></span></a>
|
||||
<div class="uk-h5">Your personal access token is</div>
|
||||
<pre><code id="accessToken">${accessToken}</code></pre>
|
||||
<span uk-icon="icon:info"></span> Your access token is <b>valid for an hour</b>.
|
||||
<h4 class="uk-margin-remove-top uk-text-bold uk-text-primary">Your personal access token is</h4>
|
||||
<div class="uk-flex uk-flex-middle uk-margin-bottom">
|
||||
<div class="uk-width-expand">
|
||||
<pre class="uk-margin-remove-bottom"><code id="accessToken">${accessToken}</code></pre>
|
||||
</div>
|
||||
<div class="uk-width-auto uk-padding-small uk-text-center">
|
||||
<a onclick="copy('accessToken')"
|
||||
title="Copy access token"><span uk-icon="copy"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<span uk-icon="info"></span>
|
||||
<span class="uk-margin-small-left">
|
||||
Your access token is <span class="uk-text-bold">valid for an hour</span>.
|
||||
</span>
|
||||
</div>
|
||||
<div class="uk-text-danger uk-flex uk-flex-middle uk-margin-small-top">
|
||||
<span uk-icon="warning"></span>
|
||||
<span class="uk-margin-small-left">
|
||||
Do not share your personal access token. Send your personal access token only over HTTPS.
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="uk-alert-danger uk-alert uk-margin-large-top" >
|
||||
<p>Do not share your personal access token. Send your personal access token only over HTTPS.</p>
|
||||
</div>
|
||||
<div class="uk-alert-primary uk-alert" >
|
||||
<span uk-icon="icon:info"></span> For further information on how to use the tokens please visit the <a href="">OpenAIRE API Authentication documentation</a>.
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="uk-section">
|
||||
<!--<a class=" uk-text-danger uk-float-right" title="Revoke refresh token"><span uk-icon="refresh"></span></a>-->
|
||||
<div class="uk-h5">Do you need a refresh token?</div>
|
||||
<p>OpenAIRE refresh token <b>expires after 1 month</b> and allows you to programmatically get a new access token. </p>
|
||||
<button type="submit" class="uk-button uk-button-primary" uk-toggle="target: #refreshWarning">Get a refresh token</button>
|
||||
<div id="refreshTokenDiv" style="${display_refresh_token}">
|
||||
<c:remove var="display_refresh_token" scope="session"/>
|
||||
<div class="uk-alert-warning uk-alert" >
|
||||
Please copy your refresh token and store it confidentially. You will not be able to retrieve it.
|
||||
<c:choose>
|
||||
<c:when test="${showRefreshToken == true}">
|
||||
<h4 class="uk-margin-remove-top uk-text-bold uk-text-primary">Your refresh token is</h4>
|
||||
<div class="uk-flex uk-flex-middle uk-margin-bottom">
|
||||
<div class="uk-width-expand">
|
||||
<pre class="uk-margin-remove-bottom"><code id="refreshToken">${refreshToken}</code></pre>
|
||||
</div>
|
||||
<div class="uk-alert-danger uk-alert uk-margin-large-top" >
|
||||
<p>Do not share your refresh token. Send your personal access token only over HTTPS.</p>
|
||||
<div class="uk-width-auto uk-padding-small uk-text-center">
|
||||
<a onclick="copy('refreshToken')"
|
||||
title="Copy refreshToken token"><span uk-icon="copy"></span>
|
||||
</a>
|
||||
</div>
|
||||
<a class="uk-float-right uk-margin-small-left" onclick="copy('refreshToken')" title="Copy refresh token"><span uk-icon="icon: copy"></span></a>
|
||||
<pre><code id="refreshToken">${refreshToken}</code></pre>
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<span uk-icon="info"></span>
|
||||
<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>
|
||||
</div>
|
||||
<div class="uk-text-danger uk-flex uk-flex-middle uk-margin-small-top">
|
||||
<span uk-icon="warning"></span>
|
||||
<div class="uk-margin-small-left">
|
||||
<div>Please copy your refresh token and store it confidentially. You will not be able to retrieve it.</div>
|
||||
<div>Do not share your refresh token. Send your refresh token only over HTTPS.</div>
|
||||
</div>
|
||||
</div>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<h4 class="uk-margin-remove-top uk-text-bold uk-text-primary">Do you need a refresh token?</h4>
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<span uk-icon="info"></span>
|
||||
<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>
|
||||
</div>
|
||||
<button type="submit" class="uk-button uk-button-primary uk-margin-medium-top" uk-toggle="target: #refreshWarning">Get a
|
||||
refresh token
|
||||
</button>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- This is the modal -->
|
||||
|
@ -162,10 +156,13 @@
|
|||
<div class="uk-modal-dialog uk-modal-body">
|
||||
<form id="refreshForm" action="./personalToken" method="POST">
|
||||
<h2 class="uk-modal-title">Get refresh token</h2>
|
||||
<p>In case you already have a refresh token, it will no longer be valid. Do you want to proceed?</p>
|
||||
<p>In case you already have a refresh token, it will no longer be valid. Do you want to
|
||||
proceed?</p>
|
||||
<p class="uk-text-right">
|
||||
<button class="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
|
||||
<button class="uk-button uk-button-primary" type="button" onclick="submit();">Get refresh token</button>
|
||||
<button class="uk-button uk-button-primary uk-margin-small-left" type="button" onclick="submit();">Get
|
||||
refresh token
|
||||
</button>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -186,8 +183,15 @@
|
|||
<img alt="OpenAIRE" class="el-image" src="./images/Logo_Horizontal_white_small.png">
|
||||
</div>
|
||||
<div class="footer-license uk-margin uk-margin-remove-bottom uk-text-center uk-text-lead">
|
||||
<div><a href="http://creativecommons.org/licenses/by/4.0/" target="_blank" rel="license"><img alt="Creative" src="./images/80x15.png" style="height: auto; max-width: 100%; vertical-align: middle;"></a> UNLESS OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER A <a href="http://creativecommons.org/licenses/by/4.0/" rel="license">CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE</a>.</div>
|
||||
<div>OPENAIRE IS POWERED BY <a href="http://www.d-net.research-infrastructures.eu/">D-NET</a>.</div>
|
||||
<div><a href="http://creativecommons.org/licenses/by/4.0/" target="_blank"
|
||||
rel="license"><img alt="Creative" src="./images/80x15.png"
|
||||
style="height: auto; max-width: 100%; vertical-align: middle;"></a> UNLESS
|
||||
OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER
|
||||
A <a href="http://creativecommons.org/licenses/by/4.0/" rel="license">CREATIVE
|
||||
COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE</a>.
|
||||
</div>
|
||||
<div>OPENAIRE IS POWERED BY <a href="http://www.d-net.research-infrastructures.eu/">D-NET</a>.
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-right">
|
||||
<a class="uk-totop uk-icon" href="#" uk-scroll="" uk-totop="">
|
||||
|
|
Loading…
Reference in New Issue