|
@@ -11,9 +11,8 @@ import org.slf4j.LoggerFactory;
|
11
|
11
|
import org.springframework.web.method.HandlerMethod;
|
12
|
12
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
13
|
13
|
|
14
|
|
-import com.alibaba.nacos.client.utils.IPUtil;
|
|
14
|
+import com.yaozhitech.spring5.annotation.IgnoreClientToken;
|
15
|
15
|
import com.yaozhitech.spring5.common.exception.auth.ClientForbiddenException;
|
16
|
|
-import com.yaozhitech.spring5.common.util.ClientUtil;
|
17
|
16
|
import com.yaozhitech.spring5.config.ServiceAuthConfig;
|
18
|
17
|
import com.yaozhitech.spring5.utils.JwtUtils;
|
19
|
18
|
|
|
@@ -44,14 +43,14 @@ public class ServiceAuthRestInterceptor extends HandlerInterceptorAdapter {
|
44
|
43
|
// return super.preHandle(request, response, handler);
|
45
|
44
|
// }
|
46
|
45
|
|
47
|
|
-// // 配置该注解,说明不进行服务拦截
|
48
|
|
-// IgnoreClientToken annotation = handlerMethod.getBeanType().getAnnotation(IgnoreClientToken.class);
|
49
|
|
-// if (annotation == null) {
|
50
|
|
-// annotation = handlerMethod.getMethodAnnotation(IgnoreClientToken.class);
|
51
|
|
-// }
|
52
|
|
-// if(annotation!=null) {
|
53
|
|
-// return super.preHandle(request, response, handler);
|
54
|
|
-// }
|
|
46
|
+ // 配置该注解,说明不进行服务拦截
|
|
47
|
+ IgnoreClientToken annotation = handlerMethod.getBeanType().getAnnotation(IgnoreClientToken.class);
|
|
48
|
+ if (annotation == null) {
|
|
49
|
+ annotation = handlerMethod.getMethodAnnotation(IgnoreClientToken.class);
|
|
50
|
+ }
|
|
51
|
+ if(annotation != null) {
|
|
52
|
+ return super.preHandle(request, response, handler);
|
|
53
|
+ }
|
55
|
54
|
|
56
|
55
|
String token = request.getHeader("x-auth-client");
|
57
|
56
|
logger.info(token);
|