2 ============LICENSE_START==========================================
4 ===================================================================
5 Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 ===================================================================
8 Unless otherwise specified, all software contained herein is licensed
9 under the Apache License, Version 2.0 (the “License”);
10 you may not use this software except in compliance with the License.
11 You may obtain a copy of the License at
13 http://www.apache.org/licenses/LICENSE-2.0
15 Unless required by applicable law or agreed to in writing, software
16 distributed under the License is distributed on an "AS IS" BASIS,
17 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 See the License for the specific language governing permissions and
19 limitations under the License.
21 Unless otherwise specified, all documentation contained herein is licensed
22 under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
23 you may not use this documentation except in compliance with the License.
24 You may obtain a copy of the License at
26 https://creativecommons.org/licenses/by/4.0/
28 Unless required by applicable law or agreed to in writing, documentation
29 distributed under the License is distributed on an "AS IS" BASIS,
30 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 See the License for the specific language governing permissions and
32 limitations under the License.
34 ============LICENSE_END============================================
36 ECOMP is a trademark and service mark of AT&T Intellectual Property.
38 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
39 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
40 <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
41 <%@ taglib prefix="o" tagdir="/WEB-INF/tags"%>
42 <o:header title="User"/>
43 <o:topbar pageName="User"/>
44 <div class="container-fluid main">
45 <div class="row-fluid">
46 <div class="span10 offset1">
48 <h1>Hello ${ userInfo.name }</h1>
51 <p>This page requires that the user be logged in with a valid account and the <code>ROLE_USER</code> Spring Security authority.
52 If you are reading this page, <span class="text-success">you are currently logged in</span>.</p>
54 <security:authentication var="user" property="principal" />
56 <p>The authorization provider will create a Principal object based on the <code>iss</code> and <code>sub</code>
57 claims associated with your ID token. This value can be used as a globally unique username within the application
58 (though it's not meant to be human-readable).
59 Your Principal is: <code>${ user }</code></p>
61 <p>The authorization provider will assign your account a set of authorities depending on how it's configured.
62 Your current login has the following Spring Security authorities:</p>
65 <security:authentication property="authorities" var="authorities" />
66 <c:forEach items="${authorities}" var="auth">
67 <li><code>${ auth }</code></li>
73 <p>Your ID Token has the following set of claims:</p>
75 <security:authentication property="idToken" var="idToken" />
76 <table class="table table-striped table-hover" id="idTokenTable">
79 <th class="span1">Name</th>
80 <th class="span11">Value</th>
87 <p>The ID Token header contains the following claims:</p>
89 <table class="table table-striped table-hover" id="idTokenHeader">
92 <th class="span1">Name</th>
93 <th class="span11">Value</th>
102 <p>The call to the User Info Endpoint returned the following set of claims:</p>
104 <table class="table table-striped table-hover" id="userInfoTable">
107 <th class="span1">Name</th>
108 <th class="span11">Value</th>
121 <script type="text/javascript">
122 $(document).ready(function () {
124 var idTokenString = "${ idToken.serialize() }";
125 var idToken = jwt.WebTokenParser.parse(idTokenString);
126 var idHeader = JSON.parse(jwt.base64urldecode(idToken.headerSegment));
127 var idClaims = JSON.parse(jwt.base64urldecode(idToken.payloadSegment));
129 _.each(idClaims, function(val, key, list) {
130 if (_.contains(["iat", "exp", "auth_time", "nbf"], key)) {
131 // it's a date field, parse and print it
132 var date = new Date(val * 1000);
133 $('#idTokenTable tbody').append('<tr><td>' + _.escape(key) + '</td><td><span title="' + _.escape(val) + '">' + date + '</span></td></tr>');
135 $('#idTokenTable tbody').append('<tr><td>' + _.escape(key) + '</td><td>' + _.escape(val) + '</td></tr>');
139 _.each(idHeader, function(val, key, list) {
140 if (_.contains(["iat", "exp", "auth_time", "nbf"], key)) {
141 // it's a date field, parse and print it
142 var date = new Date(val * 1000);
143 $('#idTokenHeader tbody').append('<tr><td>' + _.escape(key) + '</td><td><span title="' + _.escape(val) + '">' + date + '</span></td></tr>');
145 $('#idTokenHeader tbody').append('<tr><td>' + _.escape(key) + '</td><td>' + _.escape(val) + '</td></tr>');
149 var userInfo = ${ userInfoJson };
150 _.each(userInfo, function(val, key, list) {
151 $('#userInfoTable tbody').append('<tr><td>' + _.escape(key) + '</td><td>' + _.escape(val) + '</td></tr>');