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
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected final Pathprotected final Map<String,Dispatcher> static final Stringstatic final StringFields inherited from interface org.codehaus.plexus.components.secdispatcher.SecDispatcher
DISPATCHER_NAME_ATTR, DISPATCHER_VERSION_ATTR -
Constructor Summary
ConstructorsConstructorDescriptionDefaultSecDispatcher(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.booleanisEncryptedString(String str) Current: {[name=master,cipher=AES/GCM/NoPadding,version=4.0]vvq66pZ7rkvzSPStGTI9q4QDnsmuDwo+LtjraRel2b0XpcGJFdXcYAHAS75HUA6GLpcVtEkmyQ==}booleanLegacy: {jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}readConfiguration(boolean createIfMissing) Reads the effective configuration, eventually creating new instance if not present.protected StringstripAttributes(String str) protected StringunDecorate(String str) protected StringunDecorateLegacy(String str) Performs a "deep validation" and reports the status.voidwriteConfiguration(SettingsSecurity configuration) Writes the effective configuration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:SecDispatcherReturns the set of available dispatcher metadata, nevernull.- Specified by:
availableDispatchersin interfaceSecDispatcher
-
encrypt
public String encrypt(String str, Map<String, String> attr) throws SecDispatcherException, IOExceptionDescription copied from interface:SecDispatcherEncrypt given plaintext string.- Specified by:
encryptin 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:SecDispatcherDecrypt given encrypted string.- Specified by:
decryptin 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:
isEncryptedStringin interfaceSecDispatcher
-
isLegacyEncryptedString
- Legacy: {jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}
- Specified by:
isLegacyEncryptedStringin interfaceSecDispatcher
-
readConfiguration
Description copied from interface:SecDispatcherReads the effective configuration, eventually creating new instance if not present.- Specified by:
readConfigurationin interfaceSecDispatcher- Parameters:
createIfMissing- Iftrue, it will create a new empty instance- Returns:
- the configuration, of
nullif it does not exist increateIfMissingisfalse - Throws:
IOException- In case of IO problem
-
writeConfiguration
Description copied from interface:SecDispatcherWrites the effective configuration.- Specified by:
writeConfigurationin interfaceSecDispatcher- Parameters:
configuration- The configuration to write, may not benull- Throws:
IOException- In case of IO problem
-
validateConfiguration
Description copied from interface:SecDispatcherPerforms a "deep validation" and reports the status. If return instanceSecDispatcher.ValidationResponse.isValid()istrue, configuration is usable.- Specified by:
validateConfigurationin interfaceSecDispatcher
-
prepareDispatcherConfig
- Throws:
IOException
-
strip
-
stripAttributes
-
unDecorate
-
unDecorateLegacy
-