com.mindbright.ssh
Class SSHPropertyHandler
java.lang.Object
com.mindbright.ssh.SSHPropertyHandler
- All Implemented Interfaces:
- ProxyAuthenticator, SSHAuthenticator, SSHClientUser
- public final class SSHPropertyHandler
- extends java.lang.Object
- implements SSHClientUser, SSHAuthenticator, ProxyAuthenticator
Method Summary |
void |
activateProperties()
|
void |
addLocalPortForward(java.lang.String fwdSpec,
boolean commit)
|
void |
addRemotePortForward(java.lang.String fwdSpec,
boolean commit)
|
java.lang.String[] |
availableAliases()
|
static java.lang.String |
backwardCompatProp(java.lang.String key)
|
void |
checkSave()
|
boolean |
emptyPropertyPassword()
|
void |
eraseProperty(java.lang.String key)
|
static SSHPropertyHandler |
fromFile(java.lang.String fileName,
java.lang.String password)
|
java.lang.String |
getAlias()
|
int |
getAliveInterval()
|
int[] |
getAuthTypes(SSHClientUser origin)
|
java.lang.String |
getChallengeResponse(SSHClientUser origin,
java.lang.String challenge)
|
int |
getCipher(SSHClientUser origin)
|
int |
getCompressionLevel()
|
java.lang.String |
getDefaultProperty(java.lang.String key)
|
java.lang.String |
getDisplay()
|
SSHRSAKeyFile |
getIdentityFile(SSHClientUser origin)
|
java.lang.String |
getIdentityPassword(SSHClientUser origin)
|
java.lang.String |
getIdentityPassword(java.lang.String prompt)
|
java.util.Properties |
getInitTerminalProperties()
|
SSHInteractor |
getInteractor()
|
int |
getMaxPacketSz()
|
java.lang.String |
getPassword(SSHClientUser origin)
|
java.util.Properties |
getProperties()
|
java.lang.String |
getProperty(java.lang.String key)
|
boolean |
getPropertyB(java.lang.String key)
|
int |
getPropertyI(java.lang.String key)
|
java.net.Socket |
getProxyConnection()
|
java.lang.String |
getProxyPassword(java.lang.String type,
java.lang.String challenge)
|
java.lang.String |
getProxyUsername(java.lang.String type,
java.lang.String challenge)
|
java.lang.String |
getSrvHost()
|
int |
getSrvPort()
|
java.lang.String |
getSSHHomeDir()
|
TerminalWindow |
getTerminal()
|
java.lang.String |
getUsername(SSHClientUser origin)
|
boolean |
hasHomeDir()
|
boolean |
isAbsolutFile(java.lang.String fileName)
|
boolean |
isAlias(java.lang.String alias)
|
static boolean |
isProperty(java.lang.String key)
|
boolean |
isReadOnly()
|
void |
loadAbsoluteFile(java.lang.String fileName,
boolean promptPwd)
|
void |
loadAliasFile(java.lang.String alias,
boolean promptPwd)
|
void |
mergeProperties(java.util.Properties newProps)
|
java.lang.Object[] |
parseForwardSpec(java.lang.String spec)
|
void |
passivateProperties()
|
java.io.ByteArrayOutputStream |
readResource(java.lang.String name)
|
void |
removeLocalTunnelAt(int idx,
boolean kill)
|
void |
removeRemoteTunnelAt(int idx)
|
void |
resetProperty(java.lang.String key)
|
void |
resetToDefaults()
|
void |
saveAsCurrentFile(java.lang.String fileName)
|
void |
saveCurrentFile()
|
void |
setAlias(java.lang.String alias)
|
static void |
setAsDefault(java.util.Properties props)
|
void |
setAutoLoadProps(boolean value)
|
void |
setAutoSaveProps(boolean value)
|
void |
setClient(SSHInteractiveClient client)
|
void |
setDefaultProperty(java.lang.String key,
java.lang.String value)
|
void |
setInteractor(SSHInteractor interactor)
|
void |
setProperties(java.util.Properties newProps)
|
void |
setProperty(java.lang.String key,
boolean value)
|
void |
setProperty(java.lang.String key,
int value)
|
void |
setProperty(java.lang.String key,
java.lang.String value)
|
void |
setPropertyPassword(java.lang.String password)
|
void |
setReadOnly(boolean value)
|
void |
setSavePasswords(boolean value)
|
boolean |
setSSHHomeDir(java.lang.String sshHomeDir)
|
boolean |
verifyKnownHosts(RSAPublicKey hostPub)
|
boolean |
verifyKnownSSH2Hosts(SSHInteractiveClient cli,
SSH2Signature serverHostKey)
|
boolean |
wantPTY()
|
boolean |
wantSave()
|
boolean |
wantX11Forward()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PROP_NAME
public static final int PROP_NAME
- See Also:
- Constant Field Values
PROP_VALUE
public static final int PROP_VALUE
- See Also:
- Constant Field Values
PROPS_FILE_EXT
public static final java.lang.String PROPS_FILE_EXT
- See Also:
- Constant Field Values
DEF_IDFILE
public static final java.lang.String DEF_IDFILE
- See Also:
- Constant Field Values
hostKeyAlgs
public static java.lang.String hostKeyAlgs
macAlgs
public static java.lang.String macAlgs
ciphAlgsSort
public static java.lang.String ciphAlgsSort
defaultProperties
public static final java.util.Properties defaultProperties
defaultPropNames
public static final java.util.Hashtable defaultPropNames
oldPropNames
public static final java.util.Hashtable oldPropNames
defaultPropDesc
public static final java.lang.String[][] defaultPropDesc
currentPropsFile
protected java.lang.String currentPropsFile
currentAlias
protected java.lang.String currentAlias
initTermProps
public java.util.Properties initTermProps
propsChanged
protected boolean propsChanged
SSHPropertyHandler
public SSHPropertyHandler(java.util.Properties initProps,
boolean setAsDefault)
SSHPropertyHandler
public SSHPropertyHandler(SSHPropertyHandler clone)
backwardCompatProp
public static java.lang.String backwardCompatProp(java.lang.String key)
setAsDefault
public static void setAsDefault(java.util.Properties props)
fromFile
public static SSHPropertyHandler fromFile(java.lang.String fileName,
java.lang.String password)
throws java.io.IOException
- Throws:
java.io.IOException
setInteractor
public void setInteractor(SSHInteractor interactor)
setClient
public void setClient(SSHInteractiveClient client)
setAutoLoadProps
public void setAutoLoadProps(boolean value)
setAutoSaveProps
public void setAutoSaveProps(boolean value)
setSavePasswords
public void setSavePasswords(boolean value)
setReadOnly
public void setReadOnly(boolean value)
isReadOnly
public boolean isReadOnly()
setPropertyPassword
public void setPropertyPassword(java.lang.String password)
emptyPropertyPassword
public boolean emptyPropertyPassword()
setSSHHomeDir
public boolean setSSHHomeDir(java.lang.String sshHomeDir)
getSSHHomeDir
public java.lang.String getSSHHomeDir()
hasHomeDir
public boolean hasHomeDir()
resetToDefaults
public void resetToDefaults()
isProperty
public static boolean isProperty(java.lang.String key)
getProperty
public java.lang.String getProperty(java.lang.String key)
getPropertyB
public boolean getPropertyB(java.lang.String key)
getPropertyI
public int getPropertyI(java.lang.String key)
getDefaultProperty
public java.lang.String getDefaultProperty(java.lang.String key)
setDefaultProperty
public void setDefaultProperty(java.lang.String key,
java.lang.String value)
resetProperty
public void resetProperty(java.lang.String key)
eraseProperty
public void eraseProperty(java.lang.String key)
setProperty
public void setProperty(java.lang.String key,
boolean value)
throws java.lang.IllegalArgumentException,
java.util.NoSuchElementException
- Throws:
java.lang.IllegalArgumentException
java.util.NoSuchElementException
setProperty
public void setProperty(java.lang.String key,
int value)
throws java.lang.IllegalArgumentException,
java.util.NoSuchElementException
- Throws:
java.lang.IllegalArgumentException
java.util.NoSuchElementException
setProperty
public void setProperty(java.lang.String key,
java.lang.String value)
throws java.lang.IllegalArgumentException,
java.util.NoSuchElementException
- Throws:
java.lang.IllegalArgumentException
java.util.NoSuchElementException
setProperties
public void setProperties(java.util.Properties newProps)
throws java.lang.IllegalArgumentException,
java.util.NoSuchElementException
- Throws:
java.lang.IllegalArgumentException
java.util.NoSuchElementException
getProperties
public java.util.Properties getProperties()
mergeProperties
public void mergeProperties(java.util.Properties newProps)
throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
getInitTerminalProperties
public java.util.Properties getInitTerminalProperties()
activateProperties
public void activateProperties()
passivateProperties
public void passivateProperties()
wantSave
public boolean wantSave()
checkSave
public final void checkSave()
throws java.io.IOException
- Throws:
java.io.IOException
saveCurrentFile
public void saveCurrentFile()
throws java.io.IOException
- Throws:
java.io.IOException
saveAsCurrentFile
public void saveAsCurrentFile(java.lang.String fileName)
throws java.io.IOException
- Throws:
java.io.IOException
loadAbsoluteFile
public void loadAbsoluteFile(java.lang.String fileName,
boolean promptPwd)
throws java.io.IOException
- Throws:
java.io.IOException
setAlias
public void setAlias(java.lang.String alias)
getAlias
public java.lang.String getAlias()
loadAliasFile
public void loadAliasFile(java.lang.String alias,
boolean promptPwd)
throws java.io.IOException
- Throws:
java.io.IOException
availableAliases
public java.lang.String[] availableAliases()
isAlias
public boolean isAlias(java.lang.String alias)
isAbsolutFile
public boolean isAbsolutFile(java.lang.String fileName)
getTerminal
public TerminalWindow getTerminal()
removeLocalTunnelAt
public void removeLocalTunnelAt(int idx,
boolean kill)
removeRemoteTunnelAt
public void removeRemoteTunnelAt(int idx)
parseForwardSpec
public java.lang.Object[] parseForwardSpec(java.lang.String spec)
throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
addLocalPortForward
public void addLocalPortForward(java.lang.String fwdSpec,
boolean commit)
throws java.lang.IllegalArgumentException,
java.io.IOException
- Throws:
java.lang.IllegalArgumentException
java.io.IOException
addRemotePortForward
public void addRemotePortForward(java.lang.String fwdSpec,
boolean commit)
throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
getUsername
public java.lang.String getUsername(SSHClientUser origin)
throws java.io.IOException
- Specified by:
getUsername
in interface SSHAuthenticator
- Throws:
java.io.IOException
getPassword
public java.lang.String getPassword(SSHClientUser origin)
throws java.io.IOException
- Specified by:
getPassword
in interface SSHAuthenticator
- Throws:
java.io.IOException
getChallengeResponse
public java.lang.String getChallengeResponse(SSHClientUser origin,
java.lang.String challenge)
throws java.io.IOException
- Specified by:
getChallengeResponse
in interface SSHAuthenticator
- Throws:
java.io.IOException
getAuthTypes
public int[] getAuthTypes(SSHClientUser origin)
- Specified by:
getAuthTypes
in interface SSHAuthenticator
getCipher
public int getCipher(SSHClientUser origin)
- Specified by:
getCipher
in interface SSHAuthenticator
getIdentityFile
public SSHRSAKeyFile getIdentityFile(SSHClientUser origin)
throws java.io.IOException
- Specified by:
getIdentityFile
in interface SSHAuthenticator
- Throws:
java.io.IOException
getIdentityPassword
public java.lang.String getIdentityPassword(SSHClientUser origin)
throws java.io.IOException
- Specified by:
getIdentityPassword
in interface SSHAuthenticator
- Throws:
java.io.IOException
getIdentityPassword
public java.lang.String getIdentityPassword(java.lang.String prompt)
throws java.io.IOException
- Throws:
java.io.IOException
verifyKnownHosts
public boolean verifyKnownHosts(RSAPublicKey hostPub)
throws java.io.IOException
- Specified by:
verifyKnownHosts
in interface SSHAuthenticator
- Throws:
java.io.IOException
verifyKnownSSH2Hosts
public boolean verifyKnownSSH2Hosts(SSHInteractiveClient cli,
SSH2Signature serverHostKey)
throws java.io.IOException,
SSH2Exception
- Throws:
java.io.IOException
SSH2Exception
getProxyUsername
public java.lang.String getProxyUsername(java.lang.String type,
java.lang.String challenge)
throws java.io.IOException
- Specified by:
getProxyUsername
in interface ProxyAuthenticator
- Throws:
java.io.IOException
getProxyPassword
public java.lang.String getProxyPassword(java.lang.String type,
java.lang.String challenge)
throws java.io.IOException
- Specified by:
getProxyPassword
in interface ProxyAuthenticator
- Throws:
java.io.IOException
getSrvHost
public java.lang.String getSrvHost()
throws java.io.IOException
- Specified by:
getSrvHost
in interface SSHClientUser
- Throws:
java.io.IOException
getSrvPort
public int getSrvPort()
- Specified by:
getSrvPort
in interface SSHClientUser
getProxyConnection
public java.net.Socket getProxyConnection()
throws java.io.IOException
- Specified by:
getProxyConnection
in interface SSHClientUser
- Throws:
java.io.IOException
readResource
public java.io.ByteArrayOutputStream readResource(java.lang.String name)
getDisplay
public java.lang.String getDisplay()
- Specified by:
getDisplay
in interface SSHClientUser
getMaxPacketSz
public int getMaxPacketSz()
- Specified by:
getMaxPacketSz
in interface SSHClientUser
getAliveInterval
public int getAliveInterval()
- Specified by:
getAliveInterval
in interface SSHClientUser
getCompressionLevel
public int getCompressionLevel()
- Specified by:
getCompressionLevel
in interface SSHClientUser
wantX11Forward
public boolean wantX11Forward()
- Specified by:
wantX11Forward
in interface SSHClientUser
wantPTY
public boolean wantPTY()
- Specified by:
wantPTY
in interface SSHClientUser
getInteractor
public SSHInteractor getInteractor()
- Specified by:
getInteractor
in interface SSHClientUser