Commit ed77ab6d by zhangxingmin

日志

parent f0b21d20
......@@ -57,7 +57,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
log.info("从HTTP请求中解析JWT令牌(通常从Authorization头获取):{}",token);
// 2. 检查令牌是否存在且有效
if (token != null && tokenProvider.validateToken(token)) {
if (token != null) {
if (tokenProvider.validateToken(token)){
// 3. 从JWT令牌中提取用户唯一标识(业务ID)
String userBizId = tokenProvider.getUserBizIdFromToken(token);
......@@ -78,6 +79,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
// 6. 将认证对象设置到SecurityContext中,表示用户已认证,这里设置后续接口能直接拿到登录用户信息
SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
// 7. 继续执行后续过滤器链(无论是否认证都要继续处理请求)
filterChain.doFilter(request, response);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment