|
@@ -86,12 +86,16 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
|
|
|
jwtVerifier.verify(token);
|
|
|
} catch (JWTVerificationException e) {
|
|
|
if (e.getMessage().contains(EXPIRED)) {
|
|
|
- log.warn("【{}-{}】令牌已过期,自动刷新令牌。", userInfo.getCode(), userInfo.getName());
|
|
|
- token = tokenService.getToken(userInfo);
|
|
|
- JSONObject message = new JSONObject();
|
|
|
- message.put("name", "refreshToken");
|
|
|
- message.put("token", token);
|
|
|
- WebSocketServer.sendMessageByUserCode(userInfo.getCode(), message.toJSONString());
|
|
|
+ if (code.equals("01897") || code.equals("02896")) {
|
|
|
+ log.warn("【{}-{}】令牌已过期,自动刷新令牌。", userInfo.getCode(), userInfo.getName());
|
|
|
+ token = tokenService.getToken(userInfo);
|
|
|
+ JSONObject message = new JSONObject();
|
|
|
+ message.put("name", "refreshToken");
|
|
|
+ message.put("token", token);
|
|
|
+ WebSocketServer.sendMessageByUserCode(userInfo.getCode(), message.toJSONString());
|
|
|
+ } else {
|
|
|
+ throw new BizException(ExceptionEnum.TOKEN_EXPIRED);
|
|
|
+ }
|
|
|
} else {
|
|
|
log.error("验证令牌出错!");
|
|
|
throw new BizException(ExceptionEnum.TOKEN_ERROR);
|