[Users | Trunk]: Add login in all pages. Change form ui

This commit is contained in:
Konstantinos Triantafyllou 2020-10-21 10:23:46 +00:00
parent 77cd9864e5
commit a153f36a66
5 changed files with 203 additions and 264 deletions

View File

@ -45,6 +45,9 @@ public class RegisterServiceServlet extends HttpServlet {
checkNumberOfRegisteredServices(request, response, authentication); checkNumberOfRegisteredServices(request, response, authentication);
response.setContentType("text/html"); response.setContentType("text/html");
StringBuilder name = new StringBuilder().append(authentication.getUserInfo().getGivenName().charAt(0));
name.append(authentication.getUserInfo().getFamilyName().charAt(0));
request.getSession().setAttribute("name", name.toString());
request.getRequestDispatcher("./registerService.jsp").include(request, response); request.getRequestDispatcher("./registerService.jsp").include(request, response);
} }

View File

@ -73,6 +73,9 @@ public class RegisteredServicesServlet extends HttpServlet {
} }
boolean reachedLimit = reachedMaximumNumberOfServices(registeredServices); boolean reachedLimit = reachedMaximumNumberOfServices(registeredServices);
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("reachedLimit", reachedLimit); request.getSession().setAttribute("reachedLimit", reachedLimit);
request.getSession().setAttribute("test", "TEST"); request.getSession().setAttribute("test", "TEST");
System.out.println("REACHED LIMIT??? " + reachedLimit); System.out.println("REACHED LIMIT??? " + reachedLimit);

View File

@ -47,3 +47,14 @@ h6, .aai-h6 {
a:hover, .uk-link:hover { a:hover, .uk-link:hover {
color: #222080; color: #222080;
} }
.uk-form-label {
font-size: 16px;
width: auto !important;
margin-top: 0 !important;
float: none !important;
}
.clickable {
cursor: pointer;
}

View File

@ -28,56 +28,11 @@
</head> </head>
<body class="" style=""> <body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport"> <div class="uk-offcanvas-content uk-height-viewport">
<!-- MENU STARTS HERE --> <jsp:include page="header.jsp"/>
<!-- 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="{&quot;align&quot;:&quot;left&quot;}">
<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 --> <!-- CONTENT STARTS HERE -->
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical"> <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> </div>
<div class=" uk-section uk-margin-small-top uk-container uk-container-large" id="tm-main"> <div class=" uk-section uk-margin-small-top uk-container uk-container-large" id="tm-main">
@ -93,73 +48,121 @@
</div> </div>
<!-- CENTER SIDE --> <!-- CENTER SIDE -->
<div class="uk-width-2-3@l uk-width-2-3@m"> <div class="uk-width-2-3@l uk-width-2-3@m">
<h2 class="uk-h2 uk-margin-small-bottom">Add a new service</h2> <h4 class="uk-margin-remove-top uk-text-bold uk-text-primary">Add a new service</h4>
<div class="middle-box text-center loginscreen animated fadeInDown ">
<div class="k-width-1-1@m uk-width-1-1@s uk-text-center">
<!-- REGISTER FORM --> <!-- REGISTER FORM -->
<div id="registerForm"> <div id="registerForm">
<form action="registerService" method="POST" role="form" class="m-t uk-form-horizontal" id="register_form"> <form action="registerService" method="POST" role="form" class="m-t uk-form-horizontal"
id="register_form">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/> <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
<div class="alert alert-success" aria-hidden="true" style="display: none;"></div> <div class="alert alert-success" aria-hidden="true" style="display: none;"></div>
<div class="alert alert-danger" aria-hidden="true" style="display: none;"></div> <div class="alert alert-danger" aria-hidden="true" style="display: none;"></div>
<span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span> <span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span>
<c:remove var="message" scope="session"/> <c:remove var="message" scope="session"/>
<h5 class="uk-h5">General</h5> <h4 class="uk-text-bold uk-text-center">General</h4>
<div class="uk-margin"> <div class="uk-margin-medium-top">
<label class="uk-form-label" for="form-horizontal-text">Name(*)</label> <label class="uk-form-label uk-text-bold" for="first_name">Name*</label>
<span class="msg_first_name_error uk-text-danger uk-text-small uk-float-left" style='${msg_first_name_error_display}'>Please enter a name for your service.</span> <input id="first_name" name="first_name" type="text" placeholder="Name (*)"
<input id="first_name" name="first_name" type="text" placeholder="Name (*)" class="form-control" value="${first_name}"> class="form-control" value=${first_name}>
<span class="uk-text-danger uk-text-small">
Please enter a name for your service.</span>
<c:remove var="msg_first_name_error_display" scope="session"/> <c:remove var="msg_first_name_error_display" scope="session"/>
<c:remove var="first_name" scope="session" />
</div> </div>
<div class="uk-margin"> <div class="uk-margin-medium-top">
<label class="uk-form-label" for="form-horizontal-text">Description</label> <label class="uk-form-label uk-text-bold" for="description">Description</label>
<textarea id="description" name="description" type="textarea" placeholder="Description:" class="form-control uk-textarea" rows="3" value=${description}></textarea> <textarea id="description" name="description" type="textarea" placeholder="Description:"
<c:remove var="organization" scope="session" /> class="form-control uk-textarea" rows="3" value=${description}></textarea>
</div> </div>
<hr class="uk-margin-remove-top"> <hr class="uk-margin-medium uk-divider">
<h5 class="uk-h5">Access</h5> <h4 class="uk-text-bold uk-text-center">Access</h4>
<div class="uk-margin"> <div class="uk-margin-medium-top">
<label class="uk-form-label" for="form-horizontal-text">Scope</label> <label class="uk-form-label uk-text-bold">Scope</label>
<input disabled value="openid" class="uk-input"></input> <input disabled value="openid" class="uk-input">
</div> </div>
<div class="uk-margin"> <div class="uk-margin-medium-top">
<label class="uk-form-label" for="form-horizontal-text">Grant Types</label> <label class="uk-form-label uk-text-bold">Grant Types</label>
<input disabled value="client credentials" class="uk-input"></input> <input disabled value="client credentials" class="uk-input">
</div> </div>
<hr class="uk-margin-remove-top"> <hr class="uk-margin-medium uk-divider">
<h5 class="uk-h5">Credentials</h5> <h4 class="uk-text-bold uk-text-center">Credentials</h4>
<div class="uk-margin"> <div class="uk-margin-medium-top">
<label class="uk-form-label" for="form-horizontal-text">Authentication Method</label> <label class="uk-form-label uk-text-bold">Authentication Method</label>
<input disabled value="Asymmetrically-signed JWT assertion" class="uk-input"></input> <input disabled value="Asymmetrically-signed JWT assertion" class="uk-input">
</div> </div>
<div class="uk-margin"> <div class="uk-margin-medium-top">
<label class="uk-form-label" for="form-horizontal-text">Token Endpoint Authentication Signing Algorithm</label> <label class="uk-form-label uk-text-bold">Token Endpoint Authentication
<input disabled value="RSASSA using SHA-256 hash algorithm" class="uk-input"></input> Signing Algorithm</label>
<input disabled value="RSASSA using SHA-256 hash algorithm" class="uk-input">
</div> </div>
<div class="uk-margin"> <div class="uk-margin-medium-top">
<label class="uk-form-label" for="form-horizontal-text">Public Key Set</label> <label class="uk-form-label uk-text-bold">Public Key Set</label>
<span class="uk-float-right">
<label><input class="uk-radio" type="radio" name="key_radio" value="value" ${(key_radio == 'value' || key_radio == '') ? 'checked' : ''} >By Value</label> <span class="uk-margin-small-right">
<label><input class="uk-radio" type="radio" name="key_radio" value="${uri}" ${key_radio == 'uri' ? 'checked' : ''} >By URI</label><br> <input id="by_value" class="uk-radio uk-margin-small-right" type="radio" name="key_radio" value="value" checked>
<label class="clickable" for="by_value">By Value</label>
</span>
<span>
<input id="by_uri" class="uk-radio uk-margin-small-right" type="radio" name="key_radio" value="uri">
<label class="clickable" for="by_uri">By URI</label>
</span>
</span>
<div id="value_input"> <div id="value_input">
<span class="msg_key_value_error uk-text-danger uk-text-small uk-float-left" style='${msg_key_value_error_display}'>Please provide a valid JSON.</span> <textarea id="value" name="value" type="textarea" placeholder='{"keys":[]}'
<textarea id="value" name="value" type="textarea" placeholder='{"keys":[]}' class="form-control uk-textarea" rows="10" value="${value}"></textarea> class="form-control uk-textarea" rows="10">{"keys":[]}</textarea>
<span class="uk-text-danger uk-text-small">Please provide a valid JSON.</span>
</div> </div>
<div id="uri_input" style="display:none;"> <div id="uri_input" style="display:none;">
<span class="msg_key_uri_error uk-text-danger uk-text-small uk-float-left" style='${msg_key_uri_error_display}'>Please provide a valid URI (do not forget the protocol! https://...)</span> <input id="uri" name="uri" type="text" placeholder="https://" class="form-control" value="${jwksUri}">
<input id="uri" name="uri" type="text" placeholder="https://" class="form-control" value=${uri}> <span class="uk-text-danger uk-text-small">Please provide a valid URI (do not forget the protocol! https://...)</span>
</div> </div>
</div> </div>
<hr class="uk-margin-remove-top"> <div class="uk-flex uk-flex-right uk-margin-medium-top">
<div class="uk-width-1-1 uk-grid-margin uk-first-column"> <a type="submit" class="uk-button uk-button-default uk-margin-small-right"
<a type="submit" class="uk-button uk-button-default" href="./registeredServices">Cancel</a> href="./registeredServices">Cancel</a>
<button type="submit" class="uk-button uk-button-primary" onclick="return validate();">Add new service</button> <button type="submit" class="uk-button uk-button-primary" onclick="return validate();">
Add new service
</button>
</div> </div>
</form> </form>
</div> </div>
<!-- END OF REGISTER FORM --> <!-- END OF REGISTER FORM -->
</ul>
</div>
<!-- END OF CENTER SIDE -->
</div>
</div>
<!-- CONTENT ENDS HERE -->
<!-- FOOTER STARTS HERE-->
<div class="custom-footer" style="z-index: 200;">
<div class="uk-section-primary uk-section uk-section-small">
<div class="uk-container">
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-1-1@m uk-first-column">
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-center">
<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>&nbsp;UNLESS
OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER
A&nbsp;<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&nbsp;<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="">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<script> <script>
$('input[type=radio][name=key_radio]').change(function () { $('input[type=radio][name=key_radio]').change(function () {
if (this.value == 'uri') { if (this.value == 'uri') {
@ -207,9 +210,7 @@
function validateJSON() { function validateJSON() {
if ($("#value").val() != undefined && $("#value").val() !== "") { if ($("#value").val() != undefined && $("#value").val() !== "") {
if (/^[\],:{}\s]*$/.test($("#value").val().replace(/\\["\\\/bfnrtu]/g, '@'). if (/^[\],:{}\s]*$/.test($("#value").val().replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
return true; return true;
} else { } else {
@ -241,36 +242,3 @@
$(".msg_key_uri_error").fadeOut(); $(".msg_key_uri_error").fadeOut();
}); });
</script> </script>
</div>
</ul>
</div>
</div>
<!-- END OF CENTER SIDE -->
</div>
</div>
<!-- CONTENT ENDS HERE -->
<!-- FOOTER STARTS HERE-->
<div class="custom-footer" style="z-index: 200;">
<div class="uk-section-primary uk-section uk-section-small">
<div class="uk-container">
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-1-1@m uk-first-column">
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-center">
<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>&nbsp;UNLESS OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER A&nbsp;<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&nbsp;<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="">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -23,53 +23,7 @@
</head> </head>
<body class="" style=""> <body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport"> <div class="uk-offcanvas-content uk-height-viewport">
<!-- MENU STARTS HERE --> <jsp:include page="header.jsp"/>
<!-- 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="{&quot;align&quot;:&quot;left&quot;}">
<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 --> <!-- CONTENT STARTS HERE -->
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical"> <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="">