【代码优化】调整 swagger 的安全配置

This commit is contained in:
YunaiV 2024-07-16 00:30:54 +08:00
parent c64ba58cd0
commit 28d74d07ac

View File

@ -24,11 +24,9 @@ public class SecurityConfiguration {
public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) { public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) {
// Swagger 接口文档 // Swagger 接口文档
registry.requestMatchers("/v3/api-docs/**").permitAll() registry.requestMatchers("/v3/api-docs/**").permitAll()
.requestMatchers("/swagger-ui.html").permitAll()
.requestMatchers("/swagger-ui/**").permitAll()
.requestMatchers("/swagger-resources/**").permitAll()
.requestMatchers("/webjars/**").permitAll() .requestMatchers("/webjars/**").permitAll()
.requestMatchers("/*/api-docs").permitAll(); .requestMatchers("/swagger-ui.html").permitAll()
.requestMatchers("/swagger-ui/**").permitAll();
// Spring Boot Actuator 的安全配置 // Spring Boot Actuator 的安全配置
registry.requestMatchers("/actuator").permitAll() registry.requestMatchers("/actuator").permitAll()
.requestMatchers("/actuator/**").permitAll(); .requestMatchers("/actuator/**").permitAll();