Skip to content

Commit ab14caa

Browse files
committed
Add javadoc
1 parent 8dc1597 commit ab14caa

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,24 @@
2222
* @author Oleg Gusakov
2323
*/
2424
public interface SecDispatcher {
25+
/**
26+
* The default path of configuration.
27+
* <p>
28+
* The character {@code ~} (tilde) may be present as first character ONLY and is
29+
* interpreted as "user home".
30+
*/
2531
String DEFAULT_CONFIGURATION = "~/.m2/settings-security.xml";
32+
33+
/**
34+
* Java System Property that may be set, to override configuration path.
35+
*/
2636
String SYSTEM_PROPERTY_CONFIGURATION_LOCATION = "settings.security";
37+
38+
/**
39+
* Attribute that selects a dispatcher.
40+
*
41+
* @see #availableDispatchers()
42+
*/
2743
String DISPATCHER_NAME_ATTR = "name";
2844

2945
/**

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.nio.charset.StandardCharsets;
1818
import java.util.Base64;
1919
import java.util.Map;
20+
import java.util.Set;
2021

2122
import org.codehaus.plexus.components.cipher.internal.DefaultPlexusCipher;
2223
import org.codehaus.plexus.components.secdispatcher.SecDispatcher;
@@ -148,6 +149,7 @@ void testEncryptWithDispatcher() throws Exception {
148149
Map.of("magic", new StaticDispatcher("decrypted", "encrypted")),
149150
DefaultSecDispatcher.DEFAULT_CONFIGURATION);
150151

152+
assertEquals(Set.of("magic"), sd.availableDispatchers());
151153
String enc = sd.encrypt("whatever", Map.of(SecDispatcher.DISPATCHER_NAME_ATTR, "magic", "a", "b"));
152154
assertNotNull(enc);
153155
assertTrue(enc.contains("encrypted"));
@@ -164,6 +166,7 @@ void testDecryptWithDispatcher() throws Exception {
164166
Map.of("magic", new StaticDispatcher("decrypted", "encrypted")),
165167
DefaultSecDispatcher.DEFAULT_CONFIGURATION);
166168

169+
assertEquals(Set.of("magic"), sd.availableDispatchers());
167170
String pass = sd.decrypt("{" + Base64.getEncoder().encodeToString("whatever".getBytes(StandardCharsets.UTF_8))
168171
+ "[a=b," + SecDispatcher.DISPATCHER_NAME_ATTR + "=magic]}");
169172
assertNotNull(pass);

0 commit comments

Comments
 (0)