显示指定拦截器顺序,拦截器优化

This commit is contained in:
冷冷 2018-05-05 19:45:57 +08:00
parent 92b70b9683
commit 490a05e210
2 changed files with 3 additions and 1 deletions

View File

@ -3,7 +3,9 @@ package com.github.pig.auth.config;
import com.github.pig.auth.component.mobile.MobileSecurityConfigurer;
import com.github.pig.common.bean.config.FilterUrlsPropertiesConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@ -13,6 +15,7 @@ import org.springframework.security.config.annotation.web.configurers.Expression
* @author lengleng
* @date 2018/3/10
*/
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER - 1)
@Configuration
@EnableWebSecurity
public class PigSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {

View File

@ -44,7 +44,6 @@ public class ValidateCodeFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
if (isValidate && (StringUtils.contains(request.getRequestURI(), SecurityConstants.OAUTH_TOKEN_URL)
|| StringUtils.contains(request.getRequestURI(), SecurityConstants.REFRESH_TOKEN)
|| StringUtils.contains(request.getRequestURI(), SecurityConstants.MOBILE_TOKEN_URL))) {
PrintWriter printWriter = null;
try {