Record Class AccountToken

java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.domain.account.AccountToken
Record Components:
id - unique identifier of the stored token.
userId - identifier of the account the token belongs to.
purpose - what the token allows, for example PURPOSE_PASSWORD_RESET.
hashedToken - hash of the token value.
expiresAt - instant after which the token cannot be consumed.
usedAt - instant at which the token was consumed; null while it is unused.

public record AccountToken(UUID id, UUID userId, String purpose, String hashedToken, Instant expiresAt, Instant usedAt) extends Record
A single-use token that proves the right to perform one account operation. Only the hash of the token is kept; the token itself exists in the e-mail sent to the user.
  • Field Details

    • id

      private final UUID id
      The field for the id record component.
    • userId

      private final UUID userId
      The field for the userId record component.
    • purpose

      private final String purpose
      The field for the purpose record component.
    • hashedToken

      private final String hashedToken
      The field for the hashedToken record component.
    • expiresAt

      private final Instant expiresAt
      The field for the expiresAt record component.
    • usedAt

      private final Instant usedAt
      The field for the usedAt record component.
    • PURPOSE_EMAIL_VERIFICATION

      public static final String PURPOSE_EMAIL_VERIFICATION
      Purpose of the signed token that proves ownership of an e-mail address.
      See Also:
    • PURPOSE_PASSWORD_RESET

      public static final String PURPOSE_PASSWORD_RESET
      Purpose of the single-use token that allows choosing a new password.
      See Also:
  • Constructor Details

  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public UUID id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • userId

      public UUID userId()
      Returns the value of the userId record component.
      Returns:
      the value of the userId record component
    • purpose

      public String purpose()
      Returns the value of the purpose record component.
      Returns:
      the value of the purpose record component
    • hashedToken

      public String hashedToken()
      Returns the value of the hashedToken record component.
      Returns:
      the value of the hashedToken record component
    • expiresAt

      public Instant expiresAt()
      Returns the value of the expiresAt record component.
      Returns:
      the value of the expiresAt record component
    • usedAt

      public Instant usedAt()
      Returns the value of the usedAt record component.
      Returns:
      the value of the usedAt record component