| | |
| | | @Component
|
| | | public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object>
|
| | | {
|
| | | private final static String AUTH_URL = "/auth/login";
|
| | | private final static String[] VALIDATE_URL = new String[] { "/auth/login", "/auth/register" };
|
| | |
|
| | | @Autowired
|
| | | private ValidateCodeService validateCodeService;
|
| | |
| | | return (exchange, chain) -> {
|
| | | ServerHttpRequest request = exchange.getRequest();
|
| | |
|
| | | // 非登录请求或验证码关闭,不处理
|
| | | if (!StringUtils.containsIgnoreCase(request.getURI().getPath(), AUTH_URL) || !captchaProperties.getEnabled())
|
| | | // 非登录/注册请求或验证码关闭,不处理
|
| | | if (!StringUtils.containsAnyIgnoreCase(request.getURI().getPath(), VALIDATE_URL) || !captchaProperties.getEnabled())
|
| | | {
|
| | | return chain.filter(exchange);
|
| | | }
|