Skip to content

Commit 6f453d9

Browse files
committed
build: 发布1.2.0
1 parent 49fafc8 commit 6f453d9

File tree

3 files changed

+143
-62
lines changed

3 files changed

+143
-62
lines changed

README.md

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
简体中文 | [English](./README_EN.md)
22
## 介绍
3-
`encrypt-body-spring-boot-starter`是对SpringBoot控制器统一的响应体加密与请求体解密的注解处理方式,支持MD5/SHA/AES/DES/RSA。
3+
`encrypt-body-spring-boot-starter`是对`springboot`控制器统一的响应体编码/加密与请求体解密的注解处理方式,支持MD5/SHA/AES/DES/RSA。
44

55
[![](https://img.shields.io/github/release/Licoy/encrypt-body-spring-boot-starter.svg)]()
66
[![](https://img.shields.io/github/issues/Licoy/encrypt-body-spring-boot-starter.svg)]()
77
[![](https://img.shields.io/github/issues-pr/Licoy/encrypt-body-spring-boot-starter.svg)]()
88
[![](https://img.shields.io/badge/author-Licoy-ff69b4.svg)]()
9-
## 加密解密支持
10-
- 可进行加密的方式有
9+
## 编码/加密解密支持
10+
- 可进行编码/加密的方式有
1111
- - [x] MD5
1212
- - [x] SHA-1 / SHA-256
1313
- - [x] AES
@@ -17,16 +17,18 @@
1717
- - [x] AES
1818
- - [x] DES
1919
- - [x] RSA
20-
## 使用方法
21-
-`pom.xml`中引入依赖:
20+
## 引入注册
21+
### 导入依赖
22+
在项目的`pom.xml`中引入依赖:
2223
```xml
2324
<dependency>
2425
<groupId>cn.licoy</groupId>
2526
<artifactId>encrypt-body-spring-boot-starter</artifactId>
26-
<version>1.1.0</version>
27+
<version>1.2.0</version>
2728
</dependency>
2829
```
29-
- 在工程对应的`Application`类中增加@EnableEncryptBody注解,例如:
30+
### 启用组件
31+
- 在工程对应的`Application`类中增加`@EnableEncryptBody`注解,如:
3032
```java
3133
@EnableEncryptBody
3234
@SpringBootApplication
@@ -38,45 +40,84 @@ public class Application {
3840

3941
}
4042
```
41-
- 参数配置
42-
在项目的`application.yml``application.properties`文件中进行参数配置,例如:
43+
### 配置参数
44+
在项目的`application.yml``application.properties`文件中增加参数配置,例如:
4345
```yaml
4446
encrypt:
4547
body:
4648
aes-key: 12345678 #AES加密秘钥
4749
des-key: 12345678 #DES加密秘钥
50+
# more...
4851
```
49-
- 对控制器响应体进行加密
52+
## 使用
53+
### 对整个控制器生效
5054
```java
51-
@Controller
55+
@RestController
56+
@EncryptBody
5257
@RequestMapping("/test")
5358
public class TestController {
5459

5560
@GetMapping
56-
@ResponseBody
57-
@EncryptBody(value = EncryptBodyMethod.AES)
5861
public String test(){
5962
return "hello world";
6063
}
6164

6265
}
6366
```
64-
或者使用`@RestController`对整个控制器的方法响应体都进行加密:
67+
### 对单一请求生效
6568
```java
66-
@RestController
67-
@EncryptBody
69+
@Controller
6870
@RequestMapping("/test")
6971
public class TestController {
7072

7173
@GetMapping
74+
@ResponseBody
75+
@EncryptBody(value = EncryptBodyMethod.AES)
7276
public String test(){
7377
return "hello world";
7478
}
7579

80+
}
81+
```
82+
### 对响应的声明类生效
83+
```java
84+
@Data
85+
@EncryptBody
86+
public class User implements Serializable {
87+
88+
private String name;
89+
90+
private String email;
91+
92+
private Integer number;
93+
94+
private String numberValue;
95+
96+
}
97+
```
98+
### 对声明类单一属性生效
99+
```java
100+
@Data
101+
@EncryptBody
102+
@FieldBody
103+
public class User implements Serializable {
104+
105+
private String name;
106+
107+
@FieldBody
108+
@AESEncryptBody(key = "1234567812345678")
109+
private String email;
110+
111+
@FieldBody(field = "numberValue", clearValue = true)
112+
@DESEncryptBody(key = "1234567812345678")
113+
private Integer number;
114+
115+
private String numberValue;
116+
76117
}
77118
```
78119
## 注解一览表
79-
- [加密注解一览表](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/加密注解一览表)
120+
- [编码/加密注解一览表](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/加密注解一览表)
80121
- [解密注解一览表](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/解密注解一览表)
81122
## 开源协议
82123
[Apache 2.0](/LICENSE)

README_EN.md

Lines changed: 81 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
[简体中文](./README.md) | English
2-
> This English document is translated by Google Translate. If you are willing to assist us with the documentation, please submit the relevant Pull Request.
3-
## Introduction
4-
`encrypt-body-spring-boot-starter` it is a unified processing method for response body encryption and request body decryption of SpringBoot controller, and supports MD5/SHA/AES/DES/RSA.
5-
6-
[![](https://img.shields.io/github/release/Licoy/encrypt-body-spring-boot-starter.svg)]()
7-
[![](https://img.shields.io/github/issues/Licoy/encrypt-body-spring-boot-starter.svg)]()
8-
[![](https://img.shields.io/github/issues-pr/Licoy/encrypt-body-spring-boot-starter.svg)]()
9-
[![](https://img.shields.io/badge/author-Licoy-ff69b4.svg)]()
10-
## Encryption and decryption support
11-
- There are ways to encrypt:
2+
## Introduce
3+
`encrypt-body-spring-boot-starter` is a unified annotation processing method for response body encoding/encryption and request body decryption for `springboot` controller, and supports MD5/SHA/AES/DES/RSA.
4+
5+
[![](https://img.shields.io/github/release/Licoy/encrypt-body-spring-boot-starter.svg)]()
6+
[![](https://img.shields.io/github/issues/Licoy/encrypt-body-spring-boot-starter.svg)]()
7+
[![](https://img.shields.io/github/issues-pr/Licoy/encrypt-body-spring-boot-starter.svg)]()
8+
[![](https://img.shields.io/badge/author-Licoy-ff69b4.svg)]()
9+
## Support
10+
- The ways in which encoding/encryption can be performed are:
1211
- - [x] MD5
13-
- - [x] SHA-1 / SHA-256
12+
- - [x] SHA-1/SHA-256
1413
- - [x] AES
1514
- - [x] DES
1615
- - [x] RSA
17-
- There are ways to decrypt:
16+
- The methods that can be decrypted are:
1817
- - [x] AES
1918
- - [x] DES
2019
- - [x] RSA
21-
## Usage method
22-
- Introducing dependencies in `pom.xml`
23-
```xml
20+
## Import registration
21+
### Import dependencies
22+
Introduce dependencies in the project's `pom.xml`:
23+
````xml
2424
<dependency>
2525
<groupId>cn.licoy</groupId>
2626
<artifactId>encrypt-body-spring-boot-starter</artifactId>
27-
<version>1.1.0</version>
27+
<version>1.2.0</version>
2828
</dependency>
29-
```
30-
- Add the @EnableEncryptBody annotation to the `Application` class corresponding to the project, for example:
31-
```java
29+
````
30+
### Enable component
31+
- Add the `@EnableEncryptBody` annotation to the `Application` class corresponding to the project, such as:
32+
````java
3233
@EnableEncryptBody
3334
@SpringBootApplication
3435
public class Application {
@@ -38,49 +39,85 @@ public class Application {
3839
}
3940

4041
}
41-
```
42-
- Parameter configuration
43-
Configure the parameters in the project's `application.yml` or `application.properties` file, for example:
44-
```yaml
45-
encrypt:
42+
````
43+
### Configuration parameters
44+
Add parameter configuration in the `application.yml` or `application.properties` file of the project, for example:
45+
````yaml
46+
encrypt:
4647
body:
4748
aes-key: 12345678 #AES encryption key
4849
des-key: 12345678 #DES encryption key
49-
```
50-
- Encrypt the controller response body
51-
```java
52-
@Controller
50+
# more...
51+
````
52+
## Use
53+
### Valid for the entire controller
54+
````java
55+
@RestController
56+
@EncryptBody
5357
@RequestMapping("/test")
5458
public class TestController {
5559

5660
@GetMapping
57-
@ResponseBody
58-
@EncryptBody(value = EncryptBodyMethod.AES)
5961
public String test(){
6062
return "hello world";
6163
}
6264

6365
}
64-
```
65-
Or use `@RestController` to encrypt the method response body of the entire controller:
66-
```java
67-
@RestController
68-
@EncryptBody
66+
````
67+
### Valid for a single request
68+
````java
69+
@Controller
6970
@RequestMapping("/test")
7071
public class TestController {
7172

7273
@GetMapping
74+
@ResponseBody
75+
@EncryptBody(value = EncryptBodyMethod.AES)
7376
public String test(){
7477
return "hello world";
7578
}
7679

7780
}
78-
```
79-
## Annotated list
80-
- [Encrypted annotation list](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/加密注解一览表)
81-
- [Decryption annotation list](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/解密注解一览表)
82-
## Discuss
83-
84-
- Author blog:[https://www.licoy.cn](https://www.licoy.cn)
85-
## Open source agreement
86-
[Apache 2.0](/LICENSE)
81+
````
82+
### Effective on the declared class of the response
83+
````java
84+
@Data
85+
@EncryptBody
86+
public class User implements Serializable {
87+
88+
private String name;
89+
90+
private String email;
91+
92+
private Integer number;
93+
94+
private String numberValue;
95+
96+
}
97+
````
98+
### Effective for a single attribute of the declared class
99+
````java
100+
@Data
101+
@EncryptBody
102+
@FieldBody
103+
public class User implements Serializable {
104+
105+
private String name;
106+
107+
@FieldBody
108+
@AESEncryptBody(key = "1234567812345678")
109+
private String email;
110+
111+
@FieldBody(field = "numberValue", clearValue = true)
112+
@DESEncryptBody(key = "1234567812345678")
113+
private Integer number;
114+
115+
private String numberValue;
116+
117+
}
118+
````
119+
## Annotation list
120+
- [Encryption/Encryption Annotation List](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/加密注解一览表)
121+
- [Decryption Annotation List](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/解密注解一览表)
122+
## License
123+
[Apache 2.0](/LICENSE)

pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>cn.licoy</groupId>
88
<artifactId>encrypt-body-spring-boot-starter</artifactId>
9-
<version>1.1.0</version>
9+
<version>1.2.0</version>
1010

1111
<name>encrypt-body-spring-boot-starter</name>
1212
<description>encrypt-body-spring-boot-starter是SpringBoot控制器统一的响应体加密与请求体解密的注解处理方式,支持MD5/SHA/AES/DES/RSA</description>
@@ -109,6 +109,9 @@
109109
<source>${java.version}</source>
110110
<target>${java.version}</target>
111111
<showWarnings>true</showWarnings>
112+
<excludes>
113+
<exclude>**/test/**</exclude>
114+
</excludes>
112115
</configuration>
113116
</plugin>
114117

0 commit comments

Comments
 (0)