User guide
Chapter 7: Developing Applications
7-12
Obtaining User Information
When JAAS authentication is executed successfully, the objects listed below are associated with the
Subject object specified when converting the LoginContext to an instance.
• Credential object that indicates authentication information
• Principal object that indicates the user ID of the authenticated user
• Principal object that indicates the name of the role to which the user belongs
• Principal object that indicates the unique distinguished name in the SSO repository.
The object that indicates authentication information can be obtained with the following Subject object
methods:
• public Set getPrivateCredentials()
• public Set getPrivateCredentials(Class c)
A set of all Credential objects associated with the Subject object can be obtained with the
getPrivateCredentials() method. A set of Credential objects in the Class class (or a subclass of the
Class class) that are associated with the Subject object can be obtained with the
getPrivateCredentials(Class c) method
Table 7-6 lists the class of objects that can be associated with the Subject object.
Table 7-6 Object Classes Associated with the Subject Object
Class Name Explanation
com.fujitsu.interstage.sso.auth.ISAuthorizationCredential Retains information (a value obtained
from the Cookie) indicating SSO
authentication success and data in
authentication information.
The code is shown below.
Set credentials = subject.getPrivateCredentials();
// display credential information
Iterator iterator = credentials.iterator();
while (iterator.hasNext()) {
// Processing for referencing authentication information
if (credential instanceof ISAuthorizationCredential){
}
}
Principal objects can be obtained with the following Subject object methods:
• public Set getPrincipals();
• public Set getPrincipals(Class c);
The difference between these methods is the same as the difference between the getPrivateCredentials
methods.
Table 7-7 lists the classes of objects that can be associated with the Subject object.