public class ClientSessionImpl extends AbstractSession implements ClientSession
AbstractSession.PendingWriteFutureCloseableUtils.AbstractCloseable.StateSession.AttributeKey<T>, Session.TimeoutStatus| Modifier and Type | Field and Description |
|---|---|
protected AuthFuture |
authFuture |
attributes, authed, authTimeoutMs, authTimeoutTimestamp, clientProposal, clientVersion, currentService, decodeLock, decoderBuffer, decoderLength, decoderState, disconnectTimeoutMs, encodeLock, factoryManager, I_C, I_S, idleTimeoutMs, idleTimeoutTimestamp, inBytes, inCipher, inCipherSize, inCompression, inMac, inMacResult, inPackets, ioSession, isServer, kex, KEX_STATE_DONE, KEX_STATE_INIT, KEX_STATE_KEYS, KEX_STATE_RUN, kexState, lastKeyTime, listeners, negotiated, outBytes, outCipher, outCipherSize, outCompression, outMac, outPackets, pendingPackets, random, reexchangeFuture, requestLock, requestResult, seqi, seqo, serverProposal, serverVersion, SESSION, sessionId, sessionListenerProxy, timeoutStatus, uncompressBuffer, usernamecloseFuture, lock, log, stateAUTHED, CLOSED, TIMEOUT, WAIT_AUTH| Constructor and Description |
|---|
ClientSessionImpl(ClientFactoryManager client,
IoSession session) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPasswordIdentity(String password) |
void |
addPublicKeyIdentity(KeyPair key) |
AuthFuture |
auth()
Starts the authentication process.
|
AuthFuture |
authAgent(String user)
Authenticate the session with the given username using an ssh agent.
|
AuthFuture |
authInteractive(String user,
String password)
Authenticate the session with the given username and password.
|
AuthFuture |
authPassword(String user,
String password)
Authenticate the session with the given username and password.
|
AuthFuture |
authPublicKey(String user,
KeyPair key)
Authenticate the session with the given username and public key.
|
protected void |
checkKeys() |
ClientChannel |
createChannel(String type)
Create a channel of the given type.
|
ClientChannel |
createChannel(String type,
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(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(String subsystem)
Create a subsystem channel.
|
ClientFactoryManager |
getFactoryManager()
Retrieve the factory manager
|
Map<Object,Object> |
getMetadataMap()
Access to the metadata.
|
protected Service[] |
getServices() |
UserInteraction |
getUserInteraction() |
protected void |
handleMessage(Buffer buffer)
Abstract method for processing incoming decoded packets.
|
protected boolean |
readIdentification(Buffer buffer)
Read the other side identification.
|
protected void |
receiveKexInit(Buffer buffer) |
protected void |
sendEvent(SessionListener.Event event) |
protected void |
sendInitialServiceRequest() |
protected void |
sendKexInit() |
void |
setUserInteraction(UserInteraction userInteraction) |
SshdSocketAddress |
startDynamicPortForwarding(SshdSocketAddress local)
Start dynamic local port forwarding using a SOCKS proxy.
|
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 |
startService(String name) |
void |
stopDynamicPortForwarding(SshdSocketAddress local)
Stop a previously started dynamic port forwarding.
|
void |
stopLocalPortForwarding(SshdSocketAddress local)
Stop forwarding the given local address.
|
void |
stopRemotePortForwarding(SshdSocketAddress remote)
Stop forwarding of the given remote address.
|
protected void |
switchToNextService() |
SshFuture |
switchToNoneCipher()
Switch to a none cipher for performance.
|
int |
waitFor(int mask,
long timeout)
Wait for a specific state.
|
addListener, attachSession, checkForTimeouts, checkRekey, createBuffer, createBuffer, createProposal, decode, disconnect, doCloseImmediately, doHandleMessage, doReadIdentification, doWritePacket, exceptionCaught, getAttribute, getAuthTimeout, getClientVersion, getIdleTimeout, getInnerCloseable, getIntProperty, getIoSession, getKex, getLock, getLongProperty, getNegotiatedKexParameter, getServerVersion, getService, getSession, getSession, getSessionId, getTimeoutStatus, getUsername, isAuthenticated, messageReceived, negotiate, notImplemented, receiveKexInit, receiveNewKeys, reExchangeKeys, removeListener, request, requestFailure, requestSuccess, resetIdleTimeout, sendIdentification, sendKexInit, sendNewKeys, serviceAccept, setAttribute, setAuthenticated, setUsername, toString, writePacket, writePacketdoCloseGracefullybuilder, close, isClosed, isClosing, preCloseclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcloseaddListener, createBuffer, createBuffer, exceptionCaught, getAttribute, getAuthTimeout, getClientVersion, getIdleTimeout, getIntProperty, getIoSession, getNegotiatedKexParameter, getServerVersion, getService, getTimeoutStatus, getUsername, reExchangeKeys, removeListener, request, resetIdleTimeout, setAttribute, writePacket, writePacketprotected AuthFuture authFuture
public ClientSessionImpl(ClientFactoryManager client, IoSession session) throws Exception
Exceptionprotected Service[] getServices()
getServices in class AbstractSessionpublic ClientFactoryManager getFactoryManager()
AbstractSessiongetFactoryManager in interface ClientSessiongetFactoryManager in interface SessiongetFactoryManager in class AbstractSessionpublic void addPasswordIdentity(String password)
addPasswordIdentity in interface ClientSessionpublic void addPublicKeyIdentity(KeyPair key)
addPublicKeyIdentity in interface ClientSessionpublic UserInteraction getUserInteraction()
getUserInteraction in interface ClientSessionpublic void setUserInteraction(UserInteraction userInteraction)
setUserInteraction in interface ClientSessionpublic AuthFuture auth() throws IOException
ClientSessionClientSession.addPasswordIdentity(String) or ClientSession.addPublicKeyIdentity(java.security.KeyPair).auth in interface ClientSessionIOExceptionClientSession.addPasswordIdentity(String),
ClientSession.addPublicKeyIdentity(java.security.KeyPair)public AuthFuture authAgent(String user) throws IOException
ClientSessionauthAgent in interface ClientSessionIOExceptionClientSession.auth()public AuthFuture authPassword(String user, String password) throws IOException
ClientSessionauthPassword in interface ClientSessionIOExceptionClientSession.auth()public AuthFuture authInteractive(String user, String password) throws IOException
ClientSessionauthInteractive in interface ClientSessionIOExceptionClientSession.auth()public AuthFuture authPublicKey(String user, KeyPair key) throws IOException
ClientSessionauthPublicKey in interface ClientSessionIOExceptionClientSession.auth()protected void switchToNextService()
throws IOException
IOExceptionpublic SshFuture switchToNoneCipher() throws IOException
ClientSessionswitchToNoneCipher in interface ClientSessionSshFuture that can be used to wait for the exchange
to be finishedIOException - if a key exchange is already runningpublic ClientChannel createChannel(String type) throws IOException
ClientSessioncreateChannel(type, null).createChannel in interface ClientSessionIOExceptionpublic ClientChannel createChannel(String type, String subType) throws IOException
ClientSessioncreateChannel in interface ClientSessionIOExceptionpublic ChannelShell createShellChannel() throws IOException
ClientSessioncreateShellChannel in interface ClientSessionIOExceptionpublic ChannelExec createExecChannel(String command) throws IOException
ClientSessioncreateExecChannel in interface ClientSessionIOExceptionpublic ChannelSubsystem createSubsystemChannel(String subsystem) throws IOException
ClientSessioncreateSubsystemChannel in interface ClientSessionIOExceptionpublic ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws IOException
ClientSessioncreateDirectTcpipChannel in interface ClientSessionIOExceptionpublic ScpClient createScpClient()
ClientSessioncreateScpClient in interface ClientSessionpublic SftpClient createSftpClient() throws IOException
ClientSessioncreateSftpClient in interface ClientSessionIOExceptionpublic SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws IOException
ClientSessionstartLocalPortForwarding in interface ClientSessionIOExceptionpublic void stopLocalPortForwarding(SshdSocketAddress local) throws IOException
ClientSessionstopLocalPortForwarding in interface ClientSessionIOExceptionpublic SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException
ClientSessionstartRemotePortForwarding in interface ClientSessionIOExceptionpublic void stopRemotePortForwarding(SshdSocketAddress remote) throws IOException
ClientSessionstopRemotePortForwarding in interface ClientSessionIOExceptionpublic SshdSocketAddress startDynamicPortForwarding(SshdSocketAddress local) throws IOException
ClientSessionstartDynamicPortForwarding in interface ClientSessionIOExceptionpublic void stopDynamicPortForwarding(SshdSocketAddress local) throws IOException
ClientSessionstopDynamicPortForwarding in interface ClientSessionIOExceptionprotected void handleMessage(Buffer buffer) throws Exception
AbstractSessionhandleMessage in class AbstractSessionbuffer - the buffer containing the packetException - if an exeption occurs while handling this packet.public int waitFor(int mask,
long timeout)
ClientSessionwaitFor in interface ClientSessionprotected boolean readIdentification(Buffer buffer) throws IOException
AbstractSessionAbstractSession.doReadIdentification(org.apache.sshd.common.util.Buffer,boolean) and
store the result in the needed property.readIdentification in class AbstractSessionbuffer - the buffer containing the remote identificationtrue if the identification has been fully read or
false if more data is neededIOException - if an error occurs such as a bad protocol versionprotected void sendKexInit()
throws IOException
sendKexInit in class AbstractSessionIOExceptionprotected void receiveKexInit(Buffer buffer) throws IOException
receiveKexInit in class AbstractSessionIOExceptionprotected void checkKeys()
throws SshException
checkKeys in class AbstractSessionSshExceptionprotected void sendEvent(SessionListener.Event event) throws IOException
sendEvent in class AbstractSessionIOExceptionprotected void sendInitialServiceRequest()
throws IOException
IOExceptionpublic void startService(String name) throws Exception
startService in class AbstractSessionExceptionpublic Map<Object,Object> getMetadataMap()
ClientSessiongetMetadataMap in interface ClientSessionCopyright © 2008–2015 The Apache Software Foundation. All rights reserved.