Record Class LoginAttemptKey
java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.bruteforce.LoginAttemptKey
- Record Components:
tenant- tenant scope;nullbecomesTenantId.DEFAULTuserId- username dimension; non-blankip- client-address dimension; non-blank
@ExperimentalJSentinelApi
public record LoginAttemptKey(TenantId tenant, String userId, String ip)
extends Record
Composite key under which
LoginAttemptStore tracks
failed-attempt counters and the last failure instant.
Both dimensions are recorded independently: userId catches
an attacker hopping IPs against the same account, ip
catches one cycling usernames from the same source. Brute-force
policies typically consult both keys per attempt and back off as
soon as either counter trips.
-
Constructor Summary
ConstructorsConstructorDescriptionLoginAttemptKey(TenantId tenant, String userId, String ip) Validates the record components and normalises anulltenant toTenantId.DEFAULT. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.ip()Returns the value of theiprecord component.tenant()Returns the value of thetenantrecord component.final StringtoString()Returns a string representation of this record class.userId()Returns the value of theuserIdrecord component.
-
Constructor Details
-
LoginAttemptKey
Validates the record components and normalises anulltenant toTenantId.DEFAULT.- Parameters:
tenant- tenant scope;nullbecomes DEFAULTuserId- non-blank usernameip- non-blank client address
-
-
Method Details
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
tenant
-
userId
-
ip
-