Skip to content

Commit 6aac500

Browse files
committed
Reformat
1 parent 35e76ab commit 6aac500

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/main/java/org/codehaus/plexus/components/secdispatcher/SecDispatcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public interface SecDispatcher {
8282
* Writes the effective configuration.
8383
*
8484
* @param configuration The configuration to write, may not be {@code null}
85-
* x * @throws IOException In case of IO problem
85+
* @throws IOException In case of IO problem
8686
*/
8787
void writeConfiguration(SettingsSecurity configuration) throws IOException;
8888
}

src/test/java/org/codehaus/plexus/components/secdispatcher/internal/DefaultSecDispatcherTest.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,21 @@ private void saveSec(SettingsSecurity sec) throws Exception {
6666
}
6767

6868
@Test
69-
void testRoundTripWithDispatcher() throws Exception {
69+
void masterWithEnvRoundTrip() throws Exception {
70+
saveSec("master", Map.of("masterSource", "env:MASTER_PASSWORD", "masterCipher", AESGCMNoPadding.CIPHER_ALG));
71+
DefaultSecDispatcher sd = construct();
72+
73+
assertEquals(1, sd.availableDispatchers().size());
74+
String encrypted = sd.encrypt("supersecret", Map.of(SecDispatcher.DISPATCHER_NAME_ATTR, "master", "a", "b"));
75+
assertTrue(encrypted.startsWith("{") && encrypted.endsWith("}"));
76+
assertTrue(encrypted.contains("name=master"));
77+
assertTrue(encrypted.contains("a=b"));
78+
String pass = sd.decrypt(encrypted);
79+
assertEquals("supersecret", pass);
80+
}
81+
82+
@Test
83+
void masterWithSystemPropertyRoundTrip() throws Exception {
7084
saveSec(
7185
"master",
7286
Map.of("masterSource", "system-property:masterPassword", "masterCipher", AESGCMNoPadding.CIPHER_ALG));

0 commit comments

Comments
 (0)