Class CaptchaAutoConfiguration

java.lang.Object
tech.riemann.nif.starter.web.CaptchaAutoConfiguration

@AutoConfiguration @ConditionalOnProperty(prefix="nif.captcha", name="enabled", havingValue="true", matchIfMissing=true) @EnableConfigurationProperties(CaptchaConfigurationProperties.class) public class CaptchaAutoConfiguration extends Object
验证码自动配置

将 CaptchaView 以 Bean 形式提供,配置项来自 CaptchaConfigurationProperties (nif.captcha.*)——使用方在 Controller 中直接注入 CaptchaView 返回即可, 不再需要手动 new CaptchaView(codeCache) 并逐个 set。

默认提供内存验证码缓存 MemoryCodeCache(TTL 5 分钟 + 原子消费防重放); 分布式场景可自行提供 CodeCache Bean(如 Redis 实现)替换。

Author:
Kerbores(kerbores@riemann.tech)
  • Constructor Details

    • CaptchaAutoConfiguration

      public CaptchaAutoConfiguration()