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 examplePURPOSE_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;nullwhile 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 Summary
FieldsModifier and TypeFieldDescriptionprivate final InstantThe field for theexpiresAtrecord component.private final StringThe field for thehashedTokenrecord component.private final UUIDThe field for theidrecord component.private final StringThe field for thepurposerecord component.static final StringPurpose of the signed token that proves ownership of an e-mail address.static final StringPurpose of the single-use token that allows choosing a new password.private final InstantThe field for theusedAtrecord component.private final UUIDThe field for theuserIdrecord component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpiresAtrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thehashedTokenrecord component.id()Returns the value of theidrecord component.purpose()Returns the value of thepurposerecord component.final StringtoString()Returns a string representation of this record class.usedAt()Returns the value of theusedAtrecord component.userId()Returns the value of theuserIdrecord component.
-
Field Details
-
id
The field for theidrecord component. -
userId
The field for theuserIdrecord component. -
purpose
The field for thepurposerecord component. -
hashedToken
The field for thehashedTokenrecord component. -
expiresAt
The field for theexpiresAtrecord component. -
usedAt
The field for theusedAtrecord component. -
PURPOSE_EMAIL_VERIFICATION
Purpose of the signed token that proves ownership of an e-mail address.- See Also:
-
PURPOSE_PASSWORD_RESET
Purpose of the single-use token that allows choosing a new password.- See Also:
-
-
Constructor Details
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
userId
Returns the value of theuserIdrecord component.- Returns:
- the value of the
userIdrecord component
-
purpose
Returns the value of thepurposerecord component.- Returns:
- the value of the
purposerecord component
-
hashedToken
Returns the value of thehashedTokenrecord component.- Returns:
- the value of the
hashedTokenrecord component
-
expiresAt
Returns the value of theexpiresAtrecord component.- Returns:
- the value of the
expiresAtrecord component
-
usedAt
Returns the value of theusedAtrecord component.- Returns:
- the value of the
usedAtrecord component
-