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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The default byte length of generated identifiers.
    protected static final SecureRandom
    The secure random generator.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates 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.
    Creates a new identifier (ID) from the specified string.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    abstract boolean
    equals(Object object)
    Overrides Object.equals().
    int
    Overrides Object.hashCode().
    Returns the JSON string representation of this identifier (ID).
    Returns the string representation of this identifier (ID).

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • BaseIdentifier

      public BaseIdentifier()
      Creates a new unique identifier (ID) based on a secure randomly generated 256-bit number, Base64URL-encoded.
    • BaseIdentifier

      public BaseIdentifier(int byteLength)
      Creates a new unique identifier (ID) based on a secure randomly generated number with the specified byte length, Base64URL-encoded.
    • BaseIdentifier

      public BaseIdentifier(String value)
      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 be null.
  • Method Details

    • compareTo

      public int compareTo(Identifier other)
      Specified by:
      compareTo in interface Comparable<Identifier>
    • 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.
    • toString

      public String toString()
      Returns the string representation of this identifier (ID).
      Overrides:
      toString in class Object
      Returns:
      The string representation.
    • toJSONString

      public String toJSONString()
      Returns the JSON string representation of this identifier (ID).
      Specified by:
      toJSONString in interface net.minidev.json.JSONAware
      Returns:
      The JSON string representation.