Переглянути джерело

暂时注释掉ICSS后台管理系统权限控制

gaodm 6 роки тому
батько
коміт
79076e53f9

+ 7 - 7
icssman-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -25,13 +25,13 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
         http
                 .csrf().disable()
                 .authorizeRequests()
-                .regexMatchers(".*swagger.*", ".*v2.*", ".*webjars.*", "/druid.*", "/actuator.*", "/hystrix.*").permitAll()
-                .antMatchers("/file/upload").permitAll()
-                .antMatchers("/introduceInfo/saveIntroduce").permitAll()
-                .antMatchers("/questionInfo/delete").permitAll()
-                .antMatchers("/questionInfo/index").permitAll()
-                .antMatchers("/**").authenticated();
-        //        .antMatchers("/**").permitAll();
+//                .regexMatchers(".*swagger.*", ".*v2.*", ".*webjars.*", "/druid.*", "/actuator.*", "/hystrix.*").permitAll()
+//                .antMatchers("/file/upload").permitAll()
+//                .antMatchers("/introduceInfo/saveIntroduce").permitAll()
+//                .antMatchers("/questionInfo/delete").permitAll()
+//                .antMatchers("/questionInfo/index").permitAll()
+//                .antMatchers("/**").authenticated();
+                .antMatchers("/**").permitAll();
     }
 
 

+ 34 - 34
icssman-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -33,40 +33,40 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
 
     @Override
     public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException {
-        HttpServletRequest request = ((FilterInvocation) object).getHttpRequest();
-        String url, method;
-        if (matchPermitAllUrl(request)) {
-            return;
-        }
-        if ("anonymousUser".equals(authentication.getPrincipal())) {
-            throw new AccessDeniedException("no right");
-        } else {
-            //验证token有效性
-            String tokenStr = HttpUtils.getHeaders(request).get("Authorization");
-            if (StringUtil.isNotEmpty(tokenStr)) {
-                Token token = new Token();
-                tokenStr = tokenStr.replaceFirst("Bearer ", "");
-                token.setToken(tokenStr);
-                RespDTO<Boolean> res = userServiceClient.verifyToken(token);
-                if (res == null || !"0".equals(res.code)) {
-                    throw new AccountExpiredException("token expire");
-                }
-                if (!res.data) {
-                    throw new AccountExpiredException("token expire");
-                }
-            }
-            for (GrantedAuthority ga : authentication.getAuthorities()) {
-                String[] authority = ga.getAuthority().split(";");
-                url = authority[0];
-                method = authority[1];
-                if (matchers(url, request)) {
-                    if (method.equals(request.getMethod()) || "ALL".equals(method)) {
-                        return;
-                    }
-                }
-            }
-        }
-        throw new AccessDeniedException("no right");
+//        HttpServletRequest request = ((FilterInvocation) object).getHttpRequest();
+//        String url, method;
+//        if (matchPermitAllUrl(request)) {
+//            return;
+//        }
+//        if ("anonymousUser".equals(authentication.getPrincipal())) {
+//            throw new AccessDeniedException("no right");
+//        } else {
+//            //验证token有效性
+//            String tokenStr = HttpUtils.getHeaders(request).get("Authorization");
+//            if (StringUtil.isNotEmpty(tokenStr)) {
+//                Token token = new Token();
+//                tokenStr = tokenStr.replaceFirst("Bearer ", "");
+//                token.setToken(tokenStr);
+//                RespDTO<Boolean> res = userServiceClient.verifyToken(token);
+//                if (res == null || !"0".equals(res.code)) {
+//                    throw new AccountExpiredException("token expire");
+//                }
+//                if (!res.data) {
+//                    throw new AccountExpiredException("token expire");
+//                }
+//            }
+//            for (GrantedAuthority ga : authentication.getAuthorities()) {
+//                String[] authority = ga.getAuthority().split(";");
+//                url = authority[0];
+//                method = authority[1];
+//                if (matchers(url, request)) {
+//                    if (method.equals(request.getMethod()) || "ALL".equals(method)) {
+//                        return;
+//                    }
+//                }
+//            }
+//        }
+//        throw new AccessDeniedException("no right");
     }