diff --git a/.idea/misc.xml b/.idea/misc.xml index 30eedac..2f30dbf 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index ba288ea..23331c7 100644 --- a/pom.xml +++ b/pom.xml @@ -35,11 +35,10 @@ org.springframework.boot spring-boot-starter - com.github.ulisesbocchio jasypt-spring-boot-starter - 2.1.1 + 3.0.5 org.springframework.boot diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..1285551 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,15 @@ +spring.mail.host=smtp.qq.com +spring.mail.port=587 +spring.mail.username=2712495353@qq.com +spring.mail.password=ENC(n5TkjicC1+mKnFboGCdGTCLAhDLB6vOsN7jox7oNvy/aiJlOcX7brtnLbIRIHPiNJpY3WGAJ5DAZIgdExz4AFw==) +spring.mail.protocol=smtp +spring.mail.test-connection=false +spring.mail.default-encoding=UTF-8 +spring.mail.properties.mail.smtp.auth=true +spring.mail.properties.mail.smtp.starttls.enable=true +spring.mail.properties.mail.smtp.starttls.required=true +spring.mail.properties.mail.smtp.ssl.enable=false +spring.mail.properties.mail.display.sendmail=spring-boot-demo + +# Jasypt ?? +jasypt.encryptor.password=abc \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml deleted file mode 100644 index 81f727c..0000000 --- a/src/main/resources/application.yml +++ /dev/null @@ -1,23 +0,0 @@ -spring: - mail: - host: smtp.qq.com - port: 587 - username: 2712495353@qq.com - # 使用 jasypt 加密密码,使用com.xkcoding.email.PasswordTest.testGeneratePassword 生成加密密码,替换 ENC(加密密码) -# password: ENC(OT0qGOpXrr1Iog1W+fjOiIDCJdBjHyhy) - password: xlwpmlbawpjjdghb - protocol: smtp - test-connection: false - default-encoding: UTF-8 - properties: - mail.smtp.auth: true - mail.smtp.starttls.enable: true - mail.smtp.starttls.required: true - mail.smtp.ssl.enable: false - mail.display.sendmail: spring-boot-demo -# 为 jasypt 配置解密秘钥 -jasypt: - encryptor: - bean: jasyptStringEncryptor - password: spring-boot-demo - algorithm: PBEWITHHMACSHA512ANDAES_256 diff --git a/src/test/java/asia/yulinling/workflow/PasswordTest.java b/src/test/java/asia/yulinling/workflow/PasswordTest.java index ee1d7f3..fce3359 100644 --- a/src/test/java/asia/yulinling/workflow/PasswordTest.java +++ b/src/test/java/asia/yulinling/workflow/PasswordTest.java @@ -17,8 +17,7 @@ public class PasswordTest extends WorkFlowMainTests { @Test public void testGeneratePassword() { // 你的邮箱密码 - String password = "Just4Test!"; - // 加密后的密码(注意:配置上去的时候需要加 ENC(加密密码)) + String password = "xlwpmlbawpjjdghb"; String encryptPassword = encryptor.encrypt(password); String decryptPassword = encryptor.decrypt(encryptPassword);