1. 统一包名修改
This commit is contained in:
@@ -16,7 +16,7 @@ import org.springframework.context.annotation.Primary;
|
||||
@EnableLogRecord(tenant = "") // 貌似用不上 tenant 这玩意给个空好啦
|
||||
@AutoConfiguration
|
||||
@Slf4j
|
||||
public class CloudOperateLogConfiguration {
|
||||
public class ZtOperateLogConfiguration {
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@@ -11,5 +11,5 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@EnableFeignClients(clients = {OperateLogCommonApi.class}) // 主要是引入相关的 API 服务
|
||||
public class CloudOperateLogRpcAutoConfiguration {
|
||||
public class ZtOperateLogRpcAutoConfiguration {
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class LogRecordServiceImpl implements ILogRecordService {
|
||||
reqDTO.setType(logRecord.getType()); // 大模块类型,例如:CRM 客户
|
||||
reqDTO.setSubType(logRecord.getSubType());// 操作名称,例如:转移客户
|
||||
reqDTO.setBizId(Long.parseLong(logRecord.getBizNo())); // 业务编号,例如:客户编号
|
||||
reqDTO.setAction(logRecord.getAction());// 操作内容,例如:修改编号为 1 的用户信息,将性别从男改成女,将姓名从ZT改成源码。
|
||||
reqDTO.setAction(logRecord.getAction());// 操作内容,例如:修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码。
|
||||
reqDTO.setExtra(logRecord.getExtra()); // 拓展字段,有些复杂的业务,需要记录一些字段 ( JSON 格式 ),例如说,记录订单编号,{ orderId: "1"}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ConfigurationProperties(prefix = "cloud.security")
|
||||
@ConfigurationProperties(prefix = "zt.security")
|
||||
@Validated
|
||||
@Data
|
||||
public class SecurityProperties {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.security.web.access.AccessDeniedHandler;
|
||||
/**
|
||||
* Spring Security 自动配置类,主要用于相关组件的配置
|
||||
*
|
||||
* 注意,不能和 {@link CloudWebSecurityConfigurerAdapter} 用一个,原因是会导致初始化报错。
|
||||
* 注意,不能和 {@link ZtWebSecurityConfigurerAdapter} 用一个,原因是会导致初始化报错。
|
||||
* 参见 https://stackoverflow.com/questions/53847050/spring-boot-delegatebuilder-cannot-be-null-on-autowiring-authenticationmanager 文档。
|
||||
*
|
||||
* @author ZT
|
||||
@@ -32,7 +32,7 @@ import org.springframework.security.web.access.AccessDeniedHandler;
|
||||
@AutoConfiguration
|
||||
@AutoConfigureOrder(-1) // 目的:先于 Spring Security 自动配置,避免一键改包后,org.* 基础包无法生效
|
||||
@EnableConfigurationProperties(SecurityProperties.class)
|
||||
public class CloudSecurityAutoConfiguration {
|
||||
public class ZtSecurityAutoConfiguration {
|
||||
|
||||
@Resource
|
||||
private SecurityProperties securityProperties;
|
||||
@@ -15,7 +15,7 @@ import org.springframework.context.annotation.Bean;
|
||||
@AutoConfiguration
|
||||
@EnableFeignClients(clients = {OAuth2TokenCommonApi.class, // 主要是引入相关的 API 服务
|
||||
PermissionCommonApi.class})
|
||||
public class CloudSecurityRpcAutoConfiguration {
|
||||
public class ZtSecurityRpcAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public LoginUserRequestInterceptor loginUserRequestInterceptor() {
|
||||
@@ -46,7 +46,7 @@ import static com.zt.plat.framework.common.util.collection.CollectionUtils.conve
|
||||
@AutoConfiguration
|
||||
@AutoConfigureOrder(-1) // 目的:先于 Spring Security 自动配置,避免一键改包后,org.* 基础包无法生效
|
||||
@EnableMethodSecurity(securedEnabled = true)
|
||||
public class CloudWebSecurityConfigurerAdapter {
|
||||
public class ZtWebSecurityConfigurerAdapter {
|
||||
|
||||
@Resource
|
||||
private WebProperties webProperties;
|
||||
@@ -137,7 +137,7 @@ public class CloudWebSecurityConfigurerAdapter {
|
||||
.requestMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
|
||||
.requestMatchers(HttpMethod.HEAD, permitAllUrls.get(HttpMethod.HEAD).toArray(new String[0])).permitAll()
|
||||
.requestMatchers(HttpMethod.PATCH, permitAllUrls.get(HttpMethod.PATCH).toArray(new String[0])).permitAll()
|
||||
// 1.3 基于 cloud.security.permit-all-urls 无需认证
|
||||
// 1.3 基于 zt.security.permit-all-urls 无需认证
|
||||
.requestMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
|
||||
)
|
||||
// ②:每个项目的自定义规则
|
||||
@@ -1,5 +1,5 @@
|
||||
com.zt.plat.framework.security.config.CloudSecurityRpcAutoConfiguration
|
||||
com.zt.plat.framework.security.config.CloudSecurityAutoConfiguration
|
||||
com.zt.plat.framework.security.config.CloudWebSecurityConfigurerAdapter
|
||||
com.zt.plat.framework.operatelog.config.CloudOperateLogConfiguration
|
||||
com.zt.plat.framework.operatelog.config.CloudOperateLogRpcAutoConfiguration
|
||||
com.zt.plat.framework.security.config.ZtSecurityRpcAutoConfiguration
|
||||
com.zt.plat.framework.security.config.ZtSecurityAutoConfiguration
|
||||
com.zt.plat.framework.security.config.ZtWebSecurityConfigurerAdapter
|
||||
com.zt.plat.framework.operatelog.config.ZtOperateLogConfiguration
|
||||
com.zt.plat.framework.operatelog.config.ZtOperateLogRpcAutoConfiguration
|
||||
Reference in New Issue
Block a user