public class ClientSessionImpl extends AbstractSession implements ClientSession
AbstractSession.PendingWriteFutureSession.AttributeKey<T>| Modifier and Type | Field and Description |
|---|---|
protected AuthFuture |
authFuture |
attributes, authed, clientProposal, clientVersion, currentService, decodeLock, decoderBuffer, decoderLength, decoderState, encodeLock, factoryManager, I_C, I_S, 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, uncompressBuffer, usernameCLOSED, closeFuture, GRACEFUL, IMMEDIATE, lock, log, OPENED, stateAUTHED, CLOSED, TIMEOUT, WAIT_AUTH| Constructor and Description |
|---|
ClientSessionImpl(ClientFactoryManager client,
IoSession session) |
| 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 user)
Authenticate the session with the given username using an ssh agent.
|
AuthFuture |
authInteractive(java.lang.String user,
java.lang.String password)
Authenticate the session with the given username and password.
|
AuthFuture |
authPassword(java.lang.String user,
java.lang.String password)
Authenticate the session with the given username and password.
|
AuthFuture |
authPublicKey(java.lang.String user,
java.security.KeyPair key)
Authenticate the session with the given username and public key.
|
protected void |
checkKeys() |
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()
Retrieve the factory manager
|
java.util.Map<java.lang.Object,java.lang.Object> |
getMetadataMap()
Access to the metadata.
|
protected Service[] |
getServices() |
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) |
void |
resetIdleTimeout() |
protected void |
sendEvent(SessionListener.Event event) |
protected void |
sendInitialServiceRequest() |
protected void |
sendKexInit() |
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(java.lang.String name) |
void |
stopLocalPortForwarding(SshdSocketAddress local)
Stop forwarding the given local address.
|
void |
stopRemotePortForwarding(SshdSocketAddress remote)
Stop forwarding of the given remote address.
|
protected void |
switchToNextService() |
int |
waitFor(int mask,
long timeout)
Wait for a specific state.
|
addListener, attachSession, checkRekey, createBuffer, createBuffer, createProposal, decode, disconnect, doHandleMessage, doReadIdentification, doWritePacket, exceptionCaught, getAttribute, getClientVersion, getInnerCloseable, getIntProperty, getIoSession, getKex, getLock, getLongProperty, getServerVersion, getSession, getSession, getSessionId, getUsername, isAuthenticated, messageReceived, negotiate, notImplemented, postClose, receiveKexInit, receiveNewKeys, reExchangeKeys, removeListener, request, requestFailure, requestSuccess, sendIdentification, sendKexInit, sendNewKeys, serviceAccept, setAttribute, setAuthenticated, setUsername, toString, writePacketdoCloseGracefully, doCloseImmediatelycloseclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcloseaddListener, createBuffer, createBuffer, exceptionCaught, getAttribute, getClientVersion, getIntProperty, getServerVersion, getUsername, reExchangeKeys, removeListener, request, setAttribute, writePacketprotected AuthFuture authFuture
public ClientSessionImpl(ClientFactoryManager client, IoSession session) throws java.lang.Exception
java.lang.Exceptionprotected Service[] getServices()
getServices in class AbstractSessionpublic ClientFactoryManager getFactoryManager()
AbstractSessiongetFactoryManager in interface ClientSessiongetFactoryManager in interface SessiongetFactoryManager in class AbstractSessionpublic void addPasswordIdentity(java.lang.String password)
addPasswordIdentity in interface ClientSessionpublic void addPublicKeyIdentity(java.security.KeyPair key)
addPublicKeyIdentity in interface ClientSessionpublic AuthFuture auth() throws java.io.IOException
auth in interface ClientSessionjava.io.IOExceptionpublic AuthFuture authAgent(java.lang.String user) throws java.io.IOException
ClientSessionauthAgent in interface ClientSessionjava.io.IOExceptionpublic AuthFuture authPassword(java.lang.String user, java.lang.String password) throws java.io.IOException
ClientSessionauthPassword in interface ClientSessionjava.io.IOExceptionpublic AuthFuture authInteractive(java.lang.String user, java.lang.String password) throws java.io.IOException
ClientSessionauthInteractive in interface ClientSessionjava.io.IOExceptionpublic AuthFuture authPublicKey(java.lang.String user, java.security.KeyPair key) throws java.io.IOException
ClientSessionauthPublicKey in interface ClientSessionjava.io.IOExceptionprotected void switchToNextService()
throws java.io.IOException
java.io.IOExceptionpublic ClientChannel createChannel(java.lang.String type) throws java.io.IOException
ClientSessioncreateChannel(type, null).createChannel in interface ClientSessionjava.io.IOExceptionpublic ClientChannel createChannel(java.lang.String type, java.lang.String subType) throws java.io.IOException
ClientSessioncreateChannel in interface ClientSessionjava.io.IOExceptionpublic ChannelShell createShellChannel() throws java.io.IOException
ClientSessioncreateShellChannel in interface ClientSessionjava.io.IOExceptionpublic ChannelExec createExecChannel(java.lang.String command) throws java.io.IOException
ClientSessioncreateExecChannel in interface ClientSessionjava.io.IOExceptionpublic ChannelSubsystem createSubsystemChannel(java.lang.String subsystem) throws java.io.IOException
ClientSessioncreateSubsystemChannel in interface ClientSessionjava.io.IOExceptionpublic ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws java.io.IOException
ClientSessioncreateDirectTcpipChannel in interface ClientSessionjava.io.IOExceptionpublic ScpClient createScpClient()
ClientSessioncreateScpClient in interface ClientSessionpublic SftpClient createSftpClient() throws java.io.IOException
ClientSessioncreateSftpClient in interface ClientSessionjava.io.IOExceptionpublic SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws java.io.IOException
ClientSessionstartLocalPortForwarding in interface ClientSessionjava.io.IOExceptionpublic void stopLocalPortForwarding(SshdSocketAddress local) throws java.io.IOException
ClientSessionstopLocalPortForwarding in interface ClientSessionjava.io.IOExceptionpublic SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws java.io.IOException
ClientSessionstartRemotePortForwarding in interface ClientSessionjava.io.IOExceptionpublic void stopRemotePortForwarding(SshdSocketAddress remote) throws java.io.IOException
ClientSessionstopRemotePortForwarding in interface ClientSessionjava.io.IOExceptionprotected void handleMessage(Buffer buffer) throws java.lang.Exception
AbstractSessionhandleMessage in class AbstractSessionbuffer - the buffer containing the packetjava.lang.Exception - if an exeption occurs while handling this packet.public int waitFor(int mask,
long timeout)
ClientSessionwaitFor in interface ClientSessionprotected boolean readIdentification(Buffer buffer) throws java.io.IOException
AbstractSessionAbstractSession.doReadIdentification(org.apache.sshd.common.util.Buffer) 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 neededjava.io.IOException - if an error occurs such as a bad protocol versionprotected void sendKexInit()
throws java.io.IOException
sendKexInit in class AbstractSessionjava.io.IOExceptionprotected void receiveKexInit(Buffer buffer) throws java.io.IOException
receiveKexInit in class AbstractSessionjava.io.IOExceptionprotected void checkKeys()
throws SshException
checkKeys in class AbstractSessionSshExceptionprotected void sendEvent(SessionListener.Event event) throws java.io.IOException
sendEvent in class AbstractSessionjava.io.IOExceptionprotected void sendInitialServiceRequest()
throws java.io.IOException
java.io.IOExceptionpublic void startService(java.lang.String name)
throws java.lang.Exception
startService in class AbstractSessionjava.lang.Exceptionpublic void resetIdleTimeout()
resetIdleTimeout in class AbstractSessionpublic java.util.Map<java.lang.Object,java.lang.Object> getMetadataMap()
ClientSessiongetMetadataMap in interface ClientSessionCopyright © 2008-2014 The Apache Software Foundation. All Rights Reserved.