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

java.lang.Object
  extended by com.unboundid.directory.sdk.broker.types.AuthorizationCode

@NotExtensible
@Mutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class AuthorizationCode
extends java.lang.Object

This class provides a data structure for working with OAuth2 temporary authorization codes.


Constructor Summary
AuthorizationCode(java.lang.String username, java.util.Set<java.lang.String> authorities, java.lang.String applicationId, java.lang.String redirectUri, java.util.Date generateTimestamp, long maxValiditySeconds, java.util.Set<java.lang.String> scopeIds, java.lang.String state, boolean offlineAccess)
          Construct a new authorization code instance.
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this authorization code.
 java.lang.String getApplicationId()
          Retrieves the application ID with which this authorization code is associated.
 java.util.Set<java.lang.String> getAuthorities()
          Retrieves the authorities of the resource owner.
 java.util.Date getGenerateTimestamp()
          Retrieves the time that this authorization code was generated.
 long getMaxValiditySeconds()
          Retrieves the maximum length of time in seconds that this code will be considered valid.
 java.lang.String getRedirectUri()
          Returns the endpoint to redirect the resource owner's user-agent back to the application.
 java.util.Set<java.lang.String> getScopeIds()
          Retrieves the set of scope IDs for which the client has been authorized.
 java.lang.String getState()
          Retrieves the opaque value used by the client to maintain state between the request and callback.
 java.lang.String getUsername()
          Retrieves the username of the resource owner this authorization code is associated with.
 java.lang.String getValue()
          Retrieves the string value of this authorization code that should be returned to the client.
 int hashCode()
          Retrieves a hash code for this authorization code.
 boolean isExpired()
          Indicates whether this authorization code is expired.
 boolean isOfflineAccess()
          Whether the client requested for offline access.
 void setValue(java.lang.String value)
          Sets the string value of this authorization code that should be returned to the client.
 java.lang.String toString()
          Retrieves a string representation of this authorization code.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AuthorizationCode

public AuthorizationCode(java.lang.String username,
                         java.util.Set<java.lang.String> authorities,
                         java.lang.String applicationId,
                         java.lang.String redirectUri,
                         java.util.Date generateTimestamp,
                         long maxValiditySeconds,
                         java.util.Set<java.lang.String> scopeIds,
                         java.lang.String state,
                         boolean offlineAccess)
Construct a new authorization code instance.

Parameters:
username - The username of the resource owner this authorization code is associated with. Must not be null.
authorities - The authorities of the resource owner. Must not be null.
applicationId - The application ID with which this token is associated. Must not be null.
redirectUri - the endpoint to redirect the resource owner's user-agent back to the application. 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.
scopeIds - The set of scopes for which the client has been authorized. Must not be null.
state - The opaque value used by the client to maintain state between the request and callback.
offlineAccess - Whether the client requested offline access.
Method Detail

getUsername

public java.lang.String getUsername()
Retrieves the username of the resource owner this authorization code is associated with.

Returns:
The username of the resource owner this authorization code is associated with.

getAuthorities

public java.util.Set<java.lang.String> getAuthorities()
Retrieves the authorities of the resource owner.

Returns:
The authorities of the resource owner.

getApplicationId

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

Returns:
The application ID with which this authorization code is associated.

getScopeIds

public java.util.Set<java.lang.String> getScopeIds()
Retrieves the set of scope IDs for which the client has been authorized.

Returns:
The set of scope IDs for which the client has been authorized.

getGenerateTimestamp

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

Returns:
The time that this authorization code 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.

isOfflineAccess

public boolean isOfflineAccess()
Whether the client requested for offline access.

Returns:
true if the client requested off offline access or false otherwise.

getState

public java.lang.String getState()
Retrieves the opaque value used by the client to maintain state between the request and callback.

Returns:
The opaque value used by the client to maintain state between the request and callback or null if it was not used.

getRedirectUri

public java.lang.String getRedirectUri()
Returns the endpoint to redirect the resource owner's user-agent back to the application.

Returns:
The endpoint to redirect the resource owner's user-agent back to the application.

getValue

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

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

setValue

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

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

isExpired

public boolean isExpired()
Indicates whether this authorization code is expired.

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

hashCode

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

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

equals

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

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 authorization code.

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