Skip to content

Commit 67de6ba

Browse files
author
bosc039
committed
Configure Jasypt encryptor to use password from application properties
It is mandatory to set the password for jasypt via VM.
1 parent dca418d commit 67de6ba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/org/abosk/openaiclient/config/EncryptorConfig.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22

33
import org.jasypt.encryption.StringEncryptor;
44
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
5+
import org.springframework.beans.factory.annotation.Value;
56
import org.springframework.context.annotation.Bean;
67
import org.springframework.context.annotation.Configuration;
78

89
@Configuration
910
public class EncryptorConfig {
1011

12+
@Value("${jasypt.encryptor.password}")
13+
private String password;
14+
1115
@Bean(name = "jasyptStringEncryptor")
1216
public StringEncryptor stringEncryptor() {
1317
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
18+
encryptor.setPassword(password);
1419
encryptor.setAlgorithm("PBEWithMD5AndTripleDES");
1520
encryptor.setStringOutputType("base64");
1621
return encryptor;

0 commit comments

Comments
 (0)