Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamas committed Oct 9, 2024
1 parent 35e76ab commit 6aac500
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public interface SecDispatcher {
* Writes the effective configuration.
*
* @param configuration The configuration to write, may not be {@code null}
* x * @throws IOException In case of IO problem
* @throws IOException In case of IO problem
*/
void writeConfiguration(SettingsSecurity configuration) throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,21 @@ private void saveSec(SettingsSecurity sec) throws Exception {
}

@Test
void testRoundTripWithDispatcher() throws Exception {
void masterWithEnvRoundTrip() throws Exception {
saveSec("master", Map.of("masterSource", "env:MASTER_PASSWORD", "masterCipher", AESGCMNoPadding.CIPHER_ALG));
DefaultSecDispatcher sd = construct();

assertEquals(1, sd.availableDispatchers().size());
String encrypted = sd.encrypt("supersecret", Map.of(SecDispatcher.DISPATCHER_NAME_ATTR, "master", "a", "b"));
assertTrue(encrypted.startsWith("{") && encrypted.endsWith("}"));
assertTrue(encrypted.contains("name=master"));
assertTrue(encrypted.contains("a=b"));
String pass = sd.decrypt(encrypted);
assertEquals("supersecret", pass);
}

@Test
void masterWithSystemPropertyRoundTrip() throws Exception {
saveSec(
"master",
Map.of("masterSource", "system-property:masterPassword", "masterCipher", AESGCMNoPadding.CIPHER_ALG));
Expand Down

0 comments on commit 6aac500

Please sign in to comment.