com.mindbright.ssh2
public class SSH2SimpleClient extends java.lang.Object
SSH2UserAuth
, and SSH2Connection
). The
only thing which needs to be provided is an initialized
SSH2Transport
instance, user authentication data. The
constructor is active in that it does all the required work to set
up the complete protocol stack, hence it can throw exceptions which
can occur.
This simple client can easily be used as the basis for example to build
tunneling capabilities into any java app. requiring secure connections. For
doing remote command execution and/or controlling input/output of a command
or shell the class SSH2ConsoleRemote
can be used to have easy
access to command execution and/or input/output as
java.io.InputStream
and java.io.OutpuStream
Modifier and Type | Field and Description |
---|---|
protected SSH2Connection |
connection |
protected SSH2Transport |
transport |
protected SSH2UserAuth |
userAuth |
Constructor and Description |
---|
SSH2SimpleClient(SSH2Transport transport,
boolean hostbased,
java.lang.String username,
java.lang.String keyFile,
java.lang.String keyPassword)
Simple constructor to use for publickey / hostbased authentication.
|
SSH2SimpleClient(SSH2Transport transport,
boolean hostbased,
java.lang.String username,
java.lang.String keyFile,
java.lang.String keyPassword,
long timeout)
Simple constructor to use for publickey / hostbased authentication.
|
SSH2SimpleClient(SSH2Transport transport,
SSH2Authenticator authenticator)
Constructor to use when more than one authentication method
need to be used and/or other methods than the ones supported above.
|
SSH2SimpleClient(SSH2Transport transport,
SSH2Authenticator authenticator,
long timeout)
Constructor to use when more than one authentication method
need to be used and/or other methods than the ones supported above.
|
SSH2SimpleClient(SSH2Transport transport,
java.lang.String username,
long timeout)
Constructor to use for GSSAPI authentication.
|
SSH2SimpleClient(SSH2Transport transport,
java.lang.String username,
SSH2Interactor interactor)
Constructor to use for keyboard interactive authentication.
|
SSH2SimpleClient(SSH2Transport transport,
java.lang.String username,
SSH2Interactor interactor,
long timeout)
Constructor to use for keyboard interactive authentication.
|
SSH2SimpleClient(SSH2Transport transport,
java.lang.String username,
java.lang.String password)
Simple constructor to use for password authentication.
|
SSH2SimpleClient(SSH2Transport transport,
java.lang.String username,
java.lang.String password,
long timeout)
Simple constructor to use for password authentication.
|
SSH2SimpleClient(SSH2Transport transport,
java.lang.String username,
java.lang.String keyFile,
java.lang.String keyPassword)
Simple constructor to use for publickey authentication.
|
SSH2SimpleClient(SSH2Transport transport,
java.lang.String username,
java.lang.String keyFile,
java.lang.String keyPassword,
long timeout)
Simple constructor to use for publickey authentication.
|
Modifier and Type | Method and Description |
---|---|
SSH2Connection |
getConnection() |
SSH2Transport |
getTransport() |
protected SSH2Transport transport
protected SSH2Connection connection
protected SSH2UserAuth userAuth
public SSH2SimpleClient(SSH2Transport transport, java.lang.String username, java.lang.String password, long timeout) throws SSH2Exception
transport
- connected transport layerusername
- name of userpassword
- password of usertimeout
- timeout in milliseconds for authentication
phase (0 means no timeout)SSH2Exception
SSH2Transport
public SSH2SimpleClient(SSH2Transport transport, java.lang.String username, java.lang.String password) throws SSH2Exception
transport
- connected transport layerusername
- name of userpassword
- password of userSSH2Exception
SSH2Transport
public SSH2SimpleClient(SSH2Transport transport, java.lang.String username, java.lang.String keyFile, java.lang.String keyPassword) throws SSH2Exception, java.io.IOException
transport
- connected transport layerusername
- name of userkeyFile
- name of private key file to use for authenticationkeyPassword
- password protecting private key file (null if none)SSH2Exception
java.io.IOException
SSH2Transport
public SSH2SimpleClient(SSH2Transport transport, java.lang.String username, java.lang.String keyFile, java.lang.String keyPassword, long timeout) throws SSH2Exception, java.io.IOException
transport
- connected transport layerusername
- name of userkeyFile
- name of private key file to use for authenticationkeyPassword
- password protecting private key file (null if none)timeout
- timeout in milliseconds for authentication phase (0 means no timeout)SSH2Exception
java.io.IOException
SSH2Transport
public SSH2SimpleClient(SSH2Transport transport, boolean hostbased, java.lang.String username, java.lang.String keyFile, java.lang.String keyPassword) throws SSH2Exception, java.io.IOException
transport
- connected transport layerhostbased
- whether hostbased or publickey auth. should be used,
set to true to use hostbased, and false to use publickeyusername
- name of userkeyFile
- name of private key file to use for authenticationkeyPassword
- password protecting private key file (null if none)SSH2Exception
java.io.IOException
SSH2Transport
public SSH2SimpleClient(SSH2Transport transport, boolean hostbased, java.lang.String username, java.lang.String keyFile, java.lang.String keyPassword, long timeout) throws SSH2Exception, java.io.IOException
transport
- connected transport layerhostbased
- whether hostbased or publickey auth. should be used,
set to true to use hostbased, and false to use publickeyusername
- name of userkeyFile
- name of private key file to use for authenticationkeyPassword
- password protecting private key file (null if none)timeout
- timeout in milliseconds for authentication phase (0 means no timeout)SSH2Exception
java.io.IOException
SSH2Transport
public SSH2SimpleClient(SSH2Transport transport, java.lang.String username, SSH2Interactor interactor, long timeout) throws SSH2Exception
transport
- connected transport layerusername
- name of userinteractor
- interactor instance to handle user
interaction in authenticationtimeout
- timeout in milliseconds for authentication phase (0 means no timeout)SSH2Exception
SSH2Transport
public SSH2SimpleClient(SSH2Transport transport, java.lang.String username, SSH2Interactor interactor) throws SSH2Exception
transport
- connected transport layerusername
- name of userinteractor
- interactor instance to handle user
interaction in authenticationSSH2Exception
SSH2Transport
public SSH2SimpleClient(SSH2Transport transport, java.lang.String username, long timeout) throws SSH2Exception
transport
- connected transport layerusername
- name of usertimeout
- timeout in milliseconds for authentication phase (0 means no timeout)SSH2Exception
SSH2Transport
public SSH2SimpleClient(SSH2Transport transport, SSH2Authenticator authenticator) throws SSH2Exception
transport
- connected transport layerauthenticator
- authenticator instance prepared with needed methodsSSH2Exception
SSH2Transport
public SSH2SimpleClient(SSH2Transport transport, SSH2Authenticator authenticator, long timeout) throws SSH2Exception
transport
- connected transport layerauthenticator
- authenticator instance prepared with needed methodstimeout
- timeout in milliseconds for authentication phase (0 means no timeout)SSH2Exception
SSH2Transport
public SSH2Transport getTransport()
public SSH2Connection getConnection()