Package com.bytedesk.core.rbac.auth
Class AuthLoginRetryHelper
java.lang.Object
com.bytedesk.core.rbac.auth.AuthLoginRetryHelper
登录重试辅助工具类
封装登录失败处理、重试次数统计、用户锁定等逻辑
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BytedeskPropertiesprivate final RedisLoginRetryService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<?>checkMaxRetryReached(String username, AuthLoginRetryHelper.LoginRetryConfig config) 检查是否已达到最大重试次数org.springframework.http.ResponseEntity<?>checkUserLocked(String username) 检查用户是否被锁定获取登录重试配置org.springframework.http.ResponseEntity<?>handleLoginFailure(String username, AuthLoginRetryHelper.LoginRetryConfig config, String errorMessage) 处理登录失败,增加失败次数并返回相应错误信息org.springframework.http.ResponseEntity<?>handleLoginFailure(String username, String errorMessage) 处理登录失败(简化版本,自动获取配置)org.springframework.http.ResponseEntity<?>performPreLoginChecks(String username) 执行登录前的所有检查voidresetLoginFailedCount(String username) 登录成功后重置失败次数
-
Field Details
-
redisLoginRetryService
-
bytedeskProperties
-
-
Constructor Details
-
AuthLoginRetryHelper
public AuthLoginRetryHelper()
-
-
Method Details
-
getLoginRetryConfig
获取登录重试配置 -
checkUserLocked
检查用户是否被锁定- Parameters:
username- 用户名- Returns:
- 如果用户被锁定,返回错误响应;否则返回null
-
checkMaxRetryReached
public org.springframework.http.ResponseEntity<?> checkMaxRetryReached(String username, AuthLoginRetryHelper.LoginRetryConfig config) 检查是否已达到最大重试次数- Parameters:
username- 用户名config- 重试配置- Returns:
- 如果已达到最大重试次数,返回错误响应;否则返回null
-
handleLoginFailure
public org.springframework.http.ResponseEntity<?> handleLoginFailure(String username, AuthLoginRetryHelper.LoginRetryConfig config, String errorMessage) 处理登录失败,增加失败次数并返回相应错误信息- Parameters:
username- 用户名config- 重试配置errorMessage- 自定义错误信息,可为null- Returns:
- 错误响应
-
handleLoginFailure
public org.springframework.http.ResponseEntity<?> handleLoginFailure(String username, String errorMessage) 处理登录失败(简化版本,自动获取配置)- Parameters:
username- 用户名errorMessage- 错误信息- Returns:
- 错误响应
-
resetLoginFailedCount
登录成功后重置失败次数- Parameters:
username- 用户名
-
performPreLoginChecks
执行登录前的所有检查- Parameters:
username- 用户名- Returns:
- 如果检查失败,返回错误响应;否则返回null
-