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, ornull.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 Summary
FieldsModifier and TypeFieldDescriptionprivate final InstantThe field for thecreatedAtrecord component.private 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 theuserAgentSummaryrecord component.private final UUIDThe field for theuserIdrecord component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecreatedAtrecord component.final 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.booleanTells whether the device is no longer trusted at an instant.final StringtoString()Returns a string representation of this record class.Returns the value of theuserAgentSummaryrecord component.userId()Returns the value of theuserIdrecord component.
-
Field Details
-
id
The field for theidrecord component. -
userId
The field for theuserIdrecord component. -
hashedToken
The field for thehashedTokenrecord component. -
userAgentSummary
The field for theuserAgentSummaryrecord component. -
expiresAt
The field for theexpiresAtrecord component. -
createdAt
The field for thecreatedAtrecord component.
-
-
Constructor Details
-
Method Details
-
isExpired
Tells whether the device is no longer trusted at an instant.- Parameters:
now- the instant to check.- Returns:
truewhen the expiry has been reached.
-
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
-
hashedToken
Returns the value of thehashedTokenrecord component.- Returns:
- the value of the
hashedTokenrecord component
-
userAgentSummary
Returns the value of theuserAgentSummaryrecord component.- Returns:
- the value of the
userAgentSummaryrecord component
-
expiresAt
Returns the value of theexpiresAtrecord component.- Returns:
- the value of the
expiresAtrecord component
-
createdAt
Returns the value of thecreatedAtrecord component.- Returns:
- the value of the
createdAtrecord component
-