fix
- 修复jasypt引用问题
This commit is contained in:
parent
6384c997ad
commit
acf4c56b2b
@ -8,7 +8,7 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="OpenJDK17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="ms-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
3
pom.xml
3
pom.xml
@ -35,11 +35,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!--jasypt配置文件加解密-->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>3.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
15
src/main/resources/application.properties
Normal file
15
src/main/resources/application.properties
Normal file
@ -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
|
||||
@ -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
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user