feat: 添加 spring-boot-desensitize starter.

This commit is contained in:
lijiahang
2023-06-30 11:12:42 +08:00
parent 4b76b63520
commit 3eb84c2b8a
6 changed files with 90 additions and 0 deletions

View File

@@ -97,6 +97,16 @@
<artifactId>orion-ops-spring-boot-starter-redis</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.orion.ops</groupId>
<artifactId>orion-ops-spring-boot-starter-desensitize</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.orion.ops</groupId>
<artifactId>orion-ops-spring-boot-starter-log</artifactId>
<version>${revision}</version>
</dependency>
<!-- websocket -->
<dependency>

View File

@@ -0,0 +1,34 @@
package com.orion.ops.framework.common.annotation;
import java.lang.annotation.*;
/**
* 脱敏配置元注解
* <p>
* 标注在字段上则标记脱敏配置
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/29 16:58
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Desensitize {
/**
* @return 起始保留字符数
*/
int keepStart() default 0;
/**
* @return 结束保留字符数
*/
int keepEnd() default 0;
/**
* @return 脱敏字符
*/
char replacer() default '*';
}

View File

@@ -0,0 +1,20 @@
package com.orion.ops.framework.common.annotation;
import java.lang.annotation.*;
/**
* 脱敏配置元注解
* <p>
* 标注在方法上则标记过滤开启
* 多层对象脱敏需要在字段上标注
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/29 16:58
*/
@Target({ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DoDesensitize {
}

View File

@@ -0,0 +1,16 @@
package com.orion.ops.framework.common.constant;
/**
* 结果增强器 排序常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/29 16:09
*/
public interface ResponseAdviceOrderConst {
int DESENSITIZE = Integer.MIN_VALUE + 2000;
int WRAPPER = Integer.MIN_VALUE + 3000;
}

View File

@@ -25,6 +25,8 @@
<module>orion-ops-spring-boot-starter-job</module>
<module>orion-ops-spring-boot-starter-websocket</module>
<module>orion-ops-spring-boot-starter-redis</module>
<module>orion-ops-spring-boot-starter-desensitize</module>
<module>orion-ops-spring-boot-starter-log</module>
</modules>
</project>

View File

@@ -56,6 +56,14 @@
<groupId>com.orion.ops</groupId>
<artifactId>orion-ops-spring-boot-starter-redis</artifactId>
</dependency>
<dependency>
<groupId>com.orion.ops</groupId>
<artifactId>orion-ops-spring-boot-starter-desensitize</artifactId>
</dependency>
<dependency>
<groupId>com.orion.ops</groupId>
<artifactId>orion-ops-spring-boot-starter-log</artifactId>
</dependency>
<!-- orion-ops biz-modules -->