You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/11/22 07:56:10 UTC
[shardingsphere] branch master updated: Update spring-namespace rules on encrypt document and spring-namespace test (#22337)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 494eb52595a Update spring-namespace rules on encrypt document and spring-namespace test (#22337)
494eb52595a is described below
commit 494eb52595ab99a5dbd6de9648231b6c0143849f
Author: gxxiong <xi...@foxmail.com>
AuthorDate: Tue Nov 22 15:56:04 2022 +0800
Update spring-namespace rules on encrypt document and spring-namespace test (#22337)
Signed-off-by: gxxiong <xi...@foxmail.com>
Signed-off-by: gxxiong <xi...@foxmail.com>
---
.../spring-namespace/rules/encrypt.cn.md | 40 ++++++++++++++--------
.../spring-namespace/rules/encrypt.en.md | 34 +++++++++++-------
.../spring-namespace/rules/mix.cn.md | 14 +++++---
.../spring-namespace/rules/mix.en.md | 14 +++++---
.../namespace/EncryptSpringNamespaceTest.java | 1 +
.../spring/encrypt-application-context.xml | 4 +--
6 files changed, 70 insertions(+), 37 deletions(-)
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/encrypt.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/encrypt.cn.md
index cf65283975e..2be7a90a79e 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/encrypt.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/encrypt.cn.md
@@ -14,10 +14,10 @@ weight = 4
\<encrypt:rule />
| *名称* | *类型* | *说明* | *默认值* |
-| ------------------------- | ----- | ---------------------------------------------------- | ------- |
-| id | 属性 | Spring Bean Id | |
-| queryWithCipherColumn (?) | 属性 | 是否使用加密列进行查询。在有原文列的情况下,可以使用原文列进行查询 | true |
-| table (+) | 标签 | 加密表配置 | |
+| ---------------------------- | ----- | ------------------------------------------------------ | ------- |
+| id | 属性 | Spring Bean Id | |
+| query-with-cipher-column (?) | 属性 | 是否使用加密列进行查询。在有原文列的情况下,可以使用原文列进行查询 | true |
+| table (+) | 标签 | 加密表配置 | |
\<encrypt:table />
@@ -29,13 +29,17 @@ weight = 4
\<encrypt:column />
-| *名称* | *类型* | *说明* |
-| ------------------------- | ----- | ----------- |
-| logic-column | 属性 | 加密列逻辑名称 |
-| cipher-column | 属性 | 加密列名称 |
-| assisted-query-column (?) | 属性 | 查询辅助列名称 |
-| plain-column (?) | 属性 | 原文列名称 |
-| encrypt-algorithm-ref | 属性 | 加密算法名称 |
+| *名称* | *类型* | *说明* |
+| ------------------------------------ | ----- | -------------------- |
+| logic-column | 属性 | 加密列逻辑名称 |
+| cipher-column | 属性 | 加密列名称 |
+| assisted-query-column (?) | 属性 | 查询辅助列名称 |
+| like-query-column (?) | 属性 | 查询辅助列名称 |
+| plain-column (?) | 属性 | 原文列名称 |
+| encrypt-algorithm-ref | 属性 | 密文列加密算法名称 |
+| assisted-query-encrypt-algorithm-ref | 属性 | 辅助查询列加密算法名称 |
+| like-query-encrypt-algorithm-ref | 属性 | 模糊查询列加密算法名称 |
+| query-with-cipher-column(?) | 属性 | 该列是否使用加密列进行查询 |
\<encrypt:encrypt-algorithm />
@@ -86,12 +90,18 @@ weight = 4
<prop key="aes-key-value">123456</prop>
</props>
</encrypt:encrypt-algorithm>
- <encrypt:encrypt-algorithm id="pwd_encryptor" type="assistedTest" />
+ <encrypt:encrypt-algorithm id="pwd_encryptor" type="MD5" />
+ <encrypt:encrypt-algorithm id="pwd_assisted_encryptor" type="AES">
+ <props>
+ <prop key="aes-key-value">123456</prop>
+ </props>
+ </encrypt:encrypt-algorithm>
+ <encrypt:encrypt-algorithm id="like_query_encryptor" type="CHAR_DIGEST_LIKE" />
<encrypt:rule id="encryptRule">
- <encrypt:table name="t_user">
- <encrypt:column logic-column="username" cipher-column="username" plain-column="username_plain" encrypt-algorithm-ref="name_encryptor" />
- <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" encrypt-algorithm-ref="pwd_encryptor" />
+ <encrypt:table name="t_user" query-with-cipher-column="false">
+ <encrypt:column logic-column="username" cipher-column="username" plain-column="username_plain" encrypt-algorithm-ref="name_encryptor" query-with-cipher-column="true"/>
+ <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" like-query-column="like_query_pwd" encrypt-algorithm-ref="pwd_encryptor" assisted-query-encrypt-algorithm-ref="pwd_assisted_encryptor" like-query-encrypt-algorithm-ref="like_query_encryptor" query-with-cipher-column="true" />
</encrypt:table>
</encrypt:rule>
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/encrypt.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/encrypt.en.md
index d16fb781e98..247bedc0837 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/encrypt.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/encrypt.en.md
@@ -16,7 +16,7 @@ Namespace: [http://shardingsphere.apache.org/schema/shardingsphere/encrypt/encry
| *Name* | *Type* | *Description* | *Default Value* |
| ------------------------- | --------- | ---------------------------------------------------------------------------------------------- | --------------- |
| id | Attribute | Spring Bean Id | |
-| queryWithCipherColumn (?) | Attribute | Whether query with cipher column for data encrypt. User you can use plaintext to query if have | true |
+| uery-with-cipher-column (?) | Attribute | Whether query with cipher column for data encrypt. User you can use plaintext to query if have | true |
| table (+) | Tag | Encrypt table configuration | |
\<encrypt:table />
@@ -29,13 +29,17 @@ Namespace: [http://shardingsphere.apache.org/schema/shardingsphere/encrypt/encry
\<encrypt:column />
-| *Name* | *Type* | *Description* |
-| ------------------------- | ---------- | -------------------------- |
-| logic-column | Attribute | Column logic name |
-| cipher-column | Attribute | Cipher column name |
-| assisted-query-column (?) | Attribute | Assisted query column name |
-| plain-column (?) | Attribute | Plain column name |
-| encrypt-algorithm-ref | Attribute | Encrypt algorithm name |
+| *Name* | *Type* | *Description* |
+| ------------------------------------ | --------- | -------------------------------------------------------------------- |
+| logic-column | Attribute | Column logic name |
+| cipher-column | Attribute | Cipher column name |
+| assisted-query-column (?) | Attribute | Assisted query column name |
+| like-query-column (?) | Attribute | Like query column name |
+| plain-column (?) | Attribute | Plain column name |
+| encrypt-algorithm-ref | Attribute | Cipher encrypt algorithm name |
+| assisted-query-encrypt-algorithm-ref | Attribute | Assisted query encrypt algorithm name |
+| like-query-encrypt-algorithm-ref | Attribute | Like query encrypt algorithm name |
+| query-with-cipher-column(?) | Attribute | The current column whether query with cipher column for data encrypt |
\<encrypt:encrypt-algorithm />
@@ -86,12 +90,18 @@ Please refer to [Built-in Encrypt Algorithm List](/en/user-manual/common-config/
<prop key="aes-key-value">123456</prop>
</props>
</encrypt:encrypt-algorithm>
- <encrypt:encrypt-algorithm id="pwd_encryptor" type="assistedTest" />
+ <encrypt:encrypt-algorithm id="pwd_encryptor" type="MD5" />
+ <encrypt:encrypt-algorithm id="pwd_assisted_encryptor" type="AES">
+ <props>
+ <prop key="aes-key-value">123456</prop>
+ </props>
+ </encrypt:encrypt-algorithm>
+ <encrypt:encrypt-algorithm id="like_query_encryptor" type="CHAR_DIGEST_LIKE" />
<encrypt:rule id="encryptRule">
- <encrypt:table name="t_user">
- <encrypt:column logic-column="username" cipher-column="username" plain-column="username_plain" encrypt-algorithm-ref="name_encryptor" />
- <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" encrypt-algorithm-ref="pwd_encryptor" />
+ <encrypt:table name="t_user" query-with-cipher-column="false">
+ <encrypt:column logic-column="username" cipher-column="username" plain-column="username_plain" encrypt-algorithm-ref="name_encryptor" query-with-cipher-column="true"/>
+ <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" like-query-column="like_query_pwd" encrypt-algorithm-ref="pwd_encryptor" assisted-query-encrypt-algorithm-ref="pwd_assisted_encryptor" like-query-encrypt-algorithm-ref="like_query_encryptor" query-with-cipher-column="true" />
</encrypt:table>
</encrypt:rule>
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/mix.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/mix.cn.md
index 3f16539c0d3..aed2b9065e4 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/mix.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/mix.cn.md
@@ -58,12 +58,18 @@ ShardingSphere 涵盖了很多功能,例如,分库分片、读写分离、
<prop key="aes-key-value">123456</prop>
</props>
</encrypt:encrypt-algorithm>
-<encrypt:encrypt-algorithm id="pwd_encryptor" type="assistedTest" />
+<encrypt:encrypt-algorithm id="pwd_encryptor" type="MD5" />
+<encrypt:encrypt-algorithm id="pwd_assisted_encryptor" type="AES">
+ <props>
+ <prop key="aes-key-value">123456</prop>
+ </props>
+</encrypt:encrypt-algorithm>
+<encrypt:encrypt-algorithm id="like_query_encryptor" type="CHAR_DIGEST_LIKE" />
<encrypt:rule id="encryptRule">
- <encrypt:table name="t_user">
- <encrypt:column logic-column="username" cipher-column="username" plain-column="username_plain" encrypt-algorithm-ref="name_encryptor" />
- <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" encrypt-algorithm-ref="pwd_encryptor" />
+ <encrypt:table name="t_user" query-with-cipher-column="false">
+ <encrypt:column logic-column="username" cipher-column="username" plain-column="username_plain" encrypt-algorithm-ref="name_encryptor" query-with-cipher-column="true"/>
+ <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" like-query-column="like_query_pwd" encrypt-algorithm-ref="pwd_encryptor" assisted-query-encrypt-algorithm-ref="pwd_assisted_encryptor" like-query-encrypt-algorithm-ref="like_query_encryptor" query-with-cipher-column="true" />
</encrypt:table>
</encrypt:rule>
```
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/mix.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/mix.en.md
index 537b3d17c78..5931dbfa19c 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/mix.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/mix.en.md
@@ -60,12 +60,18 @@ Below, you will find the configuration samples based on Spring Namespace.
<prop key="aes-key-value">123456</prop>
</props>
</encrypt:encrypt-algorithm>
-<encrypt:encrypt-algorithm id="pwd_encryptor" type="assistedTest" />
+<encrypt:encrypt-algorithm id="pwd_encryptor" type="MD5" />
+<encrypt:encrypt-algorithm id="pwd_assisted_encryptor" type="AES">
+ <props>
+ <prop key="aes-key-value">123456</prop>
+ </props>
+</encrypt:encrypt-algorithm>
+<encrypt:encrypt-algorithm id="like_query_encryptor" type="CHAR_DIGEST_LIKE" />
<encrypt:rule id="encryptRule">
- <encrypt:table name="t_user">
- <encrypt:column logic-column="username" cipher-column="username" plain-column="username_plain" encrypt-algorithm-ref="name_encryptor" />
- <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" encrypt-algorithm-ref="pwd_encryptor" />
+ <encrypt:table name="t_user" query-with-cipher-column="false">
+ <encrypt:column logic-column="username" cipher-column="username" plain-column="username_plain" encrypt-algorithm-ref="name_encryptor" query-with-cipher-column="true"/>
+ <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" like-query-column="like_query_pwd" encrypt-algorithm-ref="pwd_encryptor" assisted-query-encrypt-algorithm-ref="pwd_assisted_encryptor" like-query-encrypt-algorithm-ref="like_query_encryptor" query-with-cipher-column="true" />
</encrypt:table>
</encrypt:rule>
```
diff --git a/features/encrypt/spring/spring-namespace/src/test/java/org/apache/shardingsphere/encrypt/spring/namespace/EncryptSpringNamespaceTest.java b/features/encrypt/spring/spring-namespace/src/test/java/org/apache/shardingsphere/encrypt/spring/namespace/EncryptSpringNamespaceTest.java
index 9ec4aecbc8c..3d39ebab57a 100644
--- a/features/encrypt/spring/spring-namespace/src/test/java/org/apache/shardingsphere/encrypt/spring/namespace/EncryptSpringNamespaceTest.java
+++ b/features/encrypt/spring/spring-namespace/src/test/java/org/apache/shardingsphere/encrypt/spring/namespace/EncryptSpringNamespaceTest.java
@@ -106,6 +106,7 @@ public final class EncryptSpringNamespaceTest extends AbstractJUnit4SpringContex
assertThat(columnRuleConfig.getLikeQueryColumn(), is("credit_card_like_query"));
assertThat(columnRuleConfig.getPlainColumn(), is("credit_card_plain"));
assertThat(columnRuleConfig.getEncryptorName(), is("md5Encryptor"));
+ assertThat(columnRuleConfig.getAssistedQueryEncryptorName(), is("aesEncryptor"));
assertThat(columnRuleConfig.getLikeQueryEncryptorName(), is("likeQueryEncryptor"));
assertFalse(columnRuleConfig.getQueryWithCipherColumn());
}
diff --git a/features/encrypt/spring/spring-namespace/src/test/resources/META-INF/spring/encrypt-application-context.xml b/features/encrypt/spring/spring-namespace/src/test/resources/META-INF/spring/encrypt-application-context.xml
index f929747ac0c..2a897bab5f4 100644
--- a/features/encrypt/spring/spring-namespace/src/test/resources/META-INF/spring/encrypt-application-context.xml
+++ b/features/encrypt/spring/spring-namespace/src/test/resources/META-INF/spring/encrypt-application-context.xml
@@ -37,10 +37,10 @@
<encrypt:encrypt-algorithm id="md5Encryptor" type="MD5" />
<encrypt:encrypt-algorithm id="likeQueryEncryptor" type="CHAR_DIGEST_LIKE" />
- <encrypt:rule id="encryptRule">
+ <encrypt:rule id="encryptRule" query-with-cipher-column="false">
<encrypt:table name="t_order" query-with-cipher-column="false">
<encrypt:column logic-column="pwd" cipher-column="pwd_cipher" encrypt-algorithm-ref="aesEncryptor" query-with-cipher-column="true" />
- <encrypt:column logic-column="credit_card" cipher-column="credit_card_cipher" like-query-column="credit_card_like_query" plain-column="credit_card_plain" encrypt-algorithm-ref="md5Encryptor" like-query-encrypt-algorithm-ref="likeQueryEncryptor" query-with-cipher-column="false" />
+ <encrypt:column logic-column="credit_card" cipher-column="credit_card_cipher" like-query-column="credit_card_like_query" plain-column="credit_card_plain" encrypt-algorithm-ref="md5Encryptor" assisted-query-encrypt-algorithm-ref="aesEncryptor" like-query-encrypt-algorithm-ref="likeQueryEncryptor" query-with-cipher-column="false" />
</encrypt:table>
</encrypt:rule>
</beans>