Record Class TrustedDevice

java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.domain.mfa.TrustedDevice
Record Components:
id - unique identifier of the device.
userId - identifier of the user who trusts it.
hashedToken - hash of the device token.
userAgentSummary - short description of the browser, or null.
expiresAt - instant after which the device is no longer trusted.
createdAt - instant at which the device was trusted.

public record TrustedDevice(UUID id, UUID userId, String hashedToken, String userAgentSummary, Instant expiresAt, Instant createdAt) extends Record
A browser that a user chose to trust, which lets it skip the second factor (never the first) until it expires. Only the hash of the device token is kept; the token itself lives in the browser's cookie.
  • 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.
    • hashedToken

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

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

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

      private final Instant createdAt
      The field for the createdAt record component.
  • Constructor Details

  • Method Details

    • isExpired

      public boolean isExpired(Instant now)
      Tells whether the device is no longer trusted at an instant.
      Parameters:
      now - the instant to check.
      Returns:
      true when the expiry has been reached.
    • 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
    • hashedToken

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

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

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

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