This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu-website.git


The following commit(s) were added to refs/heads/main by this push:
     new b7be594  add cryptor plugin (#288)
b7be594 is described below

commit b7be59487b8d67188248339155d92dba1b32ef66
Author: Sinsy <[email protected]>
AuthorDate: Wed Sep 22 18:37:06 2021 +0800

    add cryptor plugin (#288)
    
    * add cryptor plugin
    
    * add cryptor plugin zh
    
    * remove 2.4 of cryptor plugin
---
 .../cryptor-request-plugin.md                      |  60 +++++++++++
 .../cryptor-response-plugin.md                     |  60 +++++++++++
 .../authority-and-certification/cryptor-plugin.md  | 119 ---------------------
 3 files changed, 120 insertions(+), 119 deletions(-)

diff --git 
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/authority-and-certification/cryptor-request-plugin.md
 
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/authority-and-certification/cryptor-request-plugin.md
new file mode 100644
index 0000000..dbcc77c
--- /dev/null
+++ 
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/authority-and-certification/cryptor-request-plugin.md
@@ -0,0 +1,60 @@
+---
+title: CryptorRequest 插件
+keywords: ["CryptorRequest"]
+description: CryptorRequest 插件
+---
+
+## 说明
+
+* `cryptorRequest` 插件是通过 `fieldNames` 去匹配 `requestBody` 里面的参数进行 `解密` 处理,替换当前 
`requestBody` 内容。
+
+## 插件设置
+
+1. 在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `cryptor_request` 设置为开启。
+
+<img src="/img/shenyu/plugin/cryptor/enable-plugin.png" width="80%" 
height="80%" />
+
+2. 打开 `selector` 配置需要匹配的流量。
+
+3. 打开 `selector` 对应的 `Rules` 配置。
+
+  <img src="/img/shenyu/plugin/cryptor/cryptor-request-rules-config.png" 
width="80%" height="80%" />
+
+* strategyName: 解密算法名称。当前基于 shenyu 的 SPI 机制,可自定义加解密算法,
+  需要实现 `org.apache.shenyu.plugin.cryptor.strategy.CryptorStrategy` 接口。
+
+  同时找到 `resources/META-INF/shenyu/` 底下的 
`org.apache.shenyu.plugin.cryptor.strategy.CryptorStrategy` 文件,
+  写上算法名称以及实现的 `CryptorStrategy` 接口的 class 的包名。
+
+* fieldNames: 匹配的参数名,支持解析多层次的 json 格式匹配,使用 `.` 分割,例如 data.id 。
+
+```json5
+        {
+          data: {
+            "id": ""
+          }  
+        }
+```
+
+* key: 秘钥,用于解密数据。
+
+## 插件使用
+
+* 在网关的 `pom.xml` 文件中添加 `cryptorRequest` 的支持。
+
+```xml
+        <!-- apache shenyu Cryptor Request plugin start-->
+<dependency>
+  <groupId>org.apache.shenyu</groupId>
+  <artifactId>shenyu-spring-boot-starter-plugin-cryptor</artifactId>
+  <version>${project.version}</version>
+</dependency>
+        <!-- apache shenyu Cryptor Request plugin end-->
+```
+
+## 场景
+
+防互联网黑产,恶意获取数据。提高数据安全性。
+
+
+
diff --git 
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/authority-and-certification/cryptor-response-plugin.md
 
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/authority-and-certification/cryptor-response-plugin.md
new file mode 100644
index 0000000..d6459e0
--- /dev/null
+++ 
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/authority-and-certification/cryptor-response-plugin.md
@@ -0,0 +1,60 @@
+---
+title: CryptorResponse 插件
+keywords: ["CryptorResponse"]
+description: CryptorResponse 插件
+---
+
+## 说明
+
+* `CryptorResponse` 插件是通过 `fieldNames` 去匹配 `responseBody` 里面的参数进行 `加密` 处理,替换当前 
`fieldNames` 对应内容。
+
+## 插件设置
+
+1. 在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `cryptor_response` 设置为开启。
+
+<img src="/img/shenyu/plugin/cryptor/enable-cryptor-response-plugin.png" 
width="80%" height="80%" />
+
+2. 打开 `selector` 配置需要匹配的流量。
+
+3. 打开 `selector` 对应的 `Rules` 配置。
+
+<img src="/img/shenyu/plugin/cryptor/cryptor-response-rules-config.png" 
width="80%" height="80%" />
+
+* strategyName: 解密算法名称。当前基于 shenyu 的 SPI 机制,可自定义加解密算法,
+  需要实现 `org.apache.shenyu.plugin.cryptor.strategy.CryptorStrategy` 接口。
+
+  同时找到 `resources/META-INF/shenyu/` 底下的 
`org.apache.shenyu.plugin.cryptor.strategy.CryptorStrategy` 文件,
+  写上算法名称以及实现的 `CryptorStrategy` 接口的 class 的包名。
+
+* fieldNames: 匹配的参数名,支持解析多层次的 json 格式匹配,使用 `.` 分割,例如 data.id 。
+
+```json5
+        {
+          data: {
+            "id": ""
+          }  
+        }
+```
+
+* key: 秘钥,用于加密数据。
+
+## 插件使用
+
+* 在网关的 `pom.xml` 文件中添加 `cryptorResponse` 的支持。
+
+```xml
+        <!-- apache shenyu Cryptor Response plugin start-->
+<dependency>
+  <groupId>org.apache.shenyu</groupId>
+  <artifactId>shenyu-spring-boot-starter-plugin-cryptor</artifactId>
+  <version>${project.version}</version>
+</dependency>
+        <!-- apache shenyu Cryptor Response plugin end-->
+```
+
+## 场景
+
+防互联网黑产,恶意获取数据。提高数据安全性。
+
+
+
diff --git 
a/i18n/zh/docusaurus-plugin-content-docs/version-2.4.0/plugin-center/authority-and-certification/cryptor-plugin.md
 
b/i18n/zh/docusaurus-plugin-content-docs/version-2.4.0/plugin-center/authority-and-certification/cryptor-plugin.md
deleted file mode 100644
index f2c0385..0000000
--- 
a/i18n/zh/docusaurus-plugin-content-docs/version-2.4.0/plugin-center/authority-and-certification/cryptor-plugin.md
+++ /dev/null
@@ -1,119 +0,0 @@
----
-
-title: Cryptor 插件
-keywords: ["Cryptor","CryptorRequest","CryptorResponse"]
-description: Cryptor 插件
-----------------
-
-## 说明
-
-* `Cryptor` 插件,由两个插件组合而成,分别是 `CryptorRequest plugin` 针对 `Request` 进来的加密报文进行 
`解密` 处理,另一个 `CryptorResponse plugin` 针对 `Response` 返回的报文进行 `加密` 
处理返回出去。由于是组合在一起的插件,两者可以独立启动,不影响其中一个。
-
-## 插件设置
-
-请参考运维部署的内容,选择一种方式启动`shenyu-admin`。比如,通过 
[本地部署](../../deployment/deployment-local) 启动`Apache ShenYu`后台管理系统。
-
-* 在 `shenyu-admin` 基础配置 --> 插件管理 --> `cryptor_request` 、`cryptor_response` 
,设置为开启。如果用户不想使用此功能,请在 `admin` 后台停用此插件。
-
-## 在网关中引入 Cryptor 插件
-
-* 在网关的 `pom.xml` 文件中添加 `cryptor` 的依赖。
-
-```xml
-  <!-- Apache ShenYu cryptor plugin start-->
-  <dependency>
-      <groupId>org.apache.shenyu</groupId>
-      <artifactId>shenyu-spring-boot-starter-plugin-cryptor</artifactId>
-      <version>${project.version}</version>
-  </dependency>
-  <!-- Apache ShenYu cryptor plugin end-->
-```
-
-## Cryptor 插件配置
-
-关于选择器和规则配置的更多说明,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule),
 这里只对部分字段进行了介绍。
-
-当前是匹配需要加解密的 API 路径进行操作,即这些配置是在 `rule` 当中。
-
-#### strategyName
-
-加解密的算法策略,当前是基于 SPI 机制制作,允许使用者 `自定义` 加解密算法策略,只需要实现 
`org.apache.shenyu.plugin.cryptor.strategy.CryptorStrategy` 该接口。
-
-具体操作:
-
-```java
-@Join
-public class ${you class} implements CryptorStrategy {
-
-    /**
-     * 解密.
-     * @param key 密钥
-     * @param encryptData 加密报文
-     * @return data
-     * @throws Exception error
-     */
-    @Override
-    public String decrypt(final String key, final String encryptData) throws 
Exception {
-        // 逻辑处理
-    }
-    
-    /**
-     * 加密.
-     * @param key 密钥
-     * @param data 数据
-     * @return 加密报文.
-     * @throws Exception error
-     */
-    @Override
-    public String encrypt(final String key, final String data) throws 
Exception {
-        // 逻辑处理
-    }
-}
-```
-
-找到 `shenyu-plugin-cryptor` 模块底下的 resources 文件夹 META-INF.shenyu 的 
org.apache.shenyu.plugin.cryptor.strategy.CryptorStrategy 
-写上对应的名称以及刚刚实现的 class 包名。
-
-接着执行
-
-```sql
-INSERT IGNORE INTO `shenyu_dict` (
-`id`, 
-`type`,
-`dict_code`, 
-`dict_name`, 
-`dict_value`, 
-`desc`, 
-`sort`, 
-`enabled`, 
-`date_created`, 
-`date_updated`) 
-VALUES (
-'id', 
-'strategyName', 
-'STRATEGY_NAME', 
-'SPI 实现的名称', 
-'SPI 实现的名称', 
-'SPI 实现的名称 strategy', 
-1, 
-1, 
-'2021-08-25 11:47:29', 
-'2021-08-25 11:48:03');
-```
-
-#### fieldNames
-
-针对 `RequestBody` 以及 `ResponseBody` 的 key ,进行加解密。
-
-#### key
-
-密钥。
-
-## 注意
-
-当前针对的是有写 body 的请求做处理,且没有组合加解密等效果。
-
-## 场景
-
-* 需要防范互联网黑产。
- 

Reply via email to