Class AuthLoginRetryHelper

java.lang.Object
com.bytedesk.core.rbac.auth.AuthLoginRetryHelper

@Component public class AuthLoginRetryHelper extends Object
登录重试辅助工具类 封装登录失败处理、重试次数统计、用户锁定等逻辑
  • Field Details

  • Constructor Details

    • AuthLoginRetryHelper

      public AuthLoginRetryHelper()
  • Method Details

    • getLoginRetryConfig

      public AuthLoginRetryHelper.LoginRetryConfig getLoginRetryConfig()
      获取登录重试配置
    • checkUserLocked

      public org.springframework.http.ResponseEntity<?> checkUserLocked(String username)
      检查用户是否被锁定
      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

      public void resetLoginFailedCount(String username)
      登录成功后重置失败次数
      Parameters:
      username - 用户名
    • performPreLoginChecks

      public org.springframework.http.ResponseEntity<?> performPreLoginChecks(String username)
      执行登录前的所有检查
      Parameters:
      username - 用户名
      Returns:
      如果检查失败,返回错误响应;否则返回null