liriming
2024-12-03 97f3c16ac595493405e8cf76399dc703c088ef6f
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.report.framework.security.config;
H 2
3 import com.iailab.framework.security.config.AuthorizeRequestsCustomizer;
4 import org.springframework.context.annotation.Bean;
5 import org.springframework.context.annotation.Configuration;
6 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
874287 7 import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
e7c126 8
H 9 /**
10  * Report 模块的 Security 配置
11  */
12 @Configuration("reportSecurityConfiguration")
13 public class SecurityConfiguration {
14
15     @Bean("reportAuthorizeRequestsCustomizer")
16     public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
17         return new AuthorizeRequestsCustomizer() {
18
19             @Override
874287 20             public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) {
e7c126 21                 // Swagger 接口文档
874287 22                 registry.requestMatchers("/v3/api-docs/**").permitAll()
H 23                         .requestMatchers("/webjars/**").permitAll()
24                         .requestMatchers("/swagger-ui").permitAll()
25                         .requestMatchers("/swagger-ui/**").permitAll();
e7c126 26                 // Spring Boot Actuator 的安全配置
874287 27                 registry.requestMatchers("/actuator").permitAll()
H 28                         .requestMatchers("/actuator/**").permitAll();
e7c126 29                 // Druid 监控
874287 30                 registry.requestMatchers("/druid/**").permitAll();
e7c126 31                 // 积木报表
874287 32                 registry.requestMatchers("/jmreport/**").permitAll();
H 33                 // 积木仪表盘排除
34                 registry.requestMatchers("/drag/**").permitAll();
e7c126 35             }
H 36
37         };
38     }
39 }