public.javadoc.org.spincast.plugins.attemptslimiter.AttemptsManagerDefault.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
AttemptsManagerDefault (org.spincast:spincast-framework 2.1.1 API)
Class AttemptsManagerDefault
java.lang.Object
org.spincast.plugins.attemptslimiter.AttemptsManagerDefault
- All Implemented Interfaces:
AttemptsManager
-
Field Summary
-
Constructor Summary
Constructor
Description
AttemptsManagerDefault(SpincastAttemptsLimiterPluginRepository SpincastAttemptsLimiterPluginRepository,
AttemptFactory attemptFactory,
SpincastAttemptsLimiterPluginConfig spincastAttemptsLimiterPluginConfig)
-
Method Summary
Modifier and Type
Method
Description
attempt(String actionName,
AttemptCriteria... criterias)
Gets the current Attempt
, given the action to protect
and criterias.
attempt(String actionName,
AttemptsAutoIncrementType attemptsAutoIncrementType,
AttemptCriteria... criterias)
Gets the current Attempt
, given the action to protect
and criterias.
protected AttemptFactory
protected AttemptRule
getAttemptRule(String actionName)
Gets all the registered AttemptRule
rules,
by action names.
protected SpincastAttemptsLimiterPluginConfig
protected SpincastAttemptsLimiterPluginRepository
void
registerAttempRule(String actionName,
int nbrMaxAttemptsPerDuration,
Duration duration)
Creates and registers a AttemptRule
rule from the required informations.
void
registerAttempRule(AttemptRule attemptRule)
Registers a AttemptRule
rule.
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
Constructor Details
-
AttemptsManagerDefault
@Inject
public AttemptsManagerDefault(SpincastAttemptsLimiterPluginRepository SpincastAttemptsLimiterPluginRepository,
AttemptFactory attemptFactory,
SpincastAttemptsLimiterPluginConfig spincastAttemptsLimiterPluginConfig)
-
Method Details
-
getSpincastAttemptsLimiterPluginRepository
-
getAttemptRulesByActionName
Description copied from interface: AttemptsManager
Gets all the registered AttemptRule
rules,
by action names.
- Specified by:
getAttemptRulesByActionName
in interface AttemptsManager
-
getAttemptRule
-
getAttemptFactory
-
getSpincastAttemptsLimiterPluginConfig
-
attempt
Description copied from interface: AttemptsManager
Gets the current Attempt
, 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 {AttemptsManager.attempt(String, AttemptCriteria...)
} method do
it automatically
(see SpincastAttemptsLimiterPluginConfig.getDefaultAttemptAutoIncrementType()
).
- Specified by:
attempt
in interface AttemptsManager
-
attempt
public Attempt attempt(String actionName,
AttemptsAutoIncrementType attemptsAutoIncrementType,
AttemptCriteria... criterias)
Description copied from interface: AttemptsManager
Gets the current Attempt
, 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.
- Specified by:
attempt
in interface AttemptsManager
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 calling Attempt.incrementAttemptsCount()
on the returned object.
-
registerAttempRule
Description copied from interface: AttemptsManager
Registers a AttemptRule
rule.
- Specified by:
registerAttempRule
in interface AttemptsManager
-
registerAttempRule
Description copied from interface: AttemptsManager
Creates and registers a AttemptRule
rule from the required informations.
- Specified by:
registerAttempRule
in interface AttemptsManager