|
@@ -49,25 +49,18 @@ public class AuthIntercepter implements HandlerInterceptor {
|
|
log.info(request.getRequestURI());
|
|
log.info(request.getRequestURI());
|
|
//log.info("deviceId={},token={},time={}",deviceId,token,time);
|
|
//log.info("deviceId={},token={},time={}",deviceId,token,time);
|
|
try {
|
|
try {
|
|
-
|
|
|
|
if (!(handler instanceof HandlerMethod)) {
|
|
if (!(handler instanceof HandlerMethod)) {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
|
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
|
-
|
|
|
|
Method method = handlerMethod.getMethod();
|
|
Method method = handlerMethod.getMethod();
|
|
-
|
|
|
|
NonLoginRequired loginRequired = method.getAnnotation(NonLoginRequired.class);
|
|
NonLoginRequired loginRequired = method.getAnnotation(NonLoginRequired.class);
|
|
//有@LoginRequired注解,需要认证
|
|
//有@LoginRequired注解,需要认证
|
|
if (loginRequired != null) {
|
|
if (loginRequired != null) {
|
|
-
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
log.info("---interceptertoken");
|
|
log.info("---interceptertoken");
|
|
log.info(token);
|
|
log.info(token);
|
|
-
|
|
|
|
if (StringUtils.isEmpty(token)) {
|
|
if (StringUtils.isEmpty(token)) {
|
|
log.info("*********************》token为空");
|
|
log.info("*********************》token为空");
|
|
throw new RRException("token错误,请重新登录", 101);
|
|
throw new RRException("token错误,请重新登录", 101);
|
|
@@ -81,6 +74,7 @@ public class AuthIntercepter implements HandlerInterceptor {
|
|
log.info("************************************》");
|
|
log.info("************************************》");
|
|
Long userId = TokenUtils.getUserId(token);
|
|
Long userId = TokenUtils.getUserId(token);
|
|
log.info("userId={}",userId);
|
|
log.info("userId={}",userId);
|
|
|
|
+
|
|
Object obj = redisTemplate.opsForValue().get("user");
|
|
Object obj = redisTemplate.opsForValue().get("user");
|
|
if (obj == null) {
|
|
if (obj == null) {
|
|
log.info("************************用户token不存在");
|
|
log.info("************************用户token不存在");
|
|
@@ -91,7 +85,6 @@ public class AuthIntercepter implements HandlerInterceptor {
|
|
|
|
|
|
} catch (RRException e) {
|
|
} catch (RRException e) {
|
|
log.info("调用了异常通知" + e.getMessage());
|
|
log.info("调用了异常通知" + e.getMessage());
|
|
-
|
|
|
|
throw e;
|
|
throw e;
|
|
}
|
|
}
|
|
|
|
|