Class LoginAttemptHelper


  • public class LoginAttemptHelper
    extends Object
    Helper for storing / removing user login attempts and checking the user login state.
    Since:
    8.0.0
    Author:
    XIMA Media GmbH
    • Method Detail

      • checkLoginAttempts

        public static ELoginState checkLoginAttempts​(String loginId)
      • getLoginAttemptCount

        public static long getLoginAttemptCount​(String loginId)
      • removeLoginAttempts

        public static void removeLoginAttempts​(UserProfile profile)
      • removeLoginAttempts

        public static LoginAttempt removeLoginAttempts​(String loginId)
      • addFailedLoginAttempt

        public static LoginAttempt addFailedLoginAttempt​(String loginId)
      • setFailedLoginAttempts

        public static LoginAttempt setFailedLoginAttempts​(String loginId,
                                                          long count)
      • getLockDuration

        public static long getLockDuration()
      • getLockCount

        public static int getLockCount()
      • getMaxLockCount

        public static int getMaxLockCount()
      • attemptLogin

        public static <PROFILE> PROFILE attemptLogin​(String username,
                                                     String password,
                                                     ILoginMethod<PROFILE> loginMethod)
                                              throws org.pac4j.core.exception.TechnicalException
        Attempts to login with the given username and password. The login attempts are checked and incremented or cleared accordingly.
        Type Parameters:
        PROFILE - Type of the user profile returned when the user was logged in..
        Parameters:
        username - Username for the login.
        password - Password for the login.
        loginMethod - Login implementation.
        Returns:
        The user profile if the login succeeded.
        Throws:
        org.pac4j.core.exception.TechnicalException - When the login failed, such as when the user is unauthorized.