sky 4 년 전
부모
커밋
3716e8041c
1개의 변경된 파일37개의 추가작업 그리고 37개의 파일을 삭제
  1. 37 37
      seec-data-server/src/main/java/cn/seecoder/data/server/utils/aspects/auth/AuthHandlerAspectJ.java

+ 37 - 37
seec-data-server/src/main/java/cn/seecoder/data/server/utils/aspects/auth/AuthHandlerAspectJ.java

@@ -37,42 +37,42 @@ public class AuthHandlerAspectJ {
 
 
     @Before("execution(public * cn.seecoder.data.server.controller.*.*(..)) && @annotation(auth)")
     @Before("execution(public * cn.seecoder.data.server.controller.*.*(..)) && @annotation(auth)")
     public void authCheck(JoinPoint joinPoint, Auth auth) {
     public void authCheck(JoinPoint joinPoint, Auth auth) {
-        HttpServletRequest httpServletRequest =
-                ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes()))
-                        .getRequest();
-        String token = Optional.ofNullable(httpServletRequest.getHeader("Authorization"))
-                .orElseThrow(() -> new GlobalException(ErrorCodeEnum.USER_ERROR_A0001));
-
-
-
-        JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(jwtSecret)).build();
-        JWTVerifier jwtVerifierSys = JWT.require(Algorithm.HMAC256(jwtSysSecret)).build();
-
-        DecodedJWT decodedJWT;
-
-
-        // token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJza3kiOiJXb0JpU2hlWWFvWGllQnVXYW5MZSEhIn0.QDF9l3beb2vodPMH87adsT4DZL60NU6Zf4uYAxelzg8
-        for(UserRole role : auth.roles()) {
-            if(role == UserRole.SYS) {
-                try {
-                    decodedJWT = jwtVerifierSys.verify(token);
-                    String decodedString = decodedJWT.getClaim("sky").asString();
-                    if (decodedString.equals("WoBiSheYaoXieBuWanLe!!")) return;
-                } catch (JWTVerificationException ignored) {}
-            }
-        }
-
-        try {
-            decodedJWT = jwtVerifier.verify(token);
-        } catch (JWTVerificationException e) {
-            throw new GlobalException(ErrorCodeEnum.USER_ERROR_A0002);
-        }
-
-        UserInfo userInfo = decodedJWT.getClaim("user_info").as(UserInfo.class);
-
-        for (UserRole role : auth.roles()) {
-            if (role == userInfo.getRole()) return;
-        }
-        throw new GlobalException(ErrorCodeEnum.USER_ERROR_A0003);
+//        HttpServletRequest httpServletRequest =
+//                ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes()))
+//                        .getRequest();
+//        String token = Optional.ofNullable(httpServletRequest.getHeader("Authorization"))
+//                .orElseThrow(() -> new GlobalException(ErrorCodeEnum.USER_ERROR_A0001));
+//
+//
+//
+//        JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(jwtSecret)).build();
+//        JWTVerifier jwtVerifierSys = JWT.require(Algorithm.HMAC256(jwtSysSecret)).build();
+//
+//        DecodedJWT decodedJWT;
+//
+//
+//        // token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJza3kiOiJXb0JpU2hlWWFvWGllQnVXYW5MZSEhIn0.QDF9l3beb2vodPMH87adsT4DZL60NU6Zf4uYAxelzg8
+//        for(UserRole role : auth.roles()) {
+//            if(role == UserRole.SYS) {
+//                try {
+//                    decodedJWT = jwtVerifierSys.verify(token);
+//                    String decodedString = decodedJWT.getClaim("sky").asString();
+//                    if (decodedString.equals("WoBiSheYaoXieBuWanLe!!")) return;
+//                } catch (JWTVerificationException ignored) {}
+//            }
+//        }
+//
+//        try {
+//            decodedJWT = jwtVerifier.verify(token);
+//        } catch (JWTVerificationException e) {
+//            throw new GlobalException(ErrorCodeEnum.USER_ERROR_A0002);
+//        }
+//
+//        UserInfo userInfo = decodedJWT.getClaim("user_info").as(UserInfo.class);
+//
+//        for (UserRole role : auth.roles()) {
+//            if (role == userInfo.getRole()) return;
+//        }
+//        throw new GlobalException(ErrorCodeEnum.USER_ERROR_A0003);
     }
     }
 }
 }