2022-01-21 11:54:13 +08:00
|
|
|
|
# desensitize
|
|
|
|
|
|
|
|
|
|
#### 介绍
|
|
|
|
|
数据脱敏工具包
|
|
|
|
|
|
|
|
|
|
#### 软件架构
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 安装教程
|
|
|
|
|
|
|
|
|
|
1. 添加依赖
|
|
|
|
|
```
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>io.github.applesline</groupId>
|
|
|
|
|
<artifactId>desensitize</artifactId>
|
|
|
|
|
<version>1.0.0-SNAPSHOT</version>
|
|
|
|
|
</dependency>
|
|
|
|
|
```
|
|
|
|
|
2. 打开脱敏开关 @EnableDesensitize
|
|
|
|
|
```
|
|
|
|
|
import org.applesline.desensitize.annotation.EnableDesensitize;
|
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
|
@EnableDesensitize
|
|
|
|
|
public class DemoApplication {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
SpringApplication.run(DemoApplication.class, args);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
3. 针对方法的局部脱敏 @Desensitize
|
|
|
|
|
```
|
|
|
|
|
@RequestMapping("4")
|
|
|
|
|
@Desensitize(fieldMapping = @FieldMapping(fields = {"_mobile"},type = DesensitizeType.MOBILE))
|
|
|
|
|
public Result demo4() {
|
|
|
|
|
return new Result("111111111@163.com","17622233344");
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2022-01-21 13:32:30 +08:00
|
|
|
|
4. 脱敏效果展示(响应体中的_mobile字段被脱敏了)
|
|
|
|
|
```
|
|
|
|
|
{
|
|
|
|
|
"_email": "111111111@163.com",
|
|
|
|
|
"_mobile": "176****3344"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2022-01-21 11:54:13 +08:00
|
|
|
|
#### 使用说明
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 参与贡献
|
|
|
|
|
|
|
|
|
|
1. Fork 本仓库
|
|
|
|
|
2. 新建 Feat_xxx 分支
|
|
|
|
|
3. 提交代码
|
|
|
|
|
4. 新建 Pull Request
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 特技
|
|
|
|
|
|
|
|
|
|
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
|
|
|
|
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
|
|
|
|
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
|
|
|
|
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
|
|
|
|
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
|
|
|
|
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|