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,ClientAuthenticationMethod,ClientID,CodeChallenge,CodeChallengeMethod,CountryCode,DeviceCode,Gender,GrantType,HashClaim,IDDocumentType,IdentityEvidenceType,IdentityTrustFramework,IdentityVerificationMethod,Issuer,JWTID,Nonce,ResponseMode,ResponseType.Value,Scope.Value,SectorID,SessionID,SoftwareID,SoftwareVersion,State,Subject,Token,TXN,UserCode
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 intDEFAULT_BYTE_LENGTHThe default byte length of generated identifiers.protected static SecureRandomsecureRandomThe 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 intcompareTo(Identifier other)booleanequals(Object o)StringgetValue()Returns the value of this identifier.inthashCode()StringtoJSONString()Returns the JSON string representation of this identifier.StringtoString()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 benullor 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,nullif 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:
toJSONStringin interfacenet.minidev.json.JSONAware- Returns:
- The JSON string.
-
toString
public String toString()
- Overrides:
toStringin classObject- See Also:
getValue()
-
compareTo
public int compareTo(Identifier other)
- Specified by:
compareToin interfaceComparable<Identifier>
-
-