com.iplanet.sso
Class SSOTokenManager

java.lang.Object
  |
  +--com.iplanet.sso.SSOTokenManager

public final class SSOTokenManager
extends java.lang.Object

The class SSOTokenManager is a final class that provides interfaces to create, get, and validate SSOTokens.

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 SSOTokens.


Field Summary
static com.iplanet.services.util.Debug debug
           
 
Method Summary
 SSOToken createSSOToken(HttpServletRequest request)
          Creates an SSOToken from HttpServletRequest
 SSOToken createSSOToken(java.security.Principal user, java.lang.String password)
          Creates an SSOToken after authenticating the principal with the given password.
 SSOToken createSSOToken(java.lang.String tokenId)
          Creates an SSOToken from the SSOtoken id.
 SSOToken createSSOToken(java.lang.String tokenId, java.lang.String clientIP)
          Creates an SSOToken from the SSOtoken id.
 void destroyToken(SSOToken token)
          Destroys an SSOToken.
static SSOTokenManager getInstance()
          Gets the singleton instance of SSOTokenManager.
 boolean isValidToken(SSOToken token)
          Checks if an SSOToken is valid or not.
 void refreshSession(SSOToken token)
          Refresh the Session corresponding to the SSOToken from the Session Server.
 void validateToken(SSOToken token)
          Checks if the SSOToken is valid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static com.iplanet.services.util.Debug debug
Method Detail

getInstance

public static SSOTokenManager getInstance()
                                   throws SSOException
Gets the singleton instance of SSOTokenManager.
Returns:
SSOTokenManager The singleton SSOTokenManager instance
Throws:
SSOException - if unable to get the singleton SSOTokenManager instance

createSSOToken

public SSOToken createSSOToken(HttpServletRequest request)
                        throws java.lang.UnsupportedOperationException,
                               SSOException
Creates an SSOToken from HttpServletRequest
Parameters:
HttpServletRequest -  
Returns:
SSOToken
Throws:
An - SSOException is thrown if the SSOToken cannot be created.

createSSOToken

public SSOToken createSSOToken(java.security.Principal user,
                               java.lang.String password)
                        throws java.lang.UnsupportedOperationException,
                               SSOException
Creates an SSOToken after authenticating the principal with the given password. This method of creating an SSOToken should only be used for command line applications only. A token created with this method is only valid within the context of the calling application. Once the process exits the token will be destroyed. If token is created using this constructor then ONLY these methods of SSOToken is supported - getAuthType(), getHostName(), getIPAddress(), setProperty(String name, String value), getProperty(String name), isValid(), validate().
Parameters:
Principal - representing a user or service
Password -  
Returns:
SSOToken
Throws:
An - SSOException is thrown if the SSOToken cannot be created.

createSSOToken

public SSOToken createSSOToken(java.lang.String tokenId)
                        throws java.lang.UnsupportedOperationException,
                               SSOException
Creates an SSOToken from the SSOtoken id.
Parameters:
String - Tokenid of the SSOToken
Returns:
SSOToken
Throws:
an - SSOException is thrown if the SSOToken cannot be created. Note:-If you want to do Client's IP address validation for the SSOToken then use creatSSOToken(String tokenid, String ClientIP) OR createSSOToken(HttpServletRequest request).

createSSOToken

public SSOToken createSSOToken(java.lang.String tokenId,
                               java.lang.String clientIP)
                        throws java.lang.UnsupportedOperationException,
                               SSOException
Creates an SSOToken from the SSOtoken id.
Parameters:
String - Tokenid of the SSOToken
String - Client IP address. This must be the IP address of the client/user who is accessing the application.
Returns:
SSOToken
Throws:
an - SSOException is thrown if the SSOToken cannot be created.

isValidToken

public boolean isValidToken(SSOToken token)
Checks if an SSOToken is valid or not.
Parameters:
token - The SSOToken object to be validated.
Returns:
true if the SSOToken is Valid, false otherwise.

validateToken

public void validateToken(SSOToken token)
                   throws SSOException
Checks if the SSOToken is valid.
Parameters:
token - The SSOToken object to be validated.
Returns:
None
Throws:
an - SSOException if the SSOToken is not valid.

destroyToken

public void destroyToken(SSOToken token)
                  throws SSOException
Destroys an SSOToken.
Parameters:
token - The SSOToken object to be destroyed.
Returns:
None

refreshSession

public void refreshSession(SSOToken token)
                    throws SSOException
Refresh the Session corresponding to the SSOToken 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:
ssoToken - SSOToken