Commit 74a1545a authored by zhouxudong's avatar zhouxudong

处理异常

parent 8b5256f8
...@@ -24,7 +24,13 @@ public class CurrentUserInterceptor implements AsyncHandlerInterceptor { ...@@ -24,7 +24,13 @@ public class CurrentUserInterceptor implements AsyncHandlerInterceptor {
throw new AuthException("未授权,请重新登录"); throw new AuthException("未授权,请重新登录");
} }
String token = authToken.substring("Bearer".length() + 1).trim(); String token = authToken.substring("Bearer".length() + 1).trim();
JwtInfo jwtUser = JwtTokenUtil.getJwtUser(token); JwtInfo jwtUser;
try{
jwtUser = JwtTokenUtil.getJwtUser(token);
}catch (Exception e){
throw new AuthException("未授权,请重新登录");
}
// 根据token信息,生成当前登录用户信息的设置,存放容器threadlocal // 根据token信息,生成当前登录用户信息的设置,存放容器threadlocal
BaseContextHandler.setCurrentUserInfo(jwtUser); BaseContextHandler.setCurrentUserInfo(jwtUser);
......
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