企业端认证

This commit is contained in:
韩国东 2022-09-30 16:02:16 +08:00
parent 336fe19e3b
commit 1e10c437e8
2 changed files with 8 additions and 6 deletions

View File

@ -75,6 +75,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.authorizeRequests() .authorizeRequests()
// 对于登录接口 允许匿名访问 // 对于登录接口 允许匿名访问
.antMatchers("/personal/login").anonymous() .antMatchers("/personal/login").anonymous()
.antMatchers("/personal/entlogin").anonymous()
//放行swagger //放行swagger
.antMatchers("/swagger-ui.html","/swagger-resources/**","/webjars/**","/v2/**","/api/**").permitAll() .antMatchers("/swagger-ui.html","/swagger-resources/**","/webjars/**","/v2/**","/api/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证,配置退出路径 // 除上面外的所有请求全部需要鉴权认证,配置退出路径

View File

@ -34,12 +34,13 @@ public class JwtAuthenticationTokenFiler extends OncePerRequestFilter {
@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 {
//获取token //获取token
String token = request.getHeader("token"); String token = request.getHeader("userToken");
if (!StringUtils.hasText(token)) { // if (!StringUtils.hasText(token)) {
//放行 // //放行
filterChain.doFilter(request, response); // filterChain.doFilter(request, response);
return; // return;
} // }
try { try {
String userId = JwtUtil.getTokenMsg(token); String userId = JwtUtil.getTokenMsg(token);
} catch (Exception e) { } catch (Exception e) {