Interface UserLoginAttemptService<P extends UserLoginAttempt>
-
- All Known Implementing Classes:
DefaultUserLoginAttemptService
public interface UserLoginAttemptService<P extends UserLoginAttempt>
Service for managing user login attempts. This service should be used when performing CRUD operations using login attempts. Generally, login attempts should not be created directly, but instead allowUserLockoutService
to manage creation of login attempts.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
countConsideredUserLoginAttempts(String username, String authServerId)
Read the number of failed login attemptsint
countConsideredUserLoginAttempts(String username, String authServerId, Duration age)
Count number of user login attempts for a specific period of time (e.g.P
createUserLoginAttempt(String username, String userId, String loginAttemptResult, String authServerId)
Create a new user login attempt.void
purgeLoginAttempts(Duration loginAttemptAge, String authServerId)
Purges any login attempts older than the specified duration.List<P>
readConsideredUserLoginAttempts(String username, String authServerId, Duration age)
Read user login attempts for a specific period of time (e.g.void
resetLoginAttempts(String username, String authServerId)
Reset user login attempts for a specific username and auth server ID.
-
-
-
Method Detail
-
countConsideredUserLoginAttempts
int countConsideredUserLoginAttempts(String username, String authServerId, Duration age)
Count number of user login attempts for a specific period of time (e.g. for the last 24 hours)- Parameters:
username
- The username used in the login attemptauthServerId
- The auth server idage
- The period of time- Returns:
- The number of failed login attempts
-
countConsideredUserLoginAttempts
int countConsideredUserLoginAttempts(String username, String authServerId)
Read the number of failed login attempts- Parameters:
username
- The username to read forauthServerId
- The auth server ID- Returns:
- The number of failed login attempts
-
readConsideredUserLoginAttempts
List<P> readConsideredUserLoginAttempts(String username, String authServerId, Duration age)
Read user login attempts for a specific period of time (e.g. for the last 24 hours)- Parameters:
username
- The username used in the login attemptauthServerId
- The auth server idage
- The period of time- Returns:
- The number of failed login attempts
-
createUserLoginAttempt
P createUserLoginAttempt(String username, @Nullable String userId, String loginAttemptResult, String authServerId)
Create a new user login attempt.- Parameters:
username
- The usernameuserId
- The user ID. OptionalloginAttemptResult
- The login result. SeeLoginAttemptResult
authServerId
- The auth server id- Returns:
- The newly create user login attempt
-
resetLoginAttempts
void resetLoginAttempts(String username, String authServerId)
Reset user login attempts for a specific username and auth server ID. This should generally be called on a successful login attempt- Parameters:
username
- The username to reset login attempts forauthServerId
- The auth server ID
-
purgeLoginAttempts
void purgeLoginAttempts(Duration loginAttemptAge, @Nullable String authServerId)
Purges any login attempts older than the specified duration.- Parameters:
loginAttemptAge
- The age of login attempts to purge. Any attempts greater than or equal to this age will be deleted.authServerId
- The auth server ID of login attempts to purge. Optional.
-
-