From 3117f79e54b5d4cf3441361e2e9f3335195c87b9 Mon Sep 17 00:00:00 2001 From: kingsley Date: Thu, 10 Aug 2023 15:39:21 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=20#31?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/SynchronizerSecurityConfiguration.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eiam-synchronizer/src/main/java/cn/topiam/employee/synchronizer/configuration/SynchronizerSecurityConfiguration.java b/eiam-synchronizer/src/main/java/cn/topiam/employee/synchronizer/configuration/SynchronizerSecurityConfiguration.java index 2e03e47c..00a90aae 100644 --- a/eiam-synchronizer/src/main/java/cn/topiam/employee/synchronizer/configuration/SynchronizerSecurityConfiguration.java +++ b/eiam-synchronizer/src/main/java/cn/topiam/employee/synchronizer/configuration/SynchronizerSecurityConfiguration.java @@ -23,6 +23,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import static cn.topiam.employee.common.constant.ConfigBeanNameConstants.DEFAULT_SECURITY_FILTER_CHAIN; import static cn.topiam.employee.synchronizer.constants.SynchronizerConstants.EVENT_RECEIVE_PATH; import static cn.topiam.employee.synchronizer.constants.SynchronizerConstants.SYNCHRONIZER_PATH; @@ -51,13 +52,13 @@ public class SynchronizerSecurityConfiguration { http //认证请求 .securityMatcher(SYNCHRONIZER_PATH+"/**") - .authorizeHttpRequests(registry -> registry.requestMatchers(EVENT_RECEIVE_PATH+"/*").permitAll().anyRequest().authenticated()) + .authorizeHttpRequests(registry -> registry.requestMatchers(new AntPathRequestMatcher(EVENT_RECEIVE_PATH+"/*")).permitAll().anyRequest().authenticated()) //csrf过滤器 - .csrf(httpSecurityCsrfConfigurer -> httpSecurityCsrfConfigurer.ignoringRequestMatchers(EVENT_RECEIVE_PATH+"/*")); + .csrf(httpSecurityCsrfConfigurer -> httpSecurityCsrfConfigurer.ignoringRequestMatchers(new AntPathRequestMatcher(EVENT_RECEIVE_PATH+"/*"))); // @formatter:on return http.build(); } public SynchronizerSecurityConfiguration() { } -} +} \ No newline at end of file