Class InMemoryLoginAttemptPolicy

java.lang.Object
com.svenruppert.jsentinel.bruteforce.InMemoryLoginAttemptPolicy
All Implemented Interfaces:
LoginAttemptPolicy

public final class InMemoryLoginAttemptPolicy extends Object implements LoginAttemptPolicy
In-memory LoginAttemptPolicy suitable for single-node demos and small deployments.

Counts failures per (username, clientAddress) pair plus an additional username-only counter so an attacker cannot cycle clients to evade the combined counter. Username and clientAddress are normalised (lower-cased + trimmed) before use as map keys.

After LoginAttemptConfiguration.failureThreshold() failures inside LoginAttemptConfiguration.window() the key is locked for LoginAttemptConfiguration.initialLockout(). Repeated breaches double the lockout up to LoginAttemptConfiguration.maxLockout() (progressive backoff). A successful recordSuccess resets the combined counter; the username-only counter is reset on the next successful login by the same user even from a different client.

Audit

The policy emits audit events through the resolved JSentinelAuditService:

Audit-sink failures are swallowed — they must never break the security flow that emitted them.