Class DefaultSecDispatcher
java.lang.Object
org.codehaus.plexus.components.secdispatcher.internal.DefaultSecDispatcher
- All Implemented Interfaces:
SecDispatcher
Note: this implementation is NOT a JSR330 component. Integrating apps anyway want to customize it (at least
the name and location of configuration file), so instead as before (providing "bad" configuration file just
to have one), it is the duty of integrator to wrap and "finish" the implementation in a way it suits the
integrator. Also, using "globals" like Java System Properties are bad thing, and it is integrator who knows
what is needed anyway.
Recommended way for integration is to create JSR330 Provider
.
- Author:
- Oleg Gusakov
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.codehaus.plexus.components.secdispatcher.SecDispatcher
SecDispatcher.ValidationResponse
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
protected final Path
protected final Map
<String, Dispatcher> static final String
static final String
Fields inherited from interface org.codehaus.plexus.components.secdispatcher.SecDispatcher
DISPATCHER_NAME_ATTR, DISPATCHER_VERSION_ATTR
-
Constructor Summary
ConstructorDescriptionDefaultSecDispatcher
(Map<String, Dispatcher> dispatchers, Path configurationFile) -
Method Summary
Modifier and TypeMethodDescriptionReturns the set of available dispatcher metadata, nevernull
.Decrypt given encrypted string.Encrypt given plaintext string.boolean
isEncryptedString
(String str) Current: {[name=master,cipher=AES/GCM/NoPadding,version=4.0]vvq66pZ7rkvzSPStGTI9q4QDnsmuDwo+LtjraRel2b0XpcGJFdXcYAHAS75HUA6GLpcVtEkmyQ==}boolean
Legacy: {jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}readConfiguration
(boolean createIfMissing) Reads the effective configuration, eventually creating new instance if not present.protected String
stripAttributes
(String str) protected String
unDecorate
(String str) protected String
unDecorateLegacy
(String str) Performs a "deep validation" and reports the status.void
writeConfiguration
(SettingsSecurity configuration) Writes the effective configuration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.codehaus.plexus.components.secdispatcher.SecDispatcher
isAnyEncryptedString
-
Field Details
-
SHIELD_BEGIN
- See Also:
-
SHIELD_END
- See Also:
-
ATTR_START
- See Also:
-
ATTR_STOP
- See Also:
-
dispatchers
-
configurationFile
-
-
Constructor Details
-
DefaultSecDispatcher
-
-
Method Details
-
availableDispatchers
Description copied from interface:SecDispatcher
Returns the set of available dispatcher metadata, nevernull
.- Specified by:
availableDispatchers
in interfaceSecDispatcher
-
encrypt
public String encrypt(String str, Map<String, String> attr) throws SecDispatcherException, IOExceptionDescription copied from interface:SecDispatcher
Encrypt given plaintext string.- Specified by:
encrypt
in interfaceSecDispatcher
- Parameters:
str
- the plaintext to encryptattr
- the attributes, may benull
- Returns:
- encrypted string
- Throws:
SecDispatcherException
- in case of problemIOException
-
decrypt
Description copied from interface:SecDispatcher
Decrypt given encrypted string.- Specified by:
decrypt
in interfaceSecDispatcher
- Parameters:
str
- the encrypted string- Returns:
- decrypted string
- Throws:
SecDispatcherException
- in case of problemIOException
-
isEncryptedString
- Current: {[name=master,cipher=AES/GCM/NoPadding,version=4.0]vvq66pZ7rkvzSPStGTI9q4QDnsmuDwo+LtjraRel2b0XpcGJFdXcYAHAS75HUA6GLpcVtEkmyQ==}
- Specified by:
isEncryptedString
in interfaceSecDispatcher
-
isLegacyEncryptedString
- Legacy: {jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}
- Specified by:
isLegacyEncryptedString
in interfaceSecDispatcher
-
readConfiguration
Description copied from interface:SecDispatcher
Reads the effective configuration, eventually creating new instance if not present.- Specified by:
readConfiguration
in interfaceSecDispatcher
- Parameters:
createIfMissing
- Iftrue
, it will create a new empty instance- Returns:
- the configuration, of
null
if it does not exist increateIfMissing
isfalse
- Throws:
IOException
- In case of IO problem
-
writeConfiguration
Description copied from interface:SecDispatcher
Writes the effective configuration.- Specified by:
writeConfiguration
in interfaceSecDispatcher
- Parameters:
configuration
- The configuration to write, may not benull
- Throws:
IOException
- In case of IO problem
-
validateConfiguration
Description copied from interface:SecDispatcher
Performs a "deep validation" and reports the status. If return instanceSecDispatcher.ValidationResponse.isValid()
istrue
, configuration is usable.- Specified by:
validateConfiguration
in interfaceSecDispatcher
-
prepareDispatcherConfig
- Throws:
IOException
-
strip
-
stripAttributes
-
unDecorate
-
unDecorateLegacy
-