mirror of https://gitee.com/maxjhandsome/pig
1. 增加验证码开关(fixed:接口模式校验问题)
This commit is contained in:
parent
fddf866b41
commit
2f58b29cfb
|
@ -25,17 +25,22 @@ import java.io.PrintWriter;
|
||||||
/**
|
/**
|
||||||
* @author lengleng
|
* @author lengleng
|
||||||
* @date 2017-12-18
|
* @date 2017-12-18
|
||||||
* 验证码校验
|
* 验证码校验,true开启,false关闭校验
|
||||||
|
* 更细化可以 clientId 进行区分
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Component("validateCodeFilter")
|
@Component("validateCodeFilter")
|
||||||
public class ValidateCodeFilter extends OncePerRequestFilter {
|
public class ValidateCodeFilter extends OncePerRequestFilter {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ValidateCodeFilter.class);
|
private static final Logger logger = LoggerFactory.getLogger(ValidateCodeFilter.class);
|
||||||
|
@Value("${security.validate.code:true}")
|
||||||
|
private boolean isValidate;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisTemplate redisTemplate;
|
private RedisTemplate redisTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||||
if (StringUtils.contains(request.getRequestURI(), SecurityConstants.OAUTH_TOKEN_URL) || StringUtils.contains(request.getRequestURI(), SecurityConstants.REFRESH_TOKEN)) {
|
if (isValidate && (StringUtils.contains(request.getRequestURI(), SecurityConstants.OAUTH_TOKEN_URL)
|
||||||
|
|| StringUtils.contains(request.getRequestURI(), SecurityConstants.REFRESH_TOKEN))) {
|
||||||
PrintWriter printWriter = null;
|
PrintWriter printWriter = null;
|
||||||
try {
|
try {
|
||||||
checkCode(request, response, filterChain);
|
checkCode(request, response, filterChain);
|
||||||
|
|
Loading…
Reference in New Issue