Class DefaultSecDispatcher
- java.lang.Object
-
- org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher
-
- All Implemented Interfaces:
SecDispatcher
@Singleton @Named public class DefaultSecDispatcher extends java.lang.Object implements SecDispatcher
-
-
Field Summary
Fields Modifier and Type Field Description protected org.sonatype.plexus.components.cipher.PlexusCipher_cipherDefaultHandlerprotected java.lang.String_configurationFileConfiguration fileprotected java.util.Map<java.lang.String,PasswordDecryptor>_decryptorsAll available dispatchersstatic charATTR_STARTstatic charATTR_STOPprivate static java.lang.StringDEFAULT_CONFIGURATIONstatic java.lang.StringSYSTEM_PROPERTY_SEC_LOCATIONstatic java.lang.StringTYPE_ATTR-
Fields inherited from interface org.sonatype.plexus.components.sec.dispatcher.SecDispatcher
SYSTEM_PROPERTY_MASTER_PASSWORD, SYSTEM_PROPERTY_SERVER_PASSWORD
-
-
Constructor Summary
Constructors Constructor Description DefaultSecDispatcher(org.sonatype.plexus.components.cipher.PlexusCipher _cipher)Ctor to be used in tests and other simplified cases (no decryptors and config).DefaultSecDispatcher(org.sonatype.plexus.components.cipher.PlexusCipher _cipher, java.util.Map<java.lang.String,PasswordDecryptor> _decryptors, java.lang.String _configurationFile)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringdecrypt(java.lang.String str)decrypt given encrypted stringjava.lang.StringgetConfigurationFile()private java.lang.StringgetMaster(SettingsSecurity sec)private SettingsSecuritygetSec()private booleanisEncryptedString(java.lang.String str)static voidmain(java.lang.String[] args)private static booleanpropertyExists(java.lang.String[] values, java.lang.String[] av)voidsetConfigurationFile(java.lang.String file)private static voidshow(boolean showMaster)private java.lang.Stringstrip(java.lang.String str)private java.util.Map<java.lang.String,java.lang.String>stripAttributes(java.lang.String str)private static voidusage()
-
-
-
Field Detail
-
DEFAULT_CONFIGURATION
private static final java.lang.String DEFAULT_CONFIGURATION
- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_SEC_LOCATION
public static final java.lang.String SYSTEM_PROPERTY_SEC_LOCATION
- See Also:
- Constant Field Values
-
TYPE_ATTR
public static final java.lang.String TYPE_ATTR
- See Also:
- Constant Field Values
-
ATTR_START
public static final char ATTR_START
- See Also:
- Constant Field Values
-
ATTR_STOP
public static final char ATTR_STOP
- See Also:
- Constant Field Values
-
_cipher
protected final org.sonatype.plexus.components.cipher.PlexusCipher _cipher
DefaultHandler
-
_decryptors
protected final java.util.Map<java.lang.String,PasswordDecryptor> _decryptors
All available dispatchers
-
_configurationFile
protected java.lang.String _configurationFile
Configuration file
-
-
Constructor Detail
-
DefaultSecDispatcher
@Inject public DefaultSecDispatcher(org.sonatype.plexus.components.cipher.PlexusCipher _cipher, java.util.Map<java.lang.String,PasswordDecryptor> _decryptors, @Named("${_configurationFile:-~/.settings-security.xml}") java.lang.String _configurationFile)
-
DefaultSecDispatcher
public DefaultSecDispatcher(org.sonatype.plexus.components.cipher.PlexusCipher _cipher)
Ctor to be used in tests and other simplified cases (no decryptors and config).
-
-
Method Detail
-
decrypt
public java.lang.String decrypt(java.lang.String str) throws SecDispatcherExceptionDescription copied from interface:SecDispatcherdecrypt given encrypted string- Specified by:
decryptin interfaceSecDispatcher- Returns:
- decrypted string
- Throws:
SecDispatcherException
-
strip
private java.lang.String strip(java.lang.String str)
-
stripAttributes
private java.util.Map<java.lang.String,java.lang.String> stripAttributes(java.lang.String str)
-
isEncryptedString
private boolean isEncryptedString(java.lang.String str)
-
getSec
private SettingsSecurity getSec() throws SecDispatcherException
- Throws:
SecDispatcherException
-
getMaster
private java.lang.String getMaster(SettingsSecurity sec) throws SecDispatcherException
- Throws:
SecDispatcherException
-
getConfigurationFile
public java.lang.String getConfigurationFile()
-
setConfigurationFile
public void setConfigurationFile(java.lang.String file)
-
propertyExists
private static boolean propertyExists(java.lang.String[] values, java.lang.String[] av)
-
usage
private static void usage()
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
show
private static void show(boolean showMaster) throws java.lang.Exception- Throws:
java.lang.Exception
-
-