Class SSOTokenManager
SSOTokenManager is a singleton class; there can be, at most, only one instance of SSOTokenManager in any given JVM.
SSOTokenManager currently supports only two kinds of provider: Grappa and OpenAM.
It is assumed that the provider classes or the JAR file is in the
CLASSPATH so that they can be found automatically. Providers can be
configured using providerimplclass
property.
This property must be set to the complete (absolute) package name of the
main class of the provider. For example, if the provider class is
com.iplanet.sso.providers.dpro.SSOProviderImpl, that entire class name
including package prefixes MUST be specified. The main class MUST implement
the com.iplanet.sso.SSOProvider interface and MUST have a public no-arg
default constructor.
The class SSOTokenManager
is a final
class that
provides interfaces to create and validate SSOToken
s.
It is a singleton class; an instance of this class can be obtained by calling
SSOTokenManager.getInstance()
.
Having obtained an instance of SSOTokenManager
, its methods
can be called to create SSOToken
, get SSOToken
given the SSOTokenID
in string format, and to validate
SSOToken
s.
-
Method Summary
Modifier and TypeMethodDescriptioncreateSSOToken
(String tokenId) Creates a single sign on token from the single sign on token ID.createSSOToken
(String tokenId, String clientIP) Creates a single sign on token from the single sign on token ID.createSSOToken
(javax.servlet.http.HttpServletRequest request) Creates a single sign on token fromHttpServletRequest
void
destroyToken
(SSOToken token) Destroys a single sign on token.void
destroyToken
(SSOToken destroyer, SSOToken destroyed) Destroys a single sign on token.static SSOTokenManager
Returns the singleton instance ofSSOTokenManager
.getValidSessions
(SSOToken requester, String server) Returns a list of single sign on token objects which correspond to valid Sessions accessible to requester.boolean
isValidToken
(SSOToken token) Returns true if a single sign on token is valid.boolean
isValidToken
(SSOToken token, boolean resetIdleTime) Returns true if a single sign on token is valid, resetting the token's idle time if and only if the flag allows us to.void
refreshSession
(SSOToken token) Refresh the Session corresponding to the single sign on token from the Session Server.void
validateToken
(SSOToken token) Returns true if the single sign on token is valid.
-
Method Details
-
getInstance
Returns the singleton instance ofSSOTokenManager
.- Returns:
- The singleton
SSOTokenManager
instance - Throws:
SSOException
- if unable to get the singletonSSOTokenManager
instance.
-
createSSOToken
@Supported public SSOToken createSSOToken(javax.servlet.http.HttpServletRequest request) throws UnsupportedOperationException, SSOException Creates a single sign on token fromHttpServletRequest
- Parameters:
request
- TheHttpServletRequest
object which contains the session string.- Returns:
- single sign on
SSOToken
- Throws:
SSOException
- if the single sign on token cannot be created.UnsupportedOperationException
- if this is an unsupported operation.
-
createSSOToken
@Supported public SSOToken createSSOToken(String tokenId) throws UnsupportedOperationException, SSOException Creates a single sign on token from the single sign on token ID. Note:-If you want to do Client's IP address validation for the single sign on token then usecreatSSOToken(String, String)
ORcreateSSOToken(HttpServletRequest)
.- Parameters:
tokenId
- Token ID of the single sign on token- Returns:
- single sign on token
- Throws:
SSOException
- if the single sign on token cannot be created.UnsupportedOperationException
- If the operation is not supported by the provider.
-
createSSOToken
@Supported public SSOToken createSSOToken(String tokenId, String clientIP) throws UnsupportedOperationException, SSOException Creates a single sign on token from the single sign on token ID.- Parameters:
tokenId
- Token ID of the single sign on tokenclientIP
- Client IP address. This must be the IP address of the client/user who is accessing the application.- Returns:
- single sign on token
- Throws:
SSOException
- if the single sign on token cannot be created.UnsupportedOperationException
- If the operation is not supported by the provider.
-
isValidToken
Returns true if a single sign on token is valid. Your token may have its idle time reset. You have been warned.- Parameters:
token
- The single sign on token object to be validated.- Returns:
- true if the single sign on token is valid.
-
isValidToken
Returns true if a single sign on token is valid, resetting the token's idle time if and only if the flag allows us to.- Parameters:
token
- The single sign on token object to be validated.- Returns:
- true if the single sign on token is valid.
-
validateToken
Returns true if the single sign on token is valid.- Parameters:
token
- The single sign on token object to be validated.- Throws:
SSOException
- if the single sign on token is not valid.
-
destroyToken
Destroys a single sign on token.- Parameters:
token
- The single sign on token object to be destroyed.- Throws:
SSOException
- if there was an error while destroying the token, or the corresponding session reached its maximum session/idle time, or the session was destroyed.
-
refreshSession
Refresh the Session corresponding to the single sign on token from the Session Server. This method should only be used when the client cannot wait the "session cache interval" for updates on any changes made to the session properties in the session server. If the client is remote, calling this method results in an over the wire request to the session server.- Parameters:
token
- single sign on token- Throws:
SSOException
- if the session reached its maximum session time, or the session was destroyed, or there was an error while refreshing the session.
-
destroyToken
Destroys a single sign on token.- Parameters:
destroyer
- The single sign on token object used to authorize the operationdestroyed
- The single sign on token object to be destroyed.- Throws:
SSOException
- if the there was an error during communication with session service.
-
getValidSessions
Returns a list of single sign on token objects which correspond to valid Sessions accessible to requester. Single sign on tokens returned are restricted: they can only be used to retrieve properties and destroy sessions they represent.- Parameters:
requester
- The single sign on token object used to authorize the operationserver
- The server for which the valid sessions are to be retrieved- Returns:
- Set The set of single sign on tokens representing valid Sessions.
- Throws:
SSOException
- if the there was an error during communication with session service.
-