public interface ClientSession extends Session
SshClient.
Once the session has been created, the user has to authenticate
using either authPassword(String, String) or
authPublicKey(String, java.security.KeyPair).
From this session, channels can be created using the
createChannel(String) method. Multiple channels can
be created on a given session concurrently.
When using the client in an interactive mode, the
waitFor(int, long) method can be used to listen to specific
events such as the session being established, authenticated or closed.
When a given session is no longer used, it must be closed using the
close(boolean) method.Session.AttributeKey<T>| Modifier and Type | Field and Description |
|---|---|
static int |
AUTHED |
static int |
CLOSED |
static int |
TIMEOUT |
static int |
WAIT_AUTH |
| Modifier and Type | Method and Description |
|---|---|
void |
addPasswordIdentity(java.lang.String password) |
void |
addPublicKeyIdentity(java.security.KeyPair key) |
AuthFuture |
auth() |
AuthFuture |
authAgent(java.lang.String username)
Deprecated.
|
AuthFuture |
authInteractive(java.lang.String username,
java.lang.String password)
Deprecated.
|
AuthFuture |
authPassword(java.lang.String username,
java.lang.String password)
Deprecated.
|
AuthFuture |
authPublicKey(java.lang.String username,
java.security.KeyPair key)
Deprecated.
|
CloseFuture |
close(boolean immediately)
Close this session.
|
ClientChannel |
createChannel(java.lang.String type)
Create a channel of the given type.
|
ClientChannel |
createChannel(java.lang.String type,
java.lang.String subType)
Create a channel of the given type and subtype.
|
ChannelDirectTcpip |
createDirectTcpipChannel(SshdSocketAddress local,
SshdSocketAddress remote)
Create a direct tcp-ip channel which can be used to stream data to a remote port from the server.
|
ChannelExec |
createExecChannel(java.lang.String command)
Create a channel to execute a command.
|
ScpClient |
createScpClient()
Create an SCP client from this session.
|
SftpClient |
createSftpClient()
Create an SFTP client from this session.
|
ChannelShell |
createShellChannel()
Create a channel to start a shell.
|
ChannelSubsystem |
createSubsystemChannel(java.lang.String subsystem)
Create a subsystem channel.
|
ClientFactoryManager |
getFactoryManager()
Return ClientFactoryManager for this session.
|
java.util.Map<java.lang.Object,java.lang.Object> |
getMetadataMap()
Access to the metadata.
|
SshdSocketAddress |
startLocalPortForwarding(SshdSocketAddress local,
SshdSocketAddress remote)
Start forwarding the given local address on the client to the given address on the server.
|
SshdSocketAddress |
startRemotePortForwarding(SshdSocketAddress remote,
SshdSocketAddress local)
Start forwarding tcpip from the given address on the server to the
given address on the client.
|
void |
stopLocalPortForwarding(SshdSocketAddress local)
Stop forwarding the given local address.
|
void |
stopRemotePortForwarding(SshdSocketAddress remote)
Stop forwarding of the given remote address.
|
int |
waitFor(int mask,
long timeout)
Wait for a specific state.
|
addListener, createBuffer, createBuffer, exceptionCaught, getAttribute, getClientVersion, getIntProperty, getServerVersion, getUsername, reExchangeKeys, removeListener, request, setAttribute, writePacketstatic final int TIMEOUT
static final int CLOSED
static final int WAIT_AUTH
static final int AUTHED
void addPasswordIdentity(java.lang.String password)
void addPublicKeyIdentity(java.security.KeyPair key)
AuthFuture auth() throws java.io.IOException
java.io.IOException@Deprecated AuthFuture authAgent(java.lang.String username) throws java.io.IOException
java.io.IOException@Deprecated AuthFuture authPassword(java.lang.String username, java.lang.String password) throws java.io.IOException
java.io.IOException@Deprecated AuthFuture authInteractive(java.lang.String username, java.lang.String password) throws java.io.IOException
java.io.IOException@Deprecated AuthFuture authPublicKey(java.lang.String username, java.security.KeyPair key) throws java.io.IOException
java.io.IOExceptionClientChannel createChannel(java.lang.String type) throws java.io.IOException
createChannel(type, null).java.io.IOExceptionClientChannel createChannel(java.lang.String type, java.lang.String subType) throws java.io.IOException
java.io.IOExceptionChannelShell createShellChannel() throws java.io.IOException
java.io.IOExceptionChannelExec createExecChannel(java.lang.String command) throws java.io.IOException
java.io.IOExceptionChannelSubsystem createSubsystemChannel(java.lang.String subsystem) throws java.io.IOException
java.io.IOExceptionChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws java.io.IOException
java.io.IOExceptionScpClient createScpClient()
SftpClient createSftpClient() throws java.io.IOException
java.io.IOExceptionSshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws java.io.IOException
java.io.IOExceptionvoid stopLocalPortForwarding(SshdSocketAddress local) throws java.io.IOException
java.io.IOExceptionSshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws java.io.IOException
java.io.IOExceptionvoid stopRemotePortForwarding(SshdSocketAddress remote) throws java.io.IOException
java.io.IOExceptionint waitFor(int mask,
long timeout)
CloseFuture close(boolean immediately)
java.util.Map<java.lang.Object,java.lang.Object> getMetadataMap()
ClientFactoryManager getFactoryManager()
getFactoryManager in interface SessionCopyright © 2008-2014 The Apache Software Foundation. All Rights Reserved.