public abstract class AbstractClientSession extends AbstractSession implements ClientSession
AbstractCloseable.State
ClientSession.ClientSessionEvent
Session.AttributeKey<T>, Session.TimeoutStatus
SignatureFactoriesManager.Utils
attributes, authed, authTimeoutStart, channelListenerProxy, channelListeners, clientProposal, clientVersion, currentService, decodeLock, decoderBuffer, decoderLength, decoderState, encodeLock, firstKexPacketFollows, i_c, i_s, idleTimeoutStart, ignorePacketDataLength, ignorePacketsCount, ignorePacketsFrequency, ignorePacketsVariance, inBlocksCount, inBytesCount, inCipher, inCipherSize, inCompression, inMac, inMacResult, inPacketsCount, ioSession, isServer, kex, kexFutureHolder, kexState, lastKeyTimeValue, maxRekeyBlocks, maxRekeyBytes, maxRekeyInterval, maxRekyPackets, negotiationResult, outBlocksCount, outBytesCount, outCipher, outCipherSize, outCompression, outMac, outPacketsCount, pendingPackets, random, requestLock, seqi, seqo, serverProposal, serverVersion, SESSION, sessionId, sessionListenerProxy, sessionListeners, timeoutStatus, uncompressBuffer, username
closeFuture, lock, state
log
DEFAULT_SSH_VERSION_PREFIX
DEFAULT_PASSWORD_PROMPTS, PASSWORD_PROMPTS, PREFERRED_AUTHS
Modifier | Constructor and Description |
---|---|
protected |
AbstractClientSession(ClientFactoryManager factoryManager,
IoSession ioSession) |
addChannelListener, addSessionListener, attachSession, calculateNextIgnorePacketCount, checkAuthenticationTimeout, checkForTimeouts, checkIdleTimeout, checkKeys, checkRekey, comparePreferredKexProposalOption, createBuffer, createBuffer, createProposal, decode, disconnect, doHandleMessage, doReadIdentification, doWritePacket, encode, exceptionCaught, getAttribute, getAuthTimeout, getChannelListenerProxy, getCipherInformation, getClientVersion, getCompressionInformation, getIdleTimeout, getInnerCloseable, getIoSession, getKex, getLock, getMacInformation, getNegotiatedKexParameter, getParentPropertyResolver, getProperties, getServerVersion, getService, getServices, getSession, getSession, getSessionId, getSessionListenerProxy, getTimeoutStatus, getUsername, handleDebug, handleDebug, handleDisconnect, handleDisconnect, handleFirstKexPacketFollows, handleIgnore, handleIgnore, handleKexInit, handleKexMessage, handleMessage, handleNewKeys, handleServiceAccept, handleServiceAccept, handleServiceRequest, handleServiceRequest, handleUnimplemented, handleUnimplemented, isAuthenticated, isRekeyBlocksCountExceeded, isRekeyDataSizeExceeded, isRekeyPacketCountsExceeded, isRekeyRequired, isRekeyTimeIntervalExceeded, mergeProposals, messageReceived, negotiate, notImplemented, preClose, prepareBuffer, readIdentification, receiveKexInit, receiveKexInit, receiveKexInit, receiveNewKeys, reExchangeKeys, refreshConfiguration, removeChannelListener, removeSessionListener, request, requestFailure, requestNewKeysExchange, requestSuccess, resetIdleTimeout, resizeKey, resolveAvailableSignaturesProposal, resolveIgnoreBufferDataLength, sendIdentification, sendKexInit, sendKexInit, sendNewKeys, sendSessionEvent, serviceAccept, setAttribute, setAuthenticated, setKexSeed, setNegotiationResult, setUsername, toString, validateKexState, writePacket, writePacket
getCipherFactories, getCompressionFactories, getKeyExchangeFactories, getKeyPairProvider, getMacFactories, getSignatureFactories, resolveEffectiveFactories, resolveEffectiveProvider, setCipherFactories, setCompressionFactories, setKeyExchangeFactories, setKeyPairProvider, setMacFactories, setSignatureFactories
doCloseGracefully, doCloseImmediately
builder, close, isClosed, isClosing
close, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
auth, createShellChannel, getMetadataMap, switchToNoneCipher, waitFor
createBuffer, createBuffer, disconnect, exceptionCaught, getAttribute, getAuthTimeout, getCipherInformation, getClientVersion, getCompressionInformation, getIdleTimeout, getIoSession, getKex, getMacInformation, getNegotiatedKexParameter, getServerVersion, getService, getSessionId, getTimeoutStatus, isAuthenticated, prepareBuffer, reExchangeKeys, request, resetIdleTimeout, setAttribute, setAuthenticated, writePacket, writePacket
getCipherFactories, getCompressionFactories, getKeyExchangeFactories, getMacFactories, setCipherFactories, setCompressionFactories, setKeyExchangeFactories, setMacFactories
getKeyPairProvider, setKeyPairProvider
getSignatureFactories, setSignatureFactories
addSessionListener, getSessionListenerProxy, removeSessionListener
addChannelListener, getChannelListenerProxy, removeChannelListener
getParentPropertyResolver, getProperties
setUsername
getUsername
protected AbstractClientSession(ClientFactoryManager factoryManager, IoSession ioSession)
public ClientFactoryManager getFactoryManager()
getFactoryManager
in interface ClientSession
getFactoryManager
in interface Session
getFactoryManager
in class AbstractSession
FactoryManager
that has created this session, can not be null
public ServerKeyVerifier getServerKeyVerifier()
ClientAuthenticationManager
getServerKeyVerifier
in interface ClientAuthenticationManager
ServerKeyVerifier
to use - never null
public void setServerKeyVerifier(ServerKeyVerifier serverKeyVerifier)
setServerKeyVerifier
in interface ClientAuthenticationManager
public UserInteraction getUserInteraction()
getUserInteraction
in interface ClientAuthenticationManager
UserInteraction
object to communicate with the user
(may be null
to indicate that no such communication is allowed)public void setUserInteraction(UserInteraction userInteraction)
setUserInteraction
in interface ClientAuthenticationManager
public List<NamedFactory<UserAuth>> getUserAuthFactories()
getUserAuthFactories
in interface ClientAuthenticationManager
List
of UserAuth
NamedFactory
-ies - never
null
/emptypublic void setUserAuthFactories(List<NamedFactory<UserAuth>> userAuthFactories)
setUserAuthFactories
in interface ClientAuthenticationManager
public AuthenticationIdentitiesProvider getRegisteredIdentities()
getRegisteredIdentities
in interface ClientAuthenticationManager
public PasswordIdentityProvider getPasswordIdentityProvider()
getPasswordIdentityProvider
in interface ClientAuthenticationManager
public void setPasswordIdentityProvider(PasswordIdentityProvider provider)
setPasswordIdentityProvider
in interface ClientAuthenticationManager
public void addPasswordIdentity(String password)
addPasswordIdentity
in interface ClientAuthenticationManager
password
- Password to be added - may not be null
/empty.
Note: this password is in addition to whatever passwords
are available via the PasswordIdentityProvider
(if any)public String removePasswordIdentity(String password)
removePasswordIdentity
in interface ClientAuthenticationManager
password
- The password to remove - ignored if null
/emptyClientAuthenticationManager.addPasswordIdentity(String)
- or null
if no
match foundpublic void addPublicKeyIdentity(KeyPair kp)
addPublicKeyIdentity
in interface ClientAuthenticationManager
kp
- The KeyPair
to add - may not be null
Note: this key is in addition to whatever keys
are available via the KeyIdentityProvider
(if any)public KeyPair removePublicKeyIdentity(KeyPair kp)
removePublicKeyIdentity
in interface ClientAuthenticationManager
kp
- The KeyPair
to remove - ignored if null
KeyPair
- same one that was added via
ClientAuthenticationManager.addPublicKeyIdentity(KeyPair)
- or null
if no
match foundpublic ClientChannel createChannel(String type) throws IOException
ClientSession
createChannel(type, null)
.createChannel
in interface ClientSession
type
- The channel typeClientChannel
IOException
- If failed to create the requested channelpublic ClientChannel createChannel(String type, String subType) throws IOException
ClientSession
createChannel
in interface ClientSession
type
- The channel typesubType
- The channel sub-typeClientChannel
IOException
- If failed to create the requested channelpublic ChannelExec createExecChannel(String command) throws IOException
ClientSession
createExecChannel
in interface ClientSession
command
- The command to executeChannelExec
IOException
- If failed to create the requested channelpublic ChannelSubsystem createSubsystemChannel(String subsystem) throws IOException
ClientSession
createSubsystemChannel
in interface ClientSession
subsystem
- The subsystem nameChannelSubsystem
IOException
- If failed to create the requested channelpublic ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws IOException
ClientSession
createDirectTcpipChannel
in interface ClientSession
local
- The local addressremote
- The remote addressChannelDirectTcpip
IOException
- If failed to create the requested channelprotected ClientUserAuthService getUserAuthService()
protected ConnectionService getConnectionService()
public ScpTransferEventListener getScpTransferEventListener()
getScpTransferEventListener
in interface ClientSession
ScpTransferEventListener
set via
ClientSession.setScpTransferEventListener(ScpTransferEventListener)
public void setScpTransferEventListener(ScpTransferEventListener listener)
setScpTransferEventListener
in interface ClientSession
listener
- A default ScpTransferEventListener
that can be used
to receive information about the SCP operations - may be null
to indicate no more events are requiredClientSession.createScpClient(ScpTransferEventListener)
public ScpClient createScpClient()
ClientSession
createScpClient
in interface ClientSession
ScpClient
instance. Note: uses the currently
registered ScpTransferEventListener
if anyClientSession.setScpTransferEventListener(ScpTransferEventListener)
public ScpClient createScpClient(ScpTransferEventListener listener)
ClientSession
createScpClient
in interface ClientSession
listener
- A ScpTransferEventListener
that can be used
to receive information about the SCP operations - may be null
to indicate no more events are required. Note: this listener
is used instead of any listener set via ClientSession.setScpTransferEventListener(ScpTransferEventListener)
ScpClient
instancepublic SftpClient createSftpClient() throws IOException
ClientSession
createSftpClient
in interface ClientSession
SftpClient
IOException
- if failed to create the clientpublic SftpClient createSftpClient(int version) throws IOException
ClientSession
createSftpClient
in interface ClientSession
version
- The version to use - Note: if the specified
version is not supported by the server then an exception
will occurSftpClient
IOException
- If failed to create the client or use the specified versionpublic SftpClient createSftpClient(SftpVersionSelector selector) throws IOException
ClientSession
createSftpClient
in interface ClientSession
selector
- The SftpVersionSelector
to use - Note:
if the server does not support versions re-negotiation then the
selector will be presented with only one "choice" - the
current versionSftpClient
IOException
- If failed to create the client or re-negotiatepublic FileSystem createSftpFileSystem() throws IOException
createSftpFileSystem
in interface ClientSession
IOException
public FileSystem createSftpFileSystem(int version) throws IOException
createSftpFileSystem
in interface ClientSession
IOException
public FileSystem createSftpFileSystem(SftpVersionSelector selector) throws IOException
createSftpFileSystem
in interface ClientSession
IOException
public FileSystem createSftpFileSystem(int version, int readBufferSize, int writeBufferSize) throws IOException
createSftpFileSystem
in interface ClientSession
IOException
public FileSystem createSftpFileSystem(int readBufferSize, int writeBufferSize) throws IOException
createSftpFileSystem
in interface ClientSession
IOException
public FileSystem createSftpFileSystem(SftpVersionSelector selector, int readBufferSize, int writeBufferSize) throws IOException
createSftpFileSystem
in interface ClientSession
IOException
public SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws IOException
ClientSession
startLocalPortForwarding
in interface ClientSession
local
- The local addressremote
- The remote addressSshdSocketAddress
IOException
- If failed to create the requested bindingpublic void stopLocalPortForwarding(SshdSocketAddress local) throws IOException
ClientSession
stopLocalPortForwarding
in interface ClientSession
local
- The local addressIOException
- If failed to cancel the requested bindingpublic SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException
ClientSession
Start forwarding tcpip from the given address on the server to the given address on the client.
The remote host name is the address to bind to on the server:startRemotePortForwarding
in interface ClientSession
remote
- The remote addresslocal
- The local addressSshdSocketAddress
IOException
- If failed to create the requested bindingpublic void stopRemotePortForwarding(SshdSocketAddress remote) throws IOException
ClientSession
stopRemotePortForwarding
in interface ClientSession
remote
- The remote addressIOException
- If failed to cancel the requested bindingpublic SshdSocketAddress startDynamicPortForwarding(SshdSocketAddress local) throws IOException
ClientSession
startDynamicPortForwarding
in interface ClientSession
local
- The local addressSshdSocketAddress
IOException
- If failed to create the requested bindingpublic void stopDynamicPortForwarding(SshdSocketAddress local) throws IOException
ClientSession
stopDynamicPortForwarding
in interface ClientSession
local
- The local addressIOException
- If failed to cancel the requested bindingprotected TcpipForwarder getTcpipForwarder()
protected String resolveAvailableSignaturesProposal(FactoryManager manager)
resolveAvailableSignaturesProposal
in class AbstractSession
manager
- The FactoryManager
null
/empty if no proposalpublic void startService(String name) throws Exception
startService
in interface Session
name
- Service nameException
- If failed to start itCopyright © 2008–2016 The Apache Software Foundation. All rights reserved.