diff options
author | talasila <talasila@research.att.com> | 2017-02-07 15:03:57 -0500 |
---|---|---|
committer | talasila <talasila@research.att.com> | 2017-02-07 15:05:15 -0500 |
commit | 4ad39a5c96dd99acf819ce189b13fec946d7506b (patch) | |
tree | a1449286441947cc3d07a45227fa0d6f978e1a7d /ecomp-portal-BE/war/WEB-INF/jsp/oid-user.jsp | |
parent | 5500448cbd1f374d0ac743ee2fd636fe2d3c0027 (diff) |
Initial OpenECOMP Portal commit
Change-Id: I804b80e0830c092e307da1599bd9fbb5c3e2da77
Signed-off-by: talasila <talasila@research.att.com>
Diffstat (limited to 'ecomp-portal-BE/war/WEB-INF/jsp/oid-user.jsp')
-rw-r--r-- | ecomp-portal-BE/war/WEB-INF/jsp/oid-user.jsp | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/ecomp-portal-BE/war/WEB-INF/jsp/oid-user.jsp b/ecomp-portal-BE/war/WEB-INF/jsp/oid-user.jsp new file mode 100644 index 00000000..112415b0 --- /dev/null +++ b/ecomp-portal-BE/war/WEB-INF/jsp/oid-user.jsp @@ -0,0 +1,139 @@ +<%-- + ================================================================================ + eCOMP Portal + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> +<%@ taglib prefix="o" tagdir="/WEB-INF/tags"%> +<o:header title="User"/> +<o:topbar pageName="User"/> +<div class="container-fluid main"> + <div class="row-fluid"> + <div class="span10 offset1"> + + <h1>Hello ${ userInfo.name }</h1> + + <div> + <p>This page requires that the user be logged in with a valid account and the <code>ROLE_USER</code> Spring Security authority. + If you are reading this page, <span class="text-success">you are currently logged in</span>.</p> + + <security:authentication var="user" property="principal" /> + + <p>The authorization provider will create a Principal object based on the <code>iss</code> and <code>sub</code> + claims associated with your ID token. This value can be used as a globally unique username within the application + (though it's not meant to be human-readable). + Your Principal is: <code>${ user }</code></p> + + <p>The authorization provider will assign your account a set of authorities depending on how it's configured. + Your current login has the following Spring Security authorities:</p> + + <ul> + <security:authentication property="authorities" var="authorities" /> + <c:forEach items="${authorities}" var="auth"> + <li><code>${ auth }</code></li> + </c:forEach> + </ul> + + <h3>ID Token</h3> + + <p>Your ID Token has the following set of claims:</p> + + <security:authentication property="idToken" var="idToken" /> + <table class="table table-striped table-hover" id="idTokenTable"> + <thead> + <tr> + <th class="span1">Name</th> + <th class="span11">Value</th> + </tr> + </thead> + <tbody> + </tbody> + </table> + + <p>The ID Token header contains the following claims:</p> + + <table class="table table-striped table-hover" id="idTokenHeader"> + <thead> + <tr> + <th class="span1">Name</th> + <th class="span11">Value</th> + </tr> + </thead> + <tbody> + </tbody> + </table> + + <h3>User Info</h3> + + <p>The call to the User Info Endpoint returned the following set of claims:</p> + + <table class="table table-striped table-hover" id="userInfoTable"> + <thead> + <tr> + <th class="span1">Name</th> + <th class="span11">Value</th> + </tr> + </thead> + <tbody> + </tbody> + </table> + + </div> + + </div> + </div> +</div> + +<script type="text/javascript"> + $(document).ready(function () { + + var idTokenString = "${ idToken.serialize() }"; + var idToken = jwt.WebTokenParser.parse(idTokenString); + var idHeader = JSON.parse(jwt.base64urldecode(idToken.headerSegment)); + var idClaims = JSON.parse(jwt.base64urldecode(idToken.payloadSegment)); + + _.each(idClaims, function(val, key, list) { + if (_.contains(["iat", "exp", "auth_time", "nbf"], key)) { + // it's a date field, parse and print it + var date = new Date(val * 1000); + $('#idTokenTable tbody').append('<tr><td>' + _.escape(key) + '</td><td><span title="' + _.escape(val) + '">' + date + '</span></td></tr>'); + } else { + $('#idTokenTable tbody').append('<tr><td>' + _.escape(key) + '</td><td>' + _.escape(val) + '</td></tr>'); + } + }); + + _.each(idHeader, function(val, key, list) { + if (_.contains(["iat", "exp", "auth_time", "nbf"], key)) { + // it's a date field, parse and print it + var date = new Date(val * 1000); + $('#idTokenHeader tbody').append('<tr><td>' + _.escape(key) + '</td><td><span title="' + _.escape(val) + '">' + date + '</span></td></tr>'); + } else { + $('#idTokenHeader tbody').append('<tr><td>' + _.escape(key) + '</td><td>' + _.escape(val) + '</td></tr>'); + } + }); + + var userInfo = ${ userInfoJson }; + _.each(userInfo, function(val, key, list) { + $('#userInfoTable tbody').append('<tr><td>' + _.escape(key) + '</td><td>' + _.escape(val) + '</td></tr>'); + }); + }); + +</script> + +<o:footer /> |