Loading sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/local/LocalEncryptConfiguration.java +14 −5 Original line number Diff line number Diff line Loading @@ -17,8 +17,10 @@ package org.apache.shardingsphere.example.orchestration.raw.jdbc.config.local; import org.apache.shardingsphere.api.config.encryptor.EncryptRuleConfiguration; import org.apache.shardingsphere.api.config.encryptor.EncryptorRuleConfiguration; import org.apache.shardingsphere.api.config.encrypt.EncryptColumnRuleConfiguration; import org.apache.shardingsphere.api.config.encrypt.EncryptRuleConfiguration; import org.apache.shardingsphere.api.config.encrypt.EncryptTableRuleConfiguration; import org.apache.shardingsphere.api.config.encrypt.EncryptorRuleConfiguration; import org.apache.shardingsphere.example.common.DataSourceUtil; import org.apache.shardingsphere.example.config.ExampleConfiguration; import org.apache.shardingsphere.orchestration.config.OrchestrationConfiguration; Loading @@ -27,6 +29,8 @@ import org.apache.shardingsphere.shardingjdbc.orchestration.api.OrchestrationEnc import javax.sql.DataSource; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import java.util.Properties; public class LocalEncryptConfiguration implements ExampleConfiguration { Loading @@ -40,7 +44,6 @@ public class LocalEncryptConfiguration implements ExampleConfiguration { @Override public DataSource getDataSource() throws SQLException { return OrchestrationEncryptDataSourceFactory.createDataSource(DataSourceUtil.createDataSource("demo_ds"), getEncryptRuleConfiguration(), new Properties(), getOrchestrationConfiguration()); } private OrchestrationConfiguration getOrchestrationConfiguration() { Loading @@ -51,8 +54,14 @@ public class LocalEncryptConfiguration implements ExampleConfiguration { EncryptRuleConfiguration result = new EncryptRuleConfiguration(); Properties properties = new Properties(); properties.setProperty("aes.key.value", "123456"); EncryptorRuleConfiguration encryptorRuleConfig = new EncryptorRuleConfiguration("aes", "t_order.status", properties); result.getEncryptorRuleConfigs().put("order_encryptor", encryptorRuleConfig); EncryptorRuleConfiguration aesRuleConfiguration = new EncryptorRuleConfiguration("aes", properties); EncryptColumnRuleConfiguration columnConfigAes = new EncryptColumnRuleConfiguration("", "status", "", "status_encryptor"); Map<String, EncryptColumnRuleConfiguration> columns = new HashMap<>(); EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration(columns); columns.put("status", columnConfigAes); tableConfig.getColumns().putAll(columns); result.getEncryptors().put("status_encryptor", aesRuleConfiguration); result.getTables().put("t_order", tableConfig); return result; } } sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml +8 −2 Original line number Diff line number Diff line Loading @@ -14,11 +14,17 @@ dataSource: !!com.zaxxer.hikari.HikariDataSource encryptRule: encryptors: order_encryptor: status_encryptor: type: aes qualifiedColumns: t_order.status props: aes.key.value: 123456 tables: t_order: columns: status: cipherColumn: status encryptor: status_encryptor props: query.with.cipher.column: true sql.show: true No newline at end of file sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application-local-zookeeper-encrypt.properties +5 −3 Original line number Diff line number Diff line Loading @@ -23,10 +23,12 @@ spring.shardingsphere.datasource.ds_encrypt.jdbc-url=jdbc:mysql://localhost:3306 spring.shardingsphere.datasource.ds_encrypt.username=root spring.shardingsphere.datasource.ds_encrypt.password= spring.shardingsphere.encrypt.encryptors.order_encryptor.type=AES spring.shardingsphere.encrypt.encryptors.order_encryptor.qualified-columns=t_order.status spring.shardingsphere.encrypt.encryptors.order_encryptor.props.aes.key.value=123456 spring.shardingsphere.encrypt.encryptors.status_encryptor.type=aes spring.shardingsphere.encrypt.encryptors.status_encryptor.props.aes.key.value=123456 spring.shardingsphere.encrypt.tables.t_order.columns.status.cipherColumn=status spring.shardingsphere.encrypt.tables.t_order.columns.status.encryptor=status_encryptor spring.shardingsphere.props.query.with.cipher.comlum=true spring.shardingsphere.props.sql.show=true spring.shardingsphere.orchestration.name=demo_spring_boot_ds_encrypt Loading sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/zookeeper/local/application-encrypt.xml +15 −2 Original line number Diff line number Diff line Loading @@ -50,8 +50,21 @@ </bean:properties> <encrypt:data-source id="realEncryptDataSource" data-source-name="demo_ds_encrypt" > <encrypt:encryptor-rule id="pwd_encryptor" type="assistedTest" qualified-columns="t_user.pwd" assisted-query-columns="t_user.assisted_query_pwd" /> <encrypt:encryptor-rule id="name_encryptor" type="AES" qualified-columns="t_user.user_name" props-ref="props" /> <encrypt:encrypt-rule> <encrypt:tables> <encrypt:table name="t_user"> <encrypt:column logic-column="user_name" cipher-column="user_name" encryptor-ref="name_encryptor" /> <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" encryptor-ref="pwd_encryptor"/> </encrypt:table> </encrypt:tables> <encrypt:encryptors> <encrypt:encryptor id="name_encryptor" type="AES" props-ref="props"/> <encrypt:encryptor id="pwd_encryptor" type="assistedTest" /> </encrypt:encryptors> </encrypt:encrypt-rule> <encrypt:props> <prop key="query.with.cipher.column">true</prop> </encrypt:props> </encrypt:data-source> <orchestraion:encrypt-data-source id="encryptDataSource" data-source-ref="realEncryptDataSource" registry-center-ref="regCenter" overwrite="true" /> Loading Loading
sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/local/LocalEncryptConfiguration.java +14 −5 Original line number Diff line number Diff line Loading @@ -17,8 +17,10 @@ package org.apache.shardingsphere.example.orchestration.raw.jdbc.config.local; import org.apache.shardingsphere.api.config.encryptor.EncryptRuleConfiguration; import org.apache.shardingsphere.api.config.encryptor.EncryptorRuleConfiguration; import org.apache.shardingsphere.api.config.encrypt.EncryptColumnRuleConfiguration; import org.apache.shardingsphere.api.config.encrypt.EncryptRuleConfiguration; import org.apache.shardingsphere.api.config.encrypt.EncryptTableRuleConfiguration; import org.apache.shardingsphere.api.config.encrypt.EncryptorRuleConfiguration; import org.apache.shardingsphere.example.common.DataSourceUtil; import org.apache.shardingsphere.example.config.ExampleConfiguration; import org.apache.shardingsphere.orchestration.config.OrchestrationConfiguration; Loading @@ -27,6 +29,8 @@ import org.apache.shardingsphere.shardingjdbc.orchestration.api.OrchestrationEnc import javax.sql.DataSource; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import java.util.Properties; public class LocalEncryptConfiguration implements ExampleConfiguration { Loading @@ -40,7 +44,6 @@ public class LocalEncryptConfiguration implements ExampleConfiguration { @Override public DataSource getDataSource() throws SQLException { return OrchestrationEncryptDataSourceFactory.createDataSource(DataSourceUtil.createDataSource("demo_ds"), getEncryptRuleConfiguration(), new Properties(), getOrchestrationConfiguration()); } private OrchestrationConfiguration getOrchestrationConfiguration() { Loading @@ -51,8 +54,14 @@ public class LocalEncryptConfiguration implements ExampleConfiguration { EncryptRuleConfiguration result = new EncryptRuleConfiguration(); Properties properties = new Properties(); properties.setProperty("aes.key.value", "123456"); EncryptorRuleConfiguration encryptorRuleConfig = new EncryptorRuleConfiguration("aes", "t_order.status", properties); result.getEncryptorRuleConfigs().put("order_encryptor", encryptorRuleConfig); EncryptorRuleConfiguration aesRuleConfiguration = new EncryptorRuleConfiguration("aes", properties); EncryptColumnRuleConfiguration columnConfigAes = new EncryptColumnRuleConfiguration("", "status", "", "status_encryptor"); Map<String, EncryptColumnRuleConfiguration> columns = new HashMap<>(); EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration(columns); columns.put("status", columnConfigAes); tableConfig.getColumns().putAll(columns); result.getEncryptors().put("status_encryptor", aesRuleConfiguration); result.getTables().put("t_order", tableConfig); return result; } }
sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml +8 −2 Original line number Diff line number Diff line Loading @@ -14,11 +14,17 @@ dataSource: !!com.zaxxer.hikari.HikariDataSource encryptRule: encryptors: order_encryptor: status_encryptor: type: aes qualifiedColumns: t_order.status props: aes.key.value: 123456 tables: t_order: columns: status: cipherColumn: status encryptor: status_encryptor props: query.with.cipher.column: true sql.show: true No newline at end of file
sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application-local-zookeeper-encrypt.properties +5 −3 Original line number Diff line number Diff line Loading @@ -23,10 +23,12 @@ spring.shardingsphere.datasource.ds_encrypt.jdbc-url=jdbc:mysql://localhost:3306 spring.shardingsphere.datasource.ds_encrypt.username=root spring.shardingsphere.datasource.ds_encrypt.password= spring.shardingsphere.encrypt.encryptors.order_encryptor.type=AES spring.shardingsphere.encrypt.encryptors.order_encryptor.qualified-columns=t_order.status spring.shardingsphere.encrypt.encryptors.order_encryptor.props.aes.key.value=123456 spring.shardingsphere.encrypt.encryptors.status_encryptor.type=aes spring.shardingsphere.encrypt.encryptors.status_encryptor.props.aes.key.value=123456 spring.shardingsphere.encrypt.tables.t_order.columns.status.cipherColumn=status spring.shardingsphere.encrypt.tables.t_order.columns.status.encryptor=status_encryptor spring.shardingsphere.props.query.with.cipher.comlum=true spring.shardingsphere.props.sql.show=true spring.shardingsphere.orchestration.name=demo_spring_boot_ds_encrypt Loading
sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/zookeeper/local/application-encrypt.xml +15 −2 Original line number Diff line number Diff line Loading @@ -50,8 +50,21 @@ </bean:properties> <encrypt:data-source id="realEncryptDataSource" data-source-name="demo_ds_encrypt" > <encrypt:encryptor-rule id="pwd_encryptor" type="assistedTest" qualified-columns="t_user.pwd" assisted-query-columns="t_user.assisted_query_pwd" /> <encrypt:encryptor-rule id="name_encryptor" type="AES" qualified-columns="t_user.user_name" props-ref="props" /> <encrypt:encrypt-rule> <encrypt:tables> <encrypt:table name="t_user"> <encrypt:column logic-column="user_name" cipher-column="user_name" encryptor-ref="name_encryptor" /> <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" encryptor-ref="pwd_encryptor"/> </encrypt:table> </encrypt:tables> <encrypt:encryptors> <encrypt:encryptor id="name_encryptor" type="AES" props-ref="props"/> <encrypt:encryptor id="pwd_encryptor" type="assistedTest" /> </encrypt:encryptors> </encrypt:encrypt-rule> <encrypt:props> <prop key="query.with.cipher.column">true</prop> </encrypt:props> </encrypt:data-source> <orchestraion:encrypt-data-source id="encryptDataSource" data-source-ref="realEncryptDataSource" registry-center-ref="regCenter" overwrite="true" /> Loading