Merge branch 'feature#55' of https://github.com/waterWang/datax-web into feature#54

This commit is contained in:
water 2020-03-19 19:58:31 +08:00
commit 56ca50a6e1
3 changed files with 52 additions and 52 deletions

View File

@ -104,11 +104,11 @@
</dependency>
<!-- 数据库加密 -->
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.github.ulisesbocchio</groupId>-->
<!--<artifactId>jasypt-spring-boot-starter</artifactId>-->
<!--<version>2.0.0</version>-->
<!--</dependency>-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>

View File

@ -1,42 +1,42 @@
package com.wugui.datax.admin.util;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.EnvironmentPBEConfig;
public class JasyptUtil {
final String algorithm = "PBEWithMD5AndDES";// 加密的算法这个算法是默认的
final String password = "hVO0O2NeySpANQUk"; // 加密的密钥 配置文件中 jasypt.encryptor.password
StandardPBEStringEncryptor standardPBEStringEncryptor;
{
standardPBEStringEncryptor = new StandardPBEStringEncryptor();
EnvironmentPBEConfig config = new EnvironmentPBEConfig();
config.setAlgorithm(algorithm);
config.setPassword(password);
standardPBEStringEncryptor.setConfig(config);
}
public String encrypt(String plainText) {
return standardPBEStringEncryptor.encrypt(plainText);
}
//解密
public String decrypt(String encryptedText) {
return standardPBEStringEncryptor.decrypt(encryptedText);
}
public static void main(String[] args) {
JasyptUtil test = new JasyptUtil();
// System.out.println(test.decrypt("k6vl6SNCrZ8hyTcK4ew+pQ=="));
// System.out.println(test.decrypt("nFNBAlHJtaE5tz9yKEqYSA=="));
System.out.println(test.encrypt("root"));
System.out.println(test.encrypt("mysql"));
}
}
//package com.wugui.datax.admin.util;
//
//
//import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
//import org.jasypt.encryption.pbe.config.EnvironmentPBEConfig;
//
//public class JasyptUtil {
//
// final String algorithm = "PBEWithMD5AndDES";// 加密的算法这个算法是默认的
// final String password = "hVO0O2NeySpANQUk"; // 加密的密钥 配置文件中 jasypt.encryptor.password
// StandardPBEStringEncryptor standardPBEStringEncryptor;
//
// {
// standardPBEStringEncryptor = new StandardPBEStringEncryptor();
// EnvironmentPBEConfig config = new EnvironmentPBEConfig();
// config.setAlgorithm(algorithm);
// config.setPassword(password);
// standardPBEStringEncryptor.setConfig(config);
// }
//
// public String encrypt(String plainText) {
// return standardPBEStringEncryptor.encrypt(plainText);
// }
//
// //解密
// public String decrypt(String encryptedText) {
// return standardPBEStringEncryptor.decrypt(encryptedText);
// }
//
// public static void main(String[] args) {
// JasyptUtil test = new JasyptUtil();
//// System.out.println(test.decrypt("k6vl6SNCrZ8hyTcK4ew+pQ=="));
//// System.out.println(test.decrypt("nFNBAlHJtaE5tz9yKEqYSA=="));
//
// System.out.println(test.encrypt("root"));
// System.out.println(test.encrypt("mysql"));
//
//
//
// }
//
//}

View File

@ -3,8 +3,8 @@ server:
spring:
#数据源
datasource:
username: ENC(6WpAwrc9TXkZo2aIXeYtHw==)
password: ENC(flGBggksQibhINCvRmntzw==)
username: root
password: mysql
url: jdbc:mysql://localhost:3306/datax_web?serverTimezone=Asia/Shanghai&useLegacyDatetimeCode=false&useSSL=false&nullNamePatternMatchesAll=true&useUnicode=true&characterEncoding=UTF-8
driver-class-name: com.mysql.jdbc.Driver
@ -38,9 +38,9 @@ spring:
socketFactory:
class: javax.net.ssl.SSLSocketFactory
jasypt:
encryptor:
password: hVO0O2NeySpANQUk
#jasypt:
# encryptor:
# password: hVO0O2NeySpANQUk
management: