oracle.ifs.common
Class TokenCredential


java.lang.Object

  |

  +--oracle.ifs.common.TokenCredential

All Implemented Interfaces:
Credential, java.io.Serializable

public final class TokenCredential
extends java.lang.Object
implements Credential

A TokenCredential encapsulates a token created by an authenticated LibrarySession that may be used to create a new LibrarySession, authenticating as the same DirectoryUser as the earlier session.

See Also:
Serialized Form

Constructor Summary
TokenCredential(LibrarySession session)
          Constructs a new TokenCredential.
 
Method Summary
 int getAllowedAuthenticationCount()
          Gets the total number of times this TokenCredential can be used to authenticate.
 java.lang.String getName()
          Gets the name of the user.
 java.io.Serializable getParameter(java.lang.String name)
          Gets the value of the specified parameter.
 java.util.Hashtable getParameters(boolean required)
          Gets the specified parameters.
 int getTimeoutPeriod()
          Gets the period of time for which this TokenCredential is valid.
 java.lang.String getToken()
          Gets the token.
 int getTokenLength()
          Gets the length of the token.
 void setAllowedAuthenticationCount(int count)
          Sets the total number of times this TokenCredential can be used to authenticate.
 void setParameter(java.lang.String name, java.io.Serializable value, boolean required)
          Sets an application-defined parameter for this TokenCredential.
 void setTimeoutPeriod(int period)
          Sets the period of time for which this TokenCredential is valid.
 void setTokenLength(int length)
          Sets the length of the token.
 

Constructor Detail


TokenCredential


public TokenCredential(LibrarySession session)
                throws IfsException
Constructs a new TokenCredential.
Parameters:
session - the session that constructs the TokenCredential
Throws:
IfsException - (IFS-10180) if the operation fails
Method Detail

getName


public java.lang.String getName()
                         throws IfsException
Gets the name of the user.
Specified by:
getName in interface Credential
Returns:
the name of the user
Throws:
IfsException - if the operation fails

setTimeoutPeriod


public void setTimeoutPeriod(int period)
                      throws IfsException
Sets the period of time for which this TokenCredential is valid.

The time period begins when getToken is called for the first time. The timeout period defaults to 600 seconds.

Parameters:
period - the timeout period, in seconds
Throws:
IfsException - (IFS-10181) if the operation fails

getTimeoutPeriod


public int getTimeoutPeriod()
                     throws IfsException
Gets the period of time for which this TokenCredential is valid.
Returns:
the timeout period, in seconds
Throws:
IfsException - if the operation fails

setAllowedAuthenticationCount


public void setAllowedAuthenticationCount(int count)
                                   throws IfsException
Sets the total number of times this TokenCredential can be used to authenticate.

Defaults to 1 time.

Parameters:
count - the count
Throws:
IfsException - (IFS-10182) if the operation fails

getAllowedAuthenticationCount


public int getAllowedAuthenticationCount()
                                  throws IfsException
Gets the total number of times this TokenCredential can be used to authenticate.
Returns:
the count
Throws:
IfsException - if the operation fails

setTokenLength


public void setTokenLength(int length)
                    throws IfsException
Sets the length of the token.

Defaults to 40 characters.

Parameters:
length - the token length, in characters
Throws:
IfsException - (IFS-10183) if the operation fails

getTokenLength


public int getTokenLength()
                   throws IfsException
Gets the length of the token.
Parameters:
length - the token length, in characters
Throws:
IfsException - if the operation fails

getToken


public java.lang.String getToken()
                          throws IfsException
Gets the token.

When this method is invoked for the first time, this TokenCredential becomes immutable.

Returns:
returns a token, consisting of a random sequence of characters (A-Z) and digits (0-9)
Throws:
IfsException - (IFS-10184) if the operation fails

setParameter


public void setParameter(java.lang.String name,
                         java.io.Serializable value,
                         boolean required)
                  throws IfsException
Sets an application-defined parameter for this TokenCredential.

Parameters may be used in two ways:

Setting a parameter with required equal to true forces the application attempting to authenticate using this TokenCredential to supply the identical parameter name and value. This can be used to increase the security of the TokenCredential when the processes creating and using the credential have shared knowledge of some data, such as the client's IP address.

Setting a parameter with required equal to false allows the process creating the credential to pass data to the process using the credential.

Parameters:
name - the parameter name
value - the parameter value
required - whether the application attempting to authenticate using this TokenCredential must supply an identical parameter name and value to succeed
Throws:
IfsException - (IFS-10185) if the operation fails

getParameter


public java.io.Serializable getParameter(java.lang.String name)
                                  throws IfsException
Gets the value of the specified parameter.
Parameters:
name - the parameter name
Throws:
IfsException - (IFS-10186) if the operation fails

getParameters


public java.util.Hashtable getParameters(boolean required)
                                  throws IfsException
Gets the specified parameters.
Parameters:
required - if true, returns only the required parameters; if false, returns only the non-required parameters
Returns:
the parameters
Throws:
IfsException - if the operation fails