Package com.nimbusds.oauth2.sdk.id
Class Identifier
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.id.Identifier
-
- All Implemented Interfaces:
Serializable
,Comparable<Identifier>
,net.minidev.json.JSONAware
- Direct Known Subclasses:
AccessTokenType
,ACR
,AMR
,Audience
,AuthorizationCode
,AuthorizedParty
,AuthorizedParty
,AuthRequestID
,BackChannelTokenDeliveryMode
,ClientAuthenticationMethod
,ClientID
,ClientRegistrationType
,CodeChallenge
,CodeChallengeMethod
,CountryCode
,DeviceCode
,EndpointName
,EntityID
,FederationMetadataType
,Gender
,GrantType
,HashClaim
,IDDocumentType
,IdentityEvidenceType
,IdentityTrustFramework
,IdentityVerificationMethod
,Issuer
,JWTID
,Nonce
,OperationName
,OperationType
,ResponseMode
,ResponseType.Value
,Scope.Value
,SectorID
,SessionID
,SoftwareID
,SoftwareVersion
,State
,Subject
,Token
,TXN
,UserCode
,VerificationProcess
public class Identifier extends Object implements Serializable, Comparable<Identifier>, net.minidev.json.JSONAware
The base 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.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_BYTE_LENGTH
The default byte length of generated identifiers.protected static SecureRandom
secureRandom
The secure random generator.
-
Constructor Summary
Constructors Constructor Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Identifier other)
boolean
equals(Object o)
String
getValue()
Returns the value of this identifier.int
hashCode()
String
toJSONString()
Returns the JSON string representation of this identifier.String
toString()
static List<String>
toStringList(Collection<? extends Identifier> ids)
Returns a string list representation of the specified identifier collection.
-
-
-
Field Detail
-
DEFAULT_BYTE_LENGTH
public static final int DEFAULT_BYTE_LENGTH
The default byte length of generated identifiers.- See Also:
- Constant Field Values
-
secureRandom
protected static final SecureRandom secureRandom
The secure random generator.
-
-
Constructor Detail
-
Identifier
public Identifier(String value)
Creates a new identifier with the specified value.- Parameters:
value
- The identifier value. Must not benull
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
-
toStringList
public static List<String> toStringList(Collection<? extends Identifier> ids)
Returns a string list representation of the specified identifier collection.- Parameters:
ids
- The identifiers,null
if not specified.- Returns:
- The string list, empty list if not specified.
-
toJSONString
public String toJSONString()
Returns the JSON string representation of this identifier.- Specified by:
toJSONString
in interfacenet.minidev.json.JSONAware
- Returns:
- The JSON string.
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
getValue()
-
compareTo
public int compareTo(Identifier other)
- Specified by:
compareTo
in interfaceComparable<Identifier>
-
-