Record Class SecondFactorLockout
java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.domain.mfa.SecondFactorLockout
- Record Components:
failedCount- consecutive failed attempts, never negative.lockedUntil- instant until which the second factor is locked, ornullwhen it is not locked.
The failed-attempt state of the second factor of one user.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe field for thefailedCountrecord component.private final InstantThe field for thelockedUntilrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionSecondFactorLockout(int failedCount, Instant lockedUntil) Validates the state. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intReturns the value of thefailedCountrecord component.final inthashCode()Returns a hash code value for this object.booleanTells whether the second factor is locked at an instant.Returns the value of thelockedUntilrecord component.static SecondFactorLockoutnone()Creates the state of a user with no failed attempts.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
failedCount
private final int failedCountThe field for thefailedCountrecord component. -
lockedUntil
The field for thelockedUntilrecord component.
-
-
Constructor Details
-
SecondFactorLockout
Validates the state.- Throws:
IllegalArgumentException- if the counter is negative.
-
-
Method Details
-
none
Creates the state of a user with no failed attempts.- Returns:
- the clean state.
-
isLocked
Tells whether the second factor is locked at an instant.- Parameters:
now- the instant to check.- Returns:
truewhen a lock exists and has not ended yet.
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
failedCount
public int failedCount()Returns the value of thefailedCountrecord component.- Returns:
- the value of the
failedCountrecord component
-
lockedUntil
Returns the value of thelockedUntilrecord component.- Returns:
- the value of the
lockedUntilrecord component
-