From bedc825ede1d8ebf9a1407d49d0dbaccbb48efa2 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Mon, 10 Feb 2020 00:15:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EAPP=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=EF=BC=8C=E6=96=B0=E5=A2=9E=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81token=E9=AA=8C=E8=AF=81=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cm/common/config/FilterConfig.java | 2 +- .../java/com/cm/common/filter/AppFilter.java | 20 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cloud-common/src/main/java/com/cm/common/config/FilterConfig.java b/cloud-common/src/main/java/com/cm/common/config/FilterConfig.java index 1ea38f2..f037d22 100644 --- a/cloud-common/src/main/java/com/cm/common/config/FilterConfig.java +++ b/cloud-common/src/main/java/com/cm/common/config/FilterConfig.java @@ -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; diff --git a/cloud-common/src/main/java/com/cm/common/filter/AppFilter.java b/cloud-common/src/main/java/com/cm/common/filter/AppFilter.java index f18e6c4..df5c73a 100644 --- a/cloud-common/src/main/java/com/cm/common/filter/AppFilter.java +++ b/cloud-common/src/main/java/com/cm/common/filter/AppFilter.java @@ -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; }