public.javadoc.org.spincast.plugins.attemptslimiter.AttemptsManager.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.
AttemptsManager (org.spincast:spincast-framework 1.14.0 API)
org.spincast.plugins.attemptslimiter
Interface AttemptsManager
-
- All Known Implementing Classes:
- AttemptsManagerDefault
public interface AttemptsManager
Attempts manager.
-
-
Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type
Method and Description
Attempt
attempt(String attemptName,
AttemptCriteria... criterias)
Gets the current Attempt
, given the action to protect
and criterias.
Attempt
attempt(String attemptName,
AttemptsAutoIncrementType attemptsAutoIncrementType,
AttemptCriteria... criterias)
Gets the current Attempt
, given the action to protect
and criterias.
Map<String,AttemptRule>
getAttemptRulesByActionName()
Gets all the registered AttemptRule
rules,
by action names.
void
registerAttempRule(AttemptRule attemptRule)
Registers a AttemptRule
rule.
void
registerAttempRule(String actionName,
int nbrMaxAttemptsPerDuration,
Duration duration)
Creates and registers a AttemptRule
rule from the required informations.
-
-
Method Detail
-
attempt
Attempt attempt(String attemptName,
AttemptCriteria... criterias)
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 {attempt(String, AttemptCriteria...)
} method do
it automatically
(see SpincastAttemptsLimiterPluginConfig.getDefaultAttemptAutoIncrementType()
).
-
attempt
Attempt attempt(String attemptName,
AttemptsAutoIncrementType attemptsAutoIncrementType,
AttemptCriteria... criterias)
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 {#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 calling Attempt.incrementAttemptsCount()
on the returned object.
-
registerAttempRule
void registerAttempRule(AttemptRule attemptRule)
Registers a AttemptRule
rule.
-
registerAttempRule
void registerAttempRule(String actionName,
int nbrMaxAttemptsPerDuration,
Duration duration)
Creates and registers a AttemptRule
rule from the required informations.
-
getAttemptRulesByActionName
Map<String,AttemptRule> getAttemptRulesByActionName()
Gets all the registered AttemptRule
rules,
by action names.
Copyright © 2019. All rights reserved.