🐛 修复 #31

pull/26/MERGE
kingsley 2023-08-10 15:39:21 +08:00 committed by GitHub
parent a887477271
commit 3117f79e54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -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.method.configuration.EnableMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.SecurityFilterChain; 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.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.EVENT_RECEIVE_PATH;
import static cn.topiam.employee.synchronizer.constants.SynchronizerConstants.SYNCHRONIZER_PATH; import static cn.topiam.employee.synchronizer.constants.SynchronizerConstants.SYNCHRONIZER_PATH;
@ -51,13 +52,13 @@ public class SynchronizerSecurityConfiguration {
http http
//认证请求 //认证请求
.securityMatcher(SYNCHRONIZER_PATH+"/**") .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过滤器
.csrf(httpSecurityCsrfConfigurer -> httpSecurityCsrfConfigurer.ignoringRequestMatchers(EVENT_RECEIVE_PATH+"/*")); .csrf(httpSecurityCsrfConfigurer -> httpSecurityCsrfConfigurer.ignoringRequestMatchers(new AntPathRequestMatcher(EVENT_RECEIVE_PATH+"/*")));
// @formatter:on // @formatter:on
return http.build(); return http.build();
} }
public SynchronizerSecurityConfiguration() { public SynchronizerSecurityConfiguration() {
} }
} }