File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
utils/jasypt/src/test/java/io/smallrye/config/jasypt Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1
1
package io .smallrye .config .jasypt ;
2
2
3
+ import static io .smallrye .config .EnvConfigSource .ORDINAL ;
3
4
import static org .junit .jupiter .api .Assertions .*;
4
5
5
6
import java .util .Map ;
6
7
7
8
import org .junit .jupiter .api .Test ;
8
9
10
+ import io .smallrye .config .EnvConfigSource ;
9
11
import io .smallrye .config .PropertiesConfigSource ;
10
12
import io .smallrye .config .SmallRyeConfig ;
11
13
import io .smallrye .config .SmallRyeConfigBuilder ;
@@ -27,6 +29,22 @@ void jasypt() {
27
29
assertEquals ("12345678" , config .getRawValue ("my.secret" ));
28
30
}
29
31
32
+ @ Test
33
+ void jasyptWithEnv () {
34
+ SmallRyeConfig config = new SmallRyeConfigBuilder ()
35
+ .addDefaultInterceptors ()
36
+ .addDiscoveredSecretKeysHandlers ()
37
+ .withSources (new EnvConfigSource (Map .of (
38
+ "SMALLRYE_CONFIG_SECRET_HANDLER_JASYPT_PASSWORD" , "jasypt" ,
39
+ "SMALLRYE_CONFIG_SECRET_HANDLER_JASYPT_ALGORITHM" , "PBEWithHMACSHA512AndAES_256" ), ORDINAL ))
40
+ .withSources (new PropertiesConfigSource (
41
+ Map .of ("my.secret" , "${jasypt::ENC(wqp8zDeiCQ5JaFvwDtoAcr2WMLdlD0rjwvo8Rh0thG5qyTQVGxwJjBIiW26y0dtU)}" ),
42
+ "" , 0 ))
43
+ .build ();
44
+
45
+ assertEquals ("12345678" , config .getRawValue ("my.secret" ));
46
+ }
47
+
30
48
@ Test
31
49
void expression () {
32
50
Map <String , String > properties = Map .of (
You can’t perform that action at this time.
0 commit comments