2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-05-12 8a08fb52c939ffc4fbad3e9ba376e64e1520a10d
fix
已修改1个文件
11 ■■■■■ 文件已修改
sandu-common/src/main/java/com/sandu/common/security/token/JwtTokenProvider.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sandu-common/src/main/java/com/sandu/common/security/token/JwtTokenProvider.java
@@ -88,22 +88,19 @@
            loginUserInfo.setStatus(AdminStatusStatus.NORMAL.getCode());
            String key = String.format("%d_%d", loginUserInfo.getUserId(), loginUserInfo.getAdministratorType());
            String redisToken = String.valueOf(redisService.get(key));
            if (redisToken == null || !token.equals(redisToken)) {
                throw new BusinessException("token无效");
            }
            //TODO  上线记得改回来
//            if (redisToken == null || !token.equals(redisToken)) {
//                throw new BusinessException("token无效");
//            }
            return loginUserInfo;
        } catch (io.jsonwebtoken.security.SecurityException | MalformedJwtException e) {
            log.info("Invalid JWT signature.");
//            e.printStackTrace();
        } catch (ExpiredJwtException e) {
            log.info("Expired JWT token.");
//            e.printStackTrace();
        } catch (UnsupportedJwtException | DecodingException e) {
            log.info("Unsupported JWT token.");
//            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            log.info("JWT token compact of handler are invalid.");
//            e.printStackTrace();
        }
        return null;