public class TokenCredential extends Object implements Credential
Modifier and Type | Field and Description |
---|---|
static int |
AUTHENTICATION_COUNT_UNLIMITED
Specifies no limit on the number of times the token can be used
to authenticate.
|
protected int |
m_AllowedAuthenticationCount
The total number of times the token can be used to authenticate.
|
protected String |
m_Name
The user name.
|
protected Hashtable |
m_Parameters
Additional parameters whose values are ignored in authenticating
using the token.
|
protected Hashtable |
m_RequiredParameters
The parameters whose values must be correctly specified in order
to authenticate using the token.
|
protected LibrarySession |
m_Session
The LibrarySession that constructed this.
|
protected int |
m_TimeoutPeriod
The period, in seconds, for which the token is valid.
|
protected String |
m_Token
The token.
|
protected int |
m_TokenLength
The length of the token, in characters.
|
Constructor and Description |
---|
TokenCredential(LibrarySession session)
Constructs a new TokenCredential.
|
Modifier and Type | Method and Description |
---|---|
int |
getAllowedAuthenticationCount()
Gets the total number of times this TokenCredential can be used to
authenticate.
|
String |
getName()
Gets the name of the user.
|
Serializable |
getParameter(String name)
Gets the value of the specified parameter.
|
Hashtable |
getParameters(boolean required)
Gets the specified parameters.
|
int |
getTimeoutPeriod()
Gets the period of time for which this TokenCredential is valid.
|
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 |
setName(String name)
Sets the name of the user.
|
void |
setParameter(String name,
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.
|
public static final int AUTHENTICATION_COUNT_UNLIMITED
Equal to Integer.MAX_VALUE
.
protected transient LibrarySession m_Session
protected String m_Name
protected int m_TimeoutPeriod
protected int m_AllowedAuthenticationCount
protected int m_TokenLength
protected String m_Token
protected Hashtable m_RequiredParameters
protected Hashtable m_Parameters
public TokenCredential(LibrarySession session) throws IfsException
session
- the session that constructs the TokenCredentialIfsException
- (IFS-10180) if the operation failspublic String getName() throws IfsException
getName
in interface Credential
IfsException
- (IFS-10187) if the operation failspublic void setName(String name) throws IfsException
setName
in interface Credential
name
- the name of the userIfsException
- (IFS-10188) if the operation failspublic void setTimeoutPeriod(int period) throws IfsException
The time period begins when getToken
is called for
the first time. The timeout period defaults to 600 seconds.
period
- the timeout period, in secondsIfsException
- (IFS-10181) if the operation failspublic int getTimeoutPeriod() throws IfsException
IfsException
- if the operation failspublic void setAllowedAuthenticationCount(int count) throws IfsException
Defaults to 1 time. If AUTHENTICATION_COUNT_UNLIMITED
,
there is no limit on the number of times this TokenCredential can be
used, subject to the timeout period.
count
- the countIfsException
- (IFS-10182) if the operation failspublic int getAllowedAuthenticationCount() throws IfsException
If AUTHENTICATION_COUNT_UNLIMITED
, there is no limit
on the number of times this TokenCredential can be used, subject
to the timeout period.
IfsException
- if the operation failspublic void setTokenLength(int length) throws IfsException
Defaults to 40 characters.
length
- the token length, in charactersIfsException
- (IFS-10183) if the operation failspublic int getTokenLength() throws IfsException
IfsException
- if the operation failspublic String getToken() throws IfsException
When this method is invoked for the first time, this TokenCredential becomes immutable.
IfsException
- (IFS-10184) if the operation failspublic void setParameter(String name, Serializable value, boolean required) throws IfsException
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.
name
- the parameter namevalue
- the parameter valuerequired
- whether the application attempting to authenticate
using this TokenCredential must supply an identical
parameter name and value to succeedIfsException
- (IFS-10185) if the operation failspublic Serializable getParameter(String name) throws IfsException
name
- the parameter nameIfsException
- (IFS-10186) if the operation failspublic Hashtable getParameters(boolean required) throws IfsException
required
- if true, returns only the required parameters;
if false, returns only the non-required parametersIfsException
- if the operation failsCopyright © 2023. All rights reserved.