|
|
|
@ -42,29 +42,29 @@ public class BackUserAspect {
|
|
|
|
|
public void doVerify() {
|
|
|
|
|
|
|
|
|
|
//获取请求信息
|
|
|
|
|
// ServletRequestAttributes attributes =
|
|
|
|
|
// (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
|
|
// HttpServletRequest request = Objects.requireNonNull(attributes).getRequest();
|
|
|
|
|
//
|
|
|
|
|
// //从请求头中获取token
|
|
|
|
|
// String token = request.getHeader("token");
|
|
|
|
|
//
|
|
|
|
|
// if (!Objects.isNull(token)) {
|
|
|
|
|
//
|
|
|
|
|
// //身份识别 已取消
|
|
|
|
|
//
|
|
|
|
|
// //获取redis中的token 查看token是否过期
|
|
|
|
|
// if (Verification.verificationString((String) redisUtil.get(token))) {
|
|
|
|
|
// log.info("back 请求-token正常");
|
|
|
|
|
// } else {
|
|
|
|
|
// log.info("back 请求-redis中的token已过期,请重新登录");
|
|
|
|
|
// throw new ResponseException(-1, "Back request-token is expired");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// } else {
|
|
|
|
|
// log.info("Back request-token is null");
|
|
|
|
|
// throw new ResponseException(-1, "Back request-token is null");
|
|
|
|
|
// }
|
|
|
|
|
ServletRequestAttributes attributes =
|
|
|
|
|
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
|
|
HttpServletRequest request = Objects.requireNonNull(attributes).getRequest();
|
|
|
|
|
|
|
|
|
|
//从请求头中获取token
|
|
|
|
|
String token = request.getHeader("token");
|
|
|
|
|
|
|
|
|
|
if (!Objects.isNull(token)) {
|
|
|
|
|
|
|
|
|
|
//身份识别 已取消
|
|
|
|
|
|
|
|
|
|
//获取redis中的token 查看token是否过期
|
|
|
|
|
if (Verification.verificationString((String) redisUtil.get(token))) {
|
|
|
|
|
log.info("back 请求-token正常");
|
|
|
|
|
} else {
|
|
|
|
|
log.info("back 请求-redis中的token已过期,请重新登录");
|
|
|
|
|
throw new ResponseException(-1, "Back request-token is expired");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
log.info("Back request-token is null");
|
|
|
|
|
throw new ResponseException(-1, "Back request-token is null");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|