From ee9f604388a3e77d3f4654e326f3976552e7f532 Mon Sep 17 00:00:00 2001 From: Jay <csj123456> Date: 星期一, 25 十一月 2024 13:40:07 +0800 Subject: [PATCH] 测点启用和禁用 --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/framework/security/config/SecurityConfiguration.java | 24 +++++++----------------- 1 files changed, 7 insertions(+), 17 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/framework/security/config/SecurityConfiguration.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/framework/security/config/SecurityConfiguration.java index a9883af..1a406c4 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/framework/security/config/SecurityConfiguration.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/framework/security/config/SecurityConfiguration.java @@ -1,43 +1,33 @@ package com.iailab.module.data.framework.security.config; import com.iailab.framework.security.config.AuthorizeRequestsCustomizer; -import com.iailab.module.data.enums.ApiConstants; -import org.springframework.beans.factory.annotation.Value; +import com.iailab.module.system.enums.ApiConstants; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; /** - * data 模块的 Security 配置 + * System 模块的 Security 配置 */ -@Configuration(proxyBeanMethods = false, value = "dataSecurityConfiguration") +@Configuration(proxyBeanMethods = false, value = "systemSecurityConfiguration") public class SecurityConfiguration { - @Value("${spring.boot.admin.context-path:''}") - private String adminSeverContextPath; - - @Bean("infraAuthorizeRequestsCustomizer") + @Bean("systemAuthorizeRequestsCustomizer") public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() { return new AuthorizeRequestsCustomizer() { @Override public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) { + // TODO iailab:这个每个项目都需要重复配置,得捉摸有没通用的方案 // Swagger 接口文档 registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据 .antMatchers("/swagger-ui.html").permitAll(); // Swagger UI + // Druid 监控 + registry.antMatchers("/druid/**").anonymous(); // Spring Boot Actuator 的安全配置 registry.antMatchers("/actuator").anonymous() .antMatchers("/actuator/**").anonymous(); - // Druid 监控 - registry.antMatchers("/druid/**").anonymous(); - // Spring Boot Admin Server 的安全配置 - registry.antMatchers(adminSeverContextPath).anonymous() - .antMatchers(adminSeverContextPath + "/**").anonymous(); - // 文件读取 - registry.antMatchers(buildAdminApi("/data/point/**")).permitAll(); - - // TODO iailab:这个每个项目都需要重复配置,得捉摸有没通用的方案 // RPC 服务的安全配置 registry.antMatchers(ApiConstants.PREFIX + "/**").permitAll(); } -- Gitblit v1.9.3