Package com.nimbusds.common.id
Class BaseIdentifier
java.lang.Object
com.nimbusds.common.id.BaseIdentifier
- All Implemented Interfaces:
Identifier
,Comparable<Identifier>
,net.minidev.json.JSONAware
- Direct Known Subclasses:
AuthzId
,CID
,DNIdentity
,IdentifierWithHMAC
,SID
,UID
,Username
public abstract class BaseIdentifier
extends Object
implements Identifier, Comparable<Identifier>, net.minidev.json.JSONAware
The base class for identifiers (IDs) used in Connect2id software.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default byte length of generated identifiers.protected static final SecureRandom
The secure random generator. -
Constructor Summary
ConstructorDescriptionCreates a new unique identifier (ID) based on a secure randomly generated 256-bit number, Base64URL-encoded.BaseIdentifier
(int byteLength) Creates a new unique identifier (ID) based on a secure randomly generated number with the specified byte length, Base64URL-encoded.BaseIdentifier
(String value) Creates a new identifier (ID) from the specified string. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(Identifier other) abstract boolean
OverridesObject.equals()
.int
hashCode()
OverridesObject.hashCode()
.Returns the JSON string representation of this identifier (ID).toString()
Returns the string representation of this identifier (ID).
-
Field Details
-
SECURE_RANDOM
The secure random generator. -
DEFAULT_BYTE_LENGTH
The default byte length of generated identifiers.- See Also:
-
-
Constructor Details
-
BaseIdentifier
public BaseIdentifier()Creates a new unique identifier (ID) based on a secure randomly generated 256-bit number, Base64URL-encoded. -
BaseIdentifier
Creates a new unique identifier (ID) based on a secure randomly generated number with the specified byte length, Base64URL-encoded. -
BaseIdentifier
Creates a new identifier (ID) from the specified string. The value is not validated (for legality or uniqueness) in any way.- Parameters:
value
- The identifier (ID) value. Must not benull
.
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Identifier>
-
hashCode
OverridesObject.hashCode()
. -
equals
OverridesObject.equals()
. -
toString
Returns the string representation of this identifier (ID). -
toJSONString
Returns the JSON string representation of this identifier (ID).- Specified by:
toJSONString
in interfacenet.minidev.json.JSONAware
- Returns:
- The JSON string representation.
-