Record Class AttemptRecord
java.lang.Object
java.lang.Record
io.leandev.appfuse.security.lockout.AttemptRecord
- Record Components:
failureCount- 連續失敗次數lockedUntil- 鎖定到期時間;null = 未達閾值、未鎖定
- All Implemented Interfaces:
Serializable
public record AttemptRecord(int failureCount, LocalDateTime lockedUntil)
extends Record
implements Serializable
單一帳號的登入失敗記錄(不可變,供
LoginLockout 存入快取)- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAttemptRecord(int failureCount, LocalDateTime lockedUntil) Creates an instance of aAttemptRecordrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intReturns the value of thefailureCountrecord component.final inthashCode()Returns a hash code value for this object.booleanisLocked(LocalDateTime now) 是否於now當下處於鎖定中Returns the value of thelockedUntilrecord component.long剩餘鎖定分鐘數(向上取整,避免顯示「0 分鐘」);未鎖定回 0final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
AttemptRecord
Creates an instance of aAttemptRecordrecord class.- Parameters:
failureCount- the value for thefailureCountrecord componentlockedUntil- the value for thelockedUntilrecord component
-
-
Method Details
-
isLocked
是否於now當下處於鎖定中 -
remainingMinutes
剩餘鎖定分鐘數(向上取整,避免顯示「0 分鐘」);未鎖定回 0 -
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
failureCount
public int failureCount()Returns the value of thefailureCountrecord component.- Returns:
- the value of the
failureCountrecord component
-
lockedUntil
Returns the value of thelockedUntilrecord component.- Returns:
- the value of the
lockedUntilrecord component
-