Package com.jalios.jcms.authentication
Class AuthenticationThrottleManager
java.lang.Object
com.jalios.jcms.security.Throttler
com.jalios.jcms.authentication.AuthenticationThrottleManager
This singleton manages authentication throttling.
- Since:
- jcms-10.0.7 / JCMS-8083
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jalios.jcms.security.Throttler
Throttler.Action -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringEnable throttling or not ?static final StringTime range in seconds during which the threshold is verified.static final StringNumber of failed login attempts permitted in specified time range.static final StringNumber of seconds before the blocked/throttled can be released.Fields inherited from class com.jalios.jcms.security.Throttler
ENABLED_PROP_SUFFIX, RANGE_PROP_SUFFIX, THRESHOLD_PROP_SUFFIX, THROTTLING_DURATION_PROP_SUFFIX -
Method Summary
Modifier and TypeMethodDescriptionstatic final AuthenticationThrottleManagervoidrecordAuthenticationFailure(String userId, AuthenticationContext ctxt, Class<? extends AuthenticationHandler> authHdlrClass) Record a failed authentication attempt.booleanthrottleIfNeeded(String userId, AuthenticationContext ctxt, Class<? extends AuthenticationHandler> authHdlrClass) Throttle an authentication attempt given specified context.Methods inherited from class com.jalios.jcms.security.Throttler
getRange, getRemoteIp, getThreshold, getThrottleDuration, init, init, isThrottleEnabled, recordAction, recordAction, throttleIfNeeded
-
Field Details
-
ENABLED_PROP
Enable throttling or not ?- See Also:
-
RANGE_PROP
Time range in seconds during which the threshold is verified.- See Also:
-
THRESHOLD_PROP
Number of failed login attempts permitted in specified time range.- See Also:
-
THROTTLING_DURATION_PROP
Number of seconds before the blocked/throttled can be released.- See Also:
-
-
Method Details
-
getInstance
-
recordAuthenticationFailure
public void recordAuthenticationFailure(String userId, AuthenticationContext ctxt, Class<? extends AuthenticationHandler> authHdlrClass) Record a failed authentication attempt.Records of failed authentication must be performed to ensure throttling of brute force authentication atttempt for same context (user/ip).
- Parameters:
userId- a unique and constant identifier used to track the User/Member for which authentication failedctxt- the AuthenticationContext associated to the authentication attemptauthHdlrClass- the class of AuthenticationHandler trying to handle the authentication attempt- Since:
- jcms-10.0.7 / JCMS-8083
-
throttleIfNeeded
public boolean throttleIfNeeded(String userId, AuthenticationContext ctxt, Class<? extends AuthenticationHandler> authHdlrClass) Throttle an authentication attempt given specified context.- Parameters:
userId- a unique and constant identifier used to track the User/Member for which authentication is being attemptedctxt- the AuthenticationContext associated to the authentication attemptauthHdlrClass- the class of AuthenticationHandler trying to handle the authentication attempt- Returns:
- true if thottling occurred, false otherwise
- Since:
- jcms-10.0.7 / JCMS-8083
-