Skip to content

Commit

Permalink
build: 发布1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed May 17, 2022
1 parent 49fafc8 commit 6f453d9
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 62 deletions.
75 changes: 58 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
简体中文 | [English](./README_EN.md)
## 介绍
`encrypt-body-spring-boot-starter`是对SpringBoot控制器统一的响应体加密与请求体解密的注解处理方式,支持MD5/SHA/AES/DES/RSA。
`encrypt-body-spring-boot-starter`是对`springboot`控制器统一的响应体编码/加密与请求体解密的注解处理方式,支持MD5/SHA/AES/DES/RSA。

[![](https://img.shields.io/github/release/Licoy/encrypt-body-spring-boot-starter.svg)]()
[![](https://img.shields.io/github/issues/Licoy/encrypt-body-spring-boot-starter.svg)]()
[![](https://img.shields.io/github/issues-pr/Licoy/encrypt-body-spring-boot-starter.svg)]()
[![](https://img.shields.io/badge/author-Licoy-ff69b4.svg)]()
## 加密解密支持
- 可进行加密的方式有
## 编码/加密解密支持
- 可进行编码/加密的方式有
- - [x] MD5
- - [x] SHA-1 / SHA-256
- - [x] AES
Expand All @@ -17,16 +17,18 @@
- - [x] AES
- - [x] DES
- - [x] RSA
## 使用方法
-`pom.xml`中引入依赖:
## 引入注册
### 导入依赖
在项目的`pom.xml`中引入依赖:
```xml
<dependency>
<groupId>cn.licoy</groupId>
<artifactId>encrypt-body-spring-boot-starter</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</dependency>
```
- 在工程对应的`Application`类中增加@EnableEncryptBody注解,例如:
### 启用组件
- 在工程对应的`Application`类中增加`@EnableEncryptBody`注解,如:
```java
@EnableEncryptBody
@SpringBootApplication
Expand All @@ -38,45 +40,84 @@ public class Application {

}
```
- 参数配置
在项目的`application.yml``application.properties`文件中进行参数配置,例如:
### 配置参数
在项目的`application.yml``application.properties`文件中增加参数配置,例如:
```yaml
encrypt:
body:
aes-key: 12345678 #AES加密秘钥
des-key: 12345678 #DES加密秘钥
# more...
```
- 对控制器响应体进行加密
## 使用
### 对整个控制器生效
```java
@Controller
@RestController
@EncryptBody
@RequestMapping("/test")
public class TestController {

@GetMapping
@ResponseBody
@EncryptBody(value = EncryptBodyMethod.AES)
public String test(){
return "hello world";
}

}
```
或者使用`@RestController`对整个控制器的方法响应体都进行加密:
### 对单一请求生效
```java
@RestController
@EncryptBody
@Controller
@RequestMapping("/test")
public class TestController {

@GetMapping
@ResponseBody
@EncryptBody(value = EncryptBodyMethod.AES)
public String test(){
return "hello world";
}

}
```
### 对响应的声明类生效
```java
@Data
@EncryptBody
public class User implements Serializable {

private String name;

private String email;

private Integer number;

private String numberValue;

}
```
### 对声明类单一属性生效
```java
@Data
@EncryptBody
@FieldBody
public class User implements Serializable {

private String name;

@FieldBody
@AESEncryptBody(key = "1234567812345678")
private String email;

@FieldBody(field = "numberValue", clearValue = true)
@DESEncryptBody(key = "1234567812345678")
private Integer number;

private String numberValue;

}
```
## 注解一览表
- [加密注解一览表](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/加密注解一览表)
- [编码/加密注解一览表](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/加密注解一览表)
- [解密注解一览表](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/解密注解一览表)
## 开源协议
[Apache 2.0](/LICENSE)
125 changes: 81 additions & 44 deletions README_EN.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
[简体中文](./README.md) | English
> This English document is translated by Google Translate. If you are willing to assist us with the documentation, please submit the relevant Pull Request.
## Introduction
`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.

[![](https://img.shields.io/github/release/Licoy/encrypt-body-spring-boot-starter.svg)]()
[![](https://img.shields.io/github/issues/Licoy/encrypt-body-spring-boot-starter.svg)]()
[![](https://img.shields.io/github/issues-pr/Licoy/encrypt-body-spring-boot-starter.svg)]()
[![](https://img.shields.io/badge/author-Licoy-ff69b4.svg)]()
## Encryption and decryption support
- There are ways to encrypt:
## Introduce
`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.

[![](https://img.shields.io/github/release/Licoy/encrypt-body-spring-boot-starter.svg)]()
[![](https://img.shields.io/github/issues/Licoy/encrypt-body-spring-boot-starter.svg)]()
[![](https://img.shields.io/github/issues-pr/Licoy/encrypt-body-spring-boot-starter.svg)]()
[![](https://img.shields.io/badge/author-Licoy-ff69b4.svg)]()
## Support
- The ways in which encoding/encryption can be performed are:
- - [x] MD5
- - [x] SHA-1 / SHA-256
- - [x] SHA-1/SHA-256
- - [x] AES
- - [x] DES
- - [x] RSA
- There are ways to decrypt:
- The methods that can be decrypted are:
- - [x] AES
- - [x] DES
- - [x] RSA
## Usage method
- Introducing dependencies in `pom.xml`
```xml
## Import registration
### Import dependencies
Introduce dependencies in the project's `pom.xml`:
````xml
<dependency>
<groupId>cn.licoy</groupId>
<artifactId>encrypt-body-spring-boot-starter</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</dependency>
```
- Add the @EnableEncryptBody annotation to the `Application` class corresponding to the project, for example:
```java
````
### Enable component
- Add the `@EnableEncryptBody` annotation to the `Application` class corresponding to the project, such as:
````java
@EnableEncryptBody
@SpringBootApplication
public class Application {
Expand All @@ -38,49 +39,85 @@ public class Application {
}

}
```
- Parameter configuration
Configure the parameters in the project's `application.yml` or `application.properties` file, for example:
```yaml
encrypt:
````
### Configuration parameters
Add parameter configuration in the `application.yml` or `application.properties` file of the project, for example:
````yaml
encrypt:
body:
aes-key: 12345678 #AES encryption key
des-key: 12345678 #DES encryption key
```
- Encrypt the controller response body
```java
@Controller
# more...
````
## Use
### Valid for the entire controller
````java
@RestController
@EncryptBody
@RequestMapping("/test")
public class TestController {

@GetMapping
@ResponseBody
@EncryptBody(value = EncryptBodyMethod.AES)
public String test(){
return "hello world";
}

}
```
Or use `@RestController` to encrypt the method response body of the entire controller:
```java
@RestController
@EncryptBody
````
### Valid for a single request
````java
@Controller
@RequestMapping("/test")
public class TestController {

@GetMapping
@ResponseBody
@EncryptBody(value = EncryptBodyMethod.AES)
public String test(){
return "hello world";
}

}
```
## Annotated list
- [Encrypted annotation list](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/加密注解一览表)
- [Decryption annotation list](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/解密注解一览表)
## Discuss

- Author blog:[https://www.licoy.cn](https://www.licoy.cn)
## Open source agreement
[Apache 2.0](/LICENSE)
````
### Effective on the declared class of the response
````java
@Data
@EncryptBody
public class User implements Serializable {

private String name;

private String email;

private Integer number;

private String numberValue;

}
````
### Effective for a single attribute of the declared class
````java
@Data
@EncryptBody
@FieldBody
public class User implements Serializable {

private String name;

@FieldBody
@AESEncryptBody(key = "1234567812345678")
private String email;

@FieldBody(field = "numberValue", clearValue = true)
@DESEncryptBody(key = "1234567812345678")
private Integer number;

private String numberValue;

}
````
## Annotation list
- [Encryption/Encryption Annotation List](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/加密注解一览表)
- [Decryption Annotation List](https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/解密注解一览表)
## License
[Apache 2.0](/LICENSE)
5 changes: 4 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>cn.licoy</groupId>
<artifactId>encrypt-body-spring-boot-starter</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>

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

Expand Down

0 comments on commit 6f453d9

Please sign in to comment.