com.nimbusds.oauth2.sdk.id
Class Identifier

java.lang.Object
  extended by com.nimbusds.oauth2.sdk.id.Identifier
All Implemented Interfaces:
net.minidev.json.JSONAware
Direct Known Subclasses:
AccessTokenHash, AccessTokenType, ACR, AMR, Audience, AuthorizationCode, AuthorizedParty, ClientAuthenticationMethod, ClientID, CodeHash, Gender, GrantType, Issuer, JWTID, Nonce, ResponseType.Value, Scope.Value, State, Subject, Token

public abstract class Identifier
extends Object
implements net.minidev.json.JSONAware

The base abstract class for representing identifiers and identities. Provides constructors that generate Base64URL-encoded secure random identifier values.

Extending classes must override the equals(java.lang.Object) method.

Author:
Vladimir Dzhuvinov

Field Summary
static int DEFAULT_BYTE_LENGTH
          The default byte length of generated identifiers.
 
Constructor Summary
Identifier()
          Creates a new identifier with a randomly generated 256-bit (32-byte) value, Base64URL-encoded.
Identifier(int byteLength)
          Creates a new identifier with a randomly generated value of the specified byte length, Base64URL-encoded.
Identifier(String value)
          Creates a new identifier with the specified value.
 
Method Summary
abstract  boolean equals(Object object)
          Overrides Object.equals().
 String getValue()
          Gets the value of this identifier.
 int hashCode()
          Overrides Object.hashCode().
 String toJSONString()
          Returns the JSON string representation of this identifier.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_BYTE_LENGTH

public static final int DEFAULT_BYTE_LENGTH
The default byte length of generated identifiers.

See Also:
Constant Field Values
Constructor Detail

Identifier

public Identifier(String value)
Creates a new identifier with the specified value.

Parameters:
value - The identifier value. Must not be null or empty string.

Identifier

public Identifier(int byteLength)
Creates a new identifier with a randomly generated value of the specified byte length, Base64URL-encoded.

Parameters:
byteLength - The byte length of the value to generate. Must be greater than one.

Identifier

public Identifier()
Creates a new identifier with a randomly generated 256-bit (32-byte) value, Base64URL-encoded.

Method Detail

getValue

public String getValue()
Gets the value of this identifier.

Returns:
The value.

toJSONString

public String toJSONString()
Returns the JSON string representation of this identifier.

Specified by:
toJSONString in interface net.minidev.json.JSONAware
Returns:
The JSON string.

toString

public String toString()
Overrides:
toString in class Object
See Also:
getValue()

hashCode

public int hashCode()
Overrides Object.hashCode().

Overrides:
hashCode in class Object
Returns:
The object hash code.

equals

public abstract boolean equals(Object object)
Overrides Object.equals().

Overrides:
equals in class Object
Parameters:
object - The object to compare to.
Returns:
true if the objects have the same value, otherwise false.


Copyright © 2013 NimbusDS. All Rights Reserved.