From 1e10c437e8aa4bc786b048ca8692e1741a493fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E5=9B=BD=E4=B8=9C?= Date: Fri, 30 Sep 2022 16:02:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=AB=AF=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/rzyc/config/SecurityConfig.java | 1 + .../rzyc/filter/JwtAuthenticationTokenFiler.java | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/inventory-ent/src/main/java/com/rzyc/config/SecurityConfig.java b/inventory-ent/src/main/java/com/rzyc/config/SecurityConfig.java index 5c33187..a785852 100644 --- a/inventory-ent/src/main/java/com/rzyc/config/SecurityConfig.java +++ b/inventory-ent/src/main/java/com/rzyc/config/SecurityConfig.java @@ -75,6 +75,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .authorizeRequests() // 对于登录接口 允许匿名访问 .antMatchers("/personal/login").anonymous() + .antMatchers("/personal/entlogin").anonymous() //放行swagger .antMatchers("/swagger-ui.html","/swagger-resources/**","/webjars/**","/v2/**","/api/**").permitAll() // 除上面外的所有请求全部需要鉴权认证,配置退出路径 diff --git a/inventory-ent/src/main/java/com/rzyc/filter/JwtAuthenticationTokenFiler.java b/inventory-ent/src/main/java/com/rzyc/filter/JwtAuthenticationTokenFiler.java index 6b6fd17..e65b6b8 100644 --- a/inventory-ent/src/main/java/com/rzyc/filter/JwtAuthenticationTokenFiler.java +++ b/inventory-ent/src/main/java/com/rzyc/filter/JwtAuthenticationTokenFiler.java @@ -34,12 +34,13 @@ public class JwtAuthenticationTokenFiler extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { //获取token - String token = request.getHeader("token"); - if (!StringUtils.hasText(token)) { - //放行 - filterChain.doFilter(request, response); - return; - } + String token = request.getHeader("userToken"); +// if (!StringUtils.hasText(token)) { +// //放行 +// filterChain.doFilter(request, response); +// return; +// } + try { String userId = JwtUtil.getTokenMsg(token); } catch (Exception e) {