Interface AttemptsManager
- All Known Implementing Classes:
AttemptsManagerDefault
public interface AttemptsManager
Attempts manager.
-
Method Summary
Modifier and TypeMethodDescriptionattempt(String attemptName, AttemptCriteria... criterias) Gets the currentAttempt, given the action to protect and criterias.attempt(String attemptName, AttemptsAutoIncrementType attemptsAutoIncrementType, AttemptCriteria... criterias) Gets the currentAttempt, given the action to protect and criterias.Gets all the registeredAttemptRulerules, by action names.voidregisterAttempRule(String actionName, int nbrMaxAttemptsPerDuration, Duration duration) Creates and registers aAttemptRulerule from the required informations.voidregisterAttempRule(AttemptRule attemptRule) Registers aAttemptRulerule.
-
Method Details
-
attempt
Gets the currentAttempt, given the action to protect and criterias. With this object you can:-
Know if the action should be allowed or blocked,
by calling
Attempt.isMaxReached(). -
Manually increment the number of attempts using
Attempt.incrementAttemptsCount(), if you didn't let the {attempt(String, AttemptCriteria...)} method do it automatically (seeSpincastAttemptsLimiterPluginConfig.getDefaultAttemptAutoIncrementType()).
-
Know if the action should be allowed or blocked,
by calling
-
attempt
Attempt attempt(String attemptName, AttemptsAutoIncrementType attemptsAutoIncrementType, AttemptCriteria... criterias) Gets the currentAttempt, given the action to protect and criterias. With this object you can:-
Know if the action should be allowed or blocked,
by calling
Attempt.isMaxReached(). -
Manually increment the number of attempts using
Attempt.incrementAttemptsCount(), if you didn't let the {{@link #attempt(String, AttemptAutoIncrementType, AttemptCriteria...))}} method do it automatically.
- Parameters:
attemptsAutoIncrementType- Specifies if the method should increment the number of attempts by itself. If you don't let it do it, you need to increment the number of attempts by yourself, by callingAttempt.incrementAttemptsCount()on the returned object.
-
Know if the action should be allowed or blocked,
by calling
-
registerAttempRule
Registers aAttemptRulerule. -
registerAttempRule
Creates and registers aAttemptRulerule from the required informations. -
getAttemptRulesByActionName
Map<String,AttemptRule> getAttemptRulesByActionName()Gets all the registeredAttemptRulerules, by action names.
-