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 allow
UserLockoutService
to manage creation of login attempts.-
Method Summary
Modifier and TypeMethodDescriptionint
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.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.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 Details
-
countConsideredUserLoginAttempts
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
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
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
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
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.
-