新增APP路由过滤,新增不需要token验证的方式
This commit is contained in:
parent
7dc7598d08
commit
bedc825ede
@ -22,7 +22,7 @@ public class FilterConfig {
|
||||
public FilterRegistrationBean appFilterRegister() {
|
||||
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
|
||||
filterRegistrationBean.setFilter(new AppFilter());
|
||||
filterRegistrationBean.addUrlPatterns("/app/*");
|
||||
filterRegistrationBean.addUrlPatterns("/app/*", "/approute/*");
|
||||
filterRegistrationBean.setName("appFilter");
|
||||
filterRegistrationBean.setOrder(1);
|
||||
return filterRegistrationBean;
|
||||
|
@ -33,8 +33,22 @@ public class AppFilter implements Filter {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AppFilter.class);
|
||||
private AntPathMatcher antPathMatcher;
|
||||
/**
|
||||
* APP登录
|
||||
*/
|
||||
private static final String URL_LOGIN = "/**/app/sign/login";
|
||||
/**
|
||||
* APP下载
|
||||
*/
|
||||
private static final String URL_DOWNLOAD_APP = "/**/app/appversion/downloadapp/**";
|
||||
/**
|
||||
* APP放行
|
||||
*/
|
||||
private static final String URL_RELEASE_APP = "/**/app/**/**release/**";
|
||||
/**
|
||||
* APP路由放行
|
||||
*/
|
||||
private static final String URL_RELEASE_APP_ROUTE = "/**/approute/**/**release/**";
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
@ -46,7 +60,11 @@ public class AppFilter implements Filter {
|
||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
String requestUri = request.getRequestURI();
|
||||
if (antPathMatcher.match(URL_LOGIN, requestUri) || antPathMatcher.match(URL_DOWNLOAD_APP, requestUri)) {
|
||||
boolean matcher = antPathMatcher.match(URL_LOGIN, requestUri)
|
||||
|| antPathMatcher.match(URL_DOWNLOAD_APP, requestUri)
|
||||
|| antPathMatcher.match(URL_RELEASE_APP, requestUri)
|
||||
|| antPathMatcher.match(URL_RELEASE_APP_ROUTE, requestUri);
|
||||
if (matcher) {
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user