St. Charles' JSP to Print Session Token Properties

Charles, a Sun QA engineer, recently posted a JSP to the OpenSSO mailing list that allows you to print out the properties (UserID, Principal, Client Address, and the like) populated in an SSOToken. I'm reposting the code here so it doesn't get lost in the maelstrom.
<%--
   Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved
   Use is subject to license terms.
--%>

<html>
<head>
   
   <title>Show Session Property</title>

   <%@page import="com.iplanet.sso.\*" %>

</head>
<body>

<%  
   SSOToken ssoToken = SSOTokenManager.getInstance().createSSOToken(request);
   String value = "";
   String propertyName  = request.getParameter("propertyName");
   if (propertyName != null) {
       value = ssoToken.getProperty(propertyName);
   }
%>

<h1>Session Property</h1>

<form action="show-session-property.jsp" method="POST">
   Property Name <input name="propertyName" value="<%= propertyName %>" size="40"/>
   <p/>
   <input name="submit" type="submit" value="GetValue" />
</form>
<br/>
<%=propertyName%>: <%=value%><br/>
Principal: <%=ssoToken.getProperty("Principal")%><br/>
Principals: <%=ssoToken.getProperty("Principals")%><br/>
UserToken: <%=ssoToken.getProperty("UserToken")%><br/>
UserId: <%=ssoToken.getProperty("UserId")%><br/>
sun.am.UniversalIdentifier: <%=ssoToken.getProperty("sun.am.UniversalIdentifier")%><br/>
Organization :<%=ssoToken.getProperty("Organization")%><br/>
IndexType: <%=ssoToken.getProperty("IndexType")%><br/>
Service: <%=ssoToken.getProperty("Service")%><br/>
AuthType: <%=ssoToken.getProperty("AuthType")%><br/>
AuthLevel: <%=ssoToken.getProperty("AuthLevel")%><br/>
authInstant: <%=ssoToken.getProperty("authInstant")%><br/>
moduleAuthTime: <%=ssoToken.getProperty("moduleAuthTime")%><br/>
amlbcookie: <%=ssoToken.getProperty("amlbcookie")%><br/>
Host: <%=ssoToken.getProperty("Host")%><br/>
CharSet: <%=ssoToken.getProperty("CharSet")%><br/>
Locale: <%=ssoToken.getProperty("Locale")%><br/>
</body>
</html>

In honor of CMW, here's Jefferson Starship and the promotional film (cough, video) for their 1976 single, St. Charles. Although it's a great song, at 6 minutes and 40 seconds, I can see why it peaked at number 64. (Don't ask how I remember these things.)


Comments:

Any chance of getting this added to the agentsample app of the Policy Agents?

Posted by Damien on August 24, 2009 at 04:22 PM PDT #

Your best bet is to file a Request For Enhancement (RFE) using Issue Tracker and assign it to the agents team. Paste the URL to this entry so they know what you are referring to.

Posted by DocTeger on August 24, 2009 at 11:14 PM PDT #

Is it possible to access these properties via a REST interface in the same manner as accessing the identity attributes?

Posted by Andy on January 26, 2010 at 11:14 AM PST #

Post a Comment:
Comments are closed for this entry.
About

docteger

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today