From 4637a60a1e1cc60e723063eb033eaf1655cc7435 Mon Sep 17 00:00:00 2001 From: edgar <373337002@qq.com> Date: Wed, 8 Jun 2022 12:02:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitor/config/WebSecurityConfigurer.java | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/pig-visual/pig-monitor/src/main/java/com/pig4cloud/pig/monitor/config/WebSecurityConfigurer.java b/pig-visual/pig-monitor/src/main/java/com/pig4cloud/pig/monitor/config/WebSecurityConfigurer.java index 1372d00d..316f9a78 100755 --- a/pig-visual/pig-monitor/src/main/java/com/pig4cloud/pig/monitor/config/WebSecurityConfigurer.java +++ b/pig-visual/pig-monitor/src/main/java/com/pig4cloud/pig/monitor/config/WebSecurityConfigurer.java @@ -30,7 +30,7 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti * @date 2019/2/1 */ @EnableWebSecurity -public class WebSecurityConfigurer{ +public class WebSecurityConfigurer { private final String adminContextPath; @@ -49,23 +49,12 @@ public class WebSecurityConfigurer{ SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter("redirectTo"); successHandler.setDefaultTargetUrl(adminContextPath + "/"); - http - .headers().frameOptions().disable() - .and().authorizeRequests() - .antMatchers(adminContextPath + "/assets/**" - , adminContextPath + "/login" - , adminContextPath + "/instances/**" - , adminContextPath + "/actuator/**" - ).permitAll() - .anyRequest().authenticated() - .and() - .formLogin().loginPage(adminContextPath + "/login") - .successHandler(successHandler).and() - .logout().logoutUrl(adminContextPath + "/logout") - .and() - .httpBasic().and() - .csrf() - .disable(); + http.headers().frameOptions().disable().and().authorizeRequests() + .antMatchers(adminContextPath + "/assets/**", adminContextPath + "/login", + adminContextPath + "/instances/**", adminContextPath + "/actuator/**") + .permitAll().anyRequest().authenticated().and().formLogin().loginPage(adminContextPath + "/login") + .successHandler(successHandler).and().logout().logoutUrl(adminContextPath + "/logout").and().httpBasic() + .and().csrf().disable(); return http.build(); } From 7813e9503a472559712795e1aef1173f457571bf Mon Sep 17 00:00:00 2001 From: lbw Date: Sun, 3 Jul 2022 16:33:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?:memo:=20Writing=20docs.=20=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E5=8C=96=E9=83=A8=E7=BD=B2=E8=A7=86=E9=A2=91=E9=93=BE?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a300c077..16de93bb 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ cnpm install && cnpm run build:docker && cd docker && docker-compose up -d - + From 5012af36f564d27f59fd7df19f74686de88c06a6 Mon Sep 17 00:00:00 2001 From: edgar <373337002@qq.com> Date: Tue, 5 Jul 2022 15:41:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?update=20permitall=20ignoreUrls=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/security/component/PermitAllUrlProperties.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PermitAllUrlProperties.java b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PermitAllUrlProperties.java index 9cee8a48..8f571a7f 100755 --- a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PermitAllUrlProperties.java +++ b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PermitAllUrlProperties.java @@ -29,10 +29,7 @@ import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.mvc.method.RequestMappingInfo; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.util.*; import java.util.regex.Pattern; /** @@ -47,12 +44,15 @@ public class PermitAllUrlProperties implements InitializingBean { private static final Pattern PATTERN = Pattern.compile("\\{(.*?)\\}"); + private static final String[] DEFAULT_IGNORE_URLS = new String[] { "/error", "/v3/api-docs" }; + @Getter @Setter private List urls = new ArrayList<>(); @Override public void afterPropertiesSet() { + urls.addAll(Arrays.asList(DEFAULT_IGNORE_URLS)); RequestMappingHandlerMapping mapping = SpringUtil.getBean("requestMappingHandlerMapping"); Map map = mapping.getHandlerMethods();