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 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 attempt
        authServerId - The auth server id
        age - 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 for
        authServerId - 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 attempt
        authServerId - The auth server id
        age - 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 username
        userId - The user ID. Optional
        loginAttemptResult - The login result. See LoginAttemptResult
        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 for
        authServerId - 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.