com.unboundid.directory.sdk.broker.types
Class Token

java.lang.Object
  extended by com.unboundid.directory.sdk.broker.types.Token
Direct Known Subclasses:
AccessToken, RefreshToken

public abstract class Token
extends java.lang.Object

Abstract class for an OAuth 2 token.


Constructor Summary
protected Token(java.lang.String applicationId, java.util.Date generateTimestamp, long maxValiditySeconds)
          Construct a new Token instance.
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this token.
 java.lang.String getApplicationId()
          Retrieves the application ID with which this token is associated.
 java.util.Date getGenerateTimestamp()
          Retrieves the time that this token was generated.
 long getMaxValiditySeconds()
          Retrieves the maximum length of time in seconds that this code will be considered valid.
 java.lang.String getValue()
          Retrieves the string value of this token that should be returned to the client.
 int hashCode()
          Retrieves a hash code for this token.
 boolean isExpired()
          Indicates whether this token is expired.
 void setValue(java.lang.String value)
          Sets the string value of this token that should be returned to the client.
 java.lang.String toString()
          Retrieves a string representation of this token.
protected abstract  void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this token to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Token

protected Token(java.lang.String applicationId,
                java.util.Date generateTimestamp,
                long maxValiditySeconds)
Construct a new Token instance.

Parameters:
applicationId - The application ID with which this token is associated. Must not be null.
generateTimestamp - The time that this token was generated. Must not be null.
maxValiditySeconds - The maximum length of time in seconds that this token will be considered valid. Must not be null.
Method Detail

getApplicationId

public java.lang.String getApplicationId()
Retrieves the application ID with which this token is associated.

Returns:
The application ID with which this token is associated.

getGenerateTimestamp

public java.util.Date getGenerateTimestamp()
Retrieves the time that this token was generated.

Returns:
The time that this token was generated.

getMaxValiditySeconds

public long getMaxValiditySeconds()
Retrieves the maximum length of time in seconds that this code will be considered valid.

Returns:
The maximum length of time in seconds that this code will be considered valid.

getValue

public java.lang.String getValue()
Retrieves the string value of this token that should be returned to the client.

Returns:
The string value of this token that should be returned to the client.

setValue

public void setValue(java.lang.String value)
Sets the string value of this token that should be returned to the client.

Parameters:
value - The string value of this token that should be returned to the client.

isExpired

public boolean isExpired()
Indicates whether this token is expired.

Returns:
true if this token is expired, or false if not.

hashCode

public int hashCode()
Retrieves a hash code for this token.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code for this token.

equals

public boolean equals(java.lang.Object o)
Indicates whether the provided object is equal to this token.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object for which to make the determination.
Returns:
true if the provided object is equal to this authorization code, or false if not.

toString

public java.lang.String toString()
Retrieves a string representation of this token.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this token.

toString

protected abstract void toString(java.lang.StringBuilder buffer)
Appends a string representation of this token to the provided buffer.

Parameters:
buffer - The buffer to which the string representation should be appended.