public class DefaultUserLockoutService extends Object implements UserLockoutService
Constructor and Description |
---|
DefaultUserLockoutService(UserService<User> userService,
UserLoginAttemptService<UserLoginAttempt> userLoginAttemptService,
AuthorizedClientService<AuthorizedClient> clientService,
AuthorizationServerService<AuthorizationServer> serverService,
UserLockoutProperties userLockoutProperties) |
public DefaultUserLockoutService(UserService<User> userService, UserLoginAttemptService<UserLoginAttempt> userLoginAttemptService, AuthorizedClientService<AuthorizedClient> clientService, AuthorizationServerService<AuthorizationServer> serverService, UserLockoutProperties userLockoutProperties)
public void createLoginAttempt(User user, String loginAttemptResult)
UserLockoutService
createLoginAttempt
in interface UserLockoutService
user
- The user to create a login attempt forloginAttemptResult
- The login attempt result.public void createLoginAttempt(String username, String loginAttemptResult, String clientId)
UserLockoutService
createLoginAttempt
in interface UserLockoutService
username
- The username to create an attempt forloginAttemptResult
- The login attempt resultclientId
- The client IDpublic User unlockUser(User user)
UserLockoutService
unlockUser
in interface UserLockoutService
user
- The user to unlockpublic User lockUser(User user)
UserLockoutService
lockUser
in interface UserLockoutService
user
- The user to lockpublic Optional<User> unlockUserIfEligible(String username, String clientId)
UserLockoutService
unlockUserIfEligible
in interface UserLockoutService
username
- The usernameclientId
- The client IDpublic boolean canResetPassword(User user)
UserLockoutService
See AuthorizationServer.getLockedUserCanResetPassword()
and
UserLockoutProperties.isLockedUserCanResetPassword()
canResetPassword
in interface UserLockoutService
user
- The user to check@Nullable public Boolean unlockUserOnPasswordResetIfEligible(User user)
UserLockoutService
See AuthorizationServer.getResetPasswordUnlocksUser()
and
UserLockoutProperties.isResetPasswordUnlocksUser()
unlockUserOnPasswordResetIfEligible
in interface UserLockoutService
user
- The user to unlock, if eligibleprotected void createLoginAttempt(String username, @Nullable String userId, String loginAttemptResult, String authServerId)
protected boolean userShouldBeUnlocked(@Nullable User user, AuthorizationServer server)
protected int countLoginAttempts(String username, AuthorizationServer server)
@Nullable protected Duration getLockoutDuration(AuthorizationServer server)
protected AuthorizationServer readAuthServer(String authServerId)
@Nullable protected Long getLockoutDurationMinutes(AuthorizationServer server)
@Nullable protected Long getLoginFailDecayMinutes(AuthorizationServer server)
protected int getLoginAttemptsAllowed(AuthorizationServer server)
protected void throwIfLocked(int attempts, String username, AuthorizationServer server, @Nullable User user)
protected boolean isResetPasswordUnlocksUser(AuthorizationServer server)
protected boolean isLockedUserCanResetPassword(AuthorizationServer server)
protected UserService<User> getUserService()
protected UserLoginAttemptService<UserLoginAttempt> getUserLoginAttemptService()
protected AuthorizedClientService<AuthorizedClient> getClientService()
protected AuthorizationServerService<AuthorizationServer> getServerService()
protected UserLockoutProperties getUserLockoutProperties()
Copyright © 2021. All rights reserved.