Class CaptchaPolicy

java.lang.Object
com.sankcrm.erp.domain.model.IdentifiedValueObject
com.sankcrm.erp.auth.domain.model.app.CaptchaPolicy
All Implemented Interfaces:
Serializable

public class CaptchaPolicy extends com.sankcrm.erp.domain.model.IdentifiedValueObject
应用登录图形验证码策略。

阈值按应用、认证方式和原始登录名累计;阈值为 0 时每次登录均须验证,阈值为 N 时第 N+1 次登录起须验证。

Redis 不可用时,启用策略的验证与计数必须失败关闭。

See Also:
  • Constructor Details

    • CaptchaPolicy

      public CaptchaPolicy()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Returns:
      策略是否启用;空值按未启用处理。
    • effectiveFailureThreshold

      public int effectiveFailureThreshold()
      Returns:
      生效失败阈值;0 表示每次都要求验证码,N 表示第 N+1 次起要求。
    • effectiveDifficultyLevel

      public int effectiveDifficultyLevel()
      返回当前策略生效的验证码难度档位。

      档位定义参见 difficultyLevel;旧策略没有该字段时使用第 3 档。

      Returns:
      1 至 6 的验证码难度档位
    • effectiveFailureWindow

      public Duration effectiveFailureWindow()
      Returns:
      生效的失败计数 Duration;窗口结束后旧失败计数不再参与阈值判断。
    • effectiveChallengeExpire

      public Duration effectiveChallengeExpire()
      Returns:
      生效的挑战 TTL Duration。
    • supportsAuthType

      public boolean supportsAuthType(String authType)
      判断策略是否覆盖指定认证方式。
      Parameters:
      authType - 认证方式标识
      Returns:
      是否覆盖该认证方式