Class InMemoryAbuseDetectionService
java.lang.Object
com.svenruppert.jsentinel.credential.abuse.InMemoryAbuseDetectionService
- All Implemented Interfaces:
AbuseDetectionService
In-memory reference implementation of
AbuseDetectionService.
Each (AbuseAttemptType, AbuseDimension, dimensionKey)
tuple has its own sliding-window deque of failure timestamps.
AbuseDimension.USERNAME counters track failures only;
AbuseDimension.CLIENT_ADDRESS,
AbuseDimension.TENANT and AbuseDimension.GLOBAL
track every attempt regardless of outcome (the volume axes).
Auditing is best-effort: every block / step-up / delay decision
publishes a RateLimitExceeded event with the dimension
encoded in the scope field. Sink failures are swallowed
(CWE-778).
-
Constructor Summary
ConstructorsConstructorDescriptionInMemoryAbuseDetectionService(AbuseLimitsPolicy policy, JSentinelAuditService auditService) -
Method Summary
Modifier and TypeMethodDescriptionevaluate(AbuseAttemptContext context) Decides what reaction the caller should apply before running the credential operation.voidrecordOutcome(AbuseAttemptContext context, AttemptOutcome outcome) Records the outcome of the operation so the counters can update.
-
Constructor Details
-
InMemoryAbuseDetectionService
-
-
Method Details
-
evaluate
Description copied from interface:AbuseDetectionServiceDecides what reaction the caller should apply before running the credential operation.- Specified by:
evaluatein interfaceAbuseDetectionService
-
recordOutcome
Description copied from interface:AbuseDetectionServiceRecords the outcome of the operation so the counters can update. Successful logins typically reset the per-username failure counter; volume counters (CLIENT_ADDRESS / TENANT / GLOBAL) usually keep tracking irrespective of outcome.- Specified by:
recordOutcomein interfaceAbuseDetectionService
-