配置文件数据库和redis账号密码加密
This commit is contained in:
parent
40c3cc5498
commit
94552bc1b1
|
|
@ -88,6 +88,13 @@
|
|||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--加密依赖包-->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -1,20 +1,46 @@
|
|||
package com.bonus.sgzb.gateway;
|
||||
|
||||
import org.jasypt.encryption.StringEncryptor;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 网关启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
|
||||
public class SgzbGatewayApplication
|
||||
{
|
||||
public class SgzbGatewayApplication implements CommandLineRunner {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SpringApplication.run(SgzbGatewayApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 网关启动成功 ლ(´ڡ`ლ)゙ \n");
|
||||
}
|
||||
|
||||
@Resource
|
||||
private StringEncryptor encryptor;
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
String nacos = encrypt("Jjsp@nacos2023" );
|
||||
String mysqlNm = encrypt("root" );
|
||||
String mysqlPs = encrypt("Bonus@admin123!" );
|
||||
String redis = encrypt("Dszbns@Redis123!" );
|
||||
System.err.println( "nacos原始明文密码加密后的结果为:" + nacos );
|
||||
System.err.println( "mysqlNm原始明文密码加密后的结果为:" + mysqlNm );
|
||||
System.err.println( "mysqlPs原始明文密码加密后的结果为:" + mysqlPs );
|
||||
System.err.println( "redis原始明文密码加密后的结果为:" + redis );
|
||||
}
|
||||
|
||||
|
||||
private String encrypt( String originPassord ) {
|
||||
return encryptor.encrypt( originPassord );
|
||||
}
|
||||
|
||||
private String decrypt( String encryptedPassword ) {
|
||||
return encryptor.decrypt( encryptedPassword );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ spring:
|
|||
nacos:
|
||||
enabled: true
|
||||
nacos:
|
||||
username: nacos
|
||||
password: ENC(gQ6+/ZE1DwP8W8IFKQDEllLgAJIOIZ5CBy334W5W/uCdyCrNosOWVuCzIPsm/ZF9)
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 192.168.0.14:8848
|
||||
|
|
@ -53,3 +55,8 @@ spring:
|
|||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
rule-type: gw-flow
|
||||
|
||||
#加密组件
|
||||
jasypt:
|
||||
encryptor:
|
||||
password: Encrypt
|
||||
|
|
|
|||
|
|
@ -101,6 +101,13 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!--加密依赖包-->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package com.bonus.sgzb;
|
|||
import com.bonus.sgzb.common.security.annotation.EnableCustomConfig;
|
||||
import com.bonus.sgzb.common.security.annotation.EnableRyFeignClients;
|
||||
import com.bonus.sgzb.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
|
@ -17,6 +18,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
@EnableCustomConfig
|
||||
@EnableRyFeignClients
|
||||
@EnableEncryptableProperties
|
||||
public class SgzbBaseApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
|
|
|
|||
|
|
@ -107,6 +107,13 @@
|
|||
<version>5.8.16</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!--加密依赖包-->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package com.bonus.sgzb.material;
|
|||
import com.bonus.sgzb.common.security.annotation.EnableCustomConfig;
|
||||
import com.bonus.sgzb.common.security.annotation.EnableRyFeignClients;
|
||||
import com.bonus.sgzb.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
|
@ -17,6 +18,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
@EnableCustomConfig
|
||||
@EnableRyFeignClients
|
||||
@EnableEncryptableProperties
|
||||
public class SgzbMaterialApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
|
|
|
|||
|
|
@ -110,6 +110,13 @@
|
|||
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||
<version>3.1.423</version>
|
||||
</dependency>
|
||||
|
||||
<!--加密依赖包-->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.sgzb.system;
|
||||
|
||||
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import com.bonus.sgzb.common.security.annotation.EnableCustomConfig;
|
||||
|
|
@ -15,6 +16,7 @@ import com.bonus.sgzb.common.swagger.annotation.EnableCustomSwagger2;
|
|||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication
|
||||
@EnableEncryptableProperties
|
||||
public class SgzbSystemApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
|
|
|
|||
Loading…
Reference in New Issue