|
4 | 4 | import org.springframework.context.annotation.Bean;
|
5 | 5 | import org.springframework.context.annotation.Configuration;
|
6 | 6 | import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
| 7 | +import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer; |
7 | 8 | import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
|
8 | 9 |
|
9 | 10 | /**
|
10 | 11 | * Statistics 模块的 Security 配置
|
11 | 12 | */
|
12 |
| -@Configuration("statisticsSecurityConfiguration") |
| 13 | +@Configuration("reportSecurityConfiguration") |
13 | 14 | public class SecurityConfiguration {
|
14 | 15 |
|
15 |
| - @Bean("statisticsAuthorizeRequestsCustomizer") |
| 16 | + @Bean("reportAuthorizeRequestsCustomizer") |
16 | 17 | public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
|
17 | 18 | return new AuthorizeRequestsCustomizer() {
|
18 | 19 |
|
19 | 20 | @Override
|
20 |
| - public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) { |
| 21 | + public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) { |
21 | 22 | // Swagger 接口文档
|
22 |
| - registry.antMatchers("/v3/api-docs/**").permitAll() |
23 |
| - .antMatchers("/webjars/**").permitAll() |
24 |
| - .antMatchers("/swagger-ui").permitAll() |
25 |
| - .antMatchers("/swagger-ui/**").permitAll(); |
| 23 | + registry.requestMatchers("/v3/api-docs/**").permitAll() |
| 24 | + .requestMatchers("/webjars/**").permitAll() |
| 25 | + .requestMatchers("/swagger-ui").permitAll() |
| 26 | + .requestMatchers("/swagger-ui/**").permitAll(); |
26 | 27 | // Spring Boot Actuator 的安全配置
|
27 |
| - registry.antMatchers("/actuator").anonymous() |
28 |
| - .antMatchers("/actuator/**").anonymous(); |
| 28 | + registry.requestMatchers("/actuator").permitAll() |
| 29 | + .requestMatchers("/actuator/**").permitAll(); |
29 | 30 | // Druid 监控
|
30 |
| - registry.antMatchers("/druid/**").anonymous(); |
| 31 | + registry.requestMatchers("/druid/**").permitAll(); |
| 32 | + // 积木报表 |
| 33 | + registry.requestMatchers("/jmreport/**").permitAll(); |
31 | 34 | }
|
32 | 35 |
|
33 | 36 | };
|
|
0 commit comments