Class AuthSSOToken
- java.lang.Object
-
- com.sun.identity.authentication.internal.AuthSSOToken
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AuthSSOToken.AuthSSOTokenID
-
Field Summary
Fields Modifier and Type Field Description protected static Map
allSSOTokens
protected AuthContext
authContext
protected HashSet
callbackObjects
static int
DESTROYED
static int
INVALID
protected String
key
protected static Random
random
protected HashMap
session
static int
VALID
-
Constructor Summary
Constructors Modifier Constructor Description protected
AuthSSOToken(AuthContext authc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSSOTokenListener(SSOTokenListener listener)
Adds an SSO token listener for the token change events.String
dereferenceRestrictedTokenID(SSOToken requester, String restrictedId)
Given a restricted token, returns the SSOTokenID of the master token can only be used if the requester is an app tokenString
encodeURL(String url)
Returns the encoded URL , rewritten to include the session id.byte[]
getAddress()
int
getAuthLevel()
Returns the authentication level of the authentication method used for authentication.String
getAuthType()
Returns the authentication method used for authentication.String
getHostName()
Returns the host name of the client (browser) that sent the request.long
getIdleTime()
Returns the session idle time in seconds.InetAddress
getIPAddress()
Returns the IP Address of the client (browser) that sent the request.long
getMaxIdleTime()
Returns the maximum session idle time in minutes.long
getMaxSessionTime()
Returns the maximum session time in minutes.protected static String
getNewKey()
Principal
getPrincipal()
Returns the value of the property "Principal" set to the single sign on token.String
getProperty(String name)
Gets the property stored in this token.String
getProperty(String name, boolean ignoreState)
Gets the property stored in this token.protected int
getState()
long
getTimeLeft()
Returns the time left in seconds on the session based on max session time.SSOTokenID
getTokenID()
Returns single sign on token ID object.protected void
invalidate()
boolean
isTokenRestricted()
Returns true if the SSOTokenID associated with this SSOToken is a restricted token, false otherwise.protected boolean
isValid()
void
setProperty(String name, String value)
Sets a property for this token.protected void
validate()
-
-
-
Field Detail
-
allSSOTokens
protected static Map allSSOTokens
-
random
protected static Random random
-
INVALID
public static final int INVALID
- See Also:
- Constant Field Values
-
VALID
public static final int VALID
- See Also:
- Constant Field Values
-
DESTROYED
public static final int DESTROYED
- See Also:
- Constant Field Values
-
authContext
protected AuthContext authContext
-
session
protected HashMap session
-
callbackObjects
protected HashSet callbackObjects
-
key
protected String key
-
-
Constructor Detail
-
AuthSSOToken
protected AuthSSOToken(AuthContext authc) throws InvalidAuthContextException
- Throws:
InvalidAuthContextException
-
-
Method Detail
-
getNewKey
protected static String getNewKey()
-
getPrincipal
public Principal getPrincipal() throws SSOException
Description copied from interface:SSOToken
Returns the value of the property "Principal" set to the single sign on token.- Specified by:
getPrincipal
in interfaceSSOToken
- Returns:
- The principal name
- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in getting the principal
-
getAuthType
public String getAuthType() throws SSOException
Description copied from interface:SSOToken
Returns the authentication method used for authentication.- Specified by:
getAuthType
in interfaceSSOToken
- Returns:
- The authentication method
- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in getting the authentication method
-
getAuthLevel
public int getAuthLevel() throws SSOException
Description copied from interface:SSOToken
Returns the authentication level of the authentication method used for authentication.- Specified by:
getAuthLevel
in interfaceSSOToken
- Returns:
- The authentication level
- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in getting the authentication level
-
getIPAddress
public InetAddress getIPAddress() throws SSOException
Description copied from interface:SSOToken
Returns the IP Address of the client (browser) that sent the request.- Specified by:
getIPAddress
in interfaceSSOToken
- Returns:
- The IP Address of the client
- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in getting the IP Address of the client
-
getHostName
public String getHostName() throws SSOException
Description copied from interface:SSOToken
Returns the host name of the client (browser) that sent the request.- Specified by:
getHostName
in interfaceSSOToken
- Returns:
- The host name of the client
- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in getting the host name of the client
-
getAddress
public byte[] getAddress() throws SSOException
- Throws:
SSOException
-
getTimeLeft
public long getTimeLeft() throws SSOException
Description copied from interface:SSOToken
Returns the time left in seconds on the session based on max session time.- Specified by:
getTimeLeft
in interfaceSSOToken
- Returns:
- The time left in seconds on the session.
- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in getting the maximum session time.
-
encodeURL
public String encodeURL(String url)
Description copied from interface:SSOToken
Returns the encoded URL , rewritten to include the session id. The session id will be encoded in the URL as a query string with entity escaping of ampersand when appending the session id to the query string if the query string has other query parameters.Encoded URL format if query string in the original URL passed is present will be :
protocol://server:port/path?queryString&cookieName=cookieValue
Encoded URL format if query string in the original URL passed is not present will be:protocol://server:port/path?cookieName=cookieValue
-
getMaxSessionTime
public long getMaxSessionTime() throws SSOException
Description copied from interface:SSOToken
Returns the maximum session time in minutes.- Specified by:
getMaxSessionTime
in interfaceSSOToken
- Returns:
- The maximum session time in minutes
- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in getting the maximum session time
-
getIdleTime
public long getIdleTime() throws SSOException
Description copied from interface:SSOToken
Returns the session idle time in seconds.- Specified by:
getIdleTime
in interfaceSSOToken
- Returns:
- The session idle time in seconds
- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in getting the session idle time
-
getMaxIdleTime
public long getMaxIdleTime() throws SSOException
Description copied from interface:SSOToken
Returns the maximum session idle time in minutes.- Specified by:
getMaxIdleTime
in interfaceSSOToken
- Returns:
- The maximum session idle time in minutes
- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in getting the maximum idle time
-
getTokenID
public SSOTokenID getTokenID()
Description copied from interface:SSOToken
Returns single sign on token ID object.- Specified by:
getTokenID
in interfaceSSOToken
- Returns:
- single sign on token ID.
-
getState
protected int getState() throws SSOException
- Throws:
SSOException
-
setProperty
public void setProperty(String name, String value) throws SSOException
Description copied from interface:SSOToken
Sets a property for this token.- Specified by:
setProperty
in interfaceSSOToken
- Parameters:
name
- The property name.value
- The property value.- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in setting the property name and value
-
getProperty
public String getProperty(String name) throws SSOException
Description copied from interface:SSOToken
Gets the property stored in this token.- Specified by:
getProperty
in interfaceSSOToken
- Parameters:
name
- The property name.- Returns:
- The property value in string format.
- Throws:
SSOException
- if the single sign on token is not valid or if there are errors in getting the property value
-
getProperty
public String getProperty(String name, boolean ignoreState) throws SSOException
Description copied from interface:SSOToken
Gets the property stored in this token. When ignoreState is set to true, it will return the session property value without refreshing the session even if the session state is invalid but it should be running in the server mode- Specified by:
getProperty
in interfaceSSOToken
- Parameters:
name
- The property name.ignoreState
- The ignoreState flag.- Returns:
- The property value in string format.
- Throws:
SSOException
- if the SSOToken is not VALID and if ignoreState is set to false.
-
addSSOTokenListener
public void addSSOTokenListener(SSOTokenListener listener) throws SSOException
Description copied from interface:SSOToken
Adds an SSO token listener for the token change events.- Specified by:
addSSOTokenListener
in interfaceSSOToken
- Parameters:
listener
- A reference to anSSOTokenListener
object.- Throws:
SSOException
- if the token is not valid or if there are errors in setting the SSO token listener.
-
isValid
protected boolean isValid()
-
validate
protected void validate() throws SSOException
- Throws:
SSOException
-
invalidate
protected void invalidate()
-
isTokenRestricted
public boolean isTokenRestricted() throws SSOException
Description copied from interface:SSOToken
Returns true if the SSOTokenID associated with this SSOToken is a restricted token, false otherwise.- Specified by:
isTokenRestricted
in interfaceSSOToken
- Returns:
- true if the token is restricted
- Throws:
SSOException
- If we are unable to determine if the session is restricted
-
dereferenceRestrictedTokenID
public String dereferenceRestrictedTokenID(SSOToken requester, String restrictedId) throws SSOException
Description copied from interface:SSOToken
Given a restricted token, returns the SSOTokenID of the master token can only be used if the requester is an app token- Specified by:
dereferenceRestrictedTokenID
in interfaceSSOToken
- Parameters:
requester
- Must be an app tokenrestrictedId
- The SSOTokenID of the restricted token- Returns:
- The SSOTokenID string of the master token
- Throws:
SSOException
- If the master token cannot be dereferenced
-
-