public class ClientSessionImpl extends AbstractClientSession
ClientSession
AbstractSession.MessageCodingSettings
AbstractCloseable.State
ClientSession.ClientSessionEvent
SessionHeartbeatController.HeartbeatType
AttributeRepository.AttributeKey<T>
sendImmediateClientIdentification, sendImmediateKexInit
channelListenerProxy, channelListeners, clientProposal, clientVersion, currentService, decodeLock, decoderBuffer, decoderLength, decoderState, encodeLock, firstKexPacketFollows, ignorePacketDataLength, ignorePacketsCount, ignorePacketsFrequency, ignorePacketsVariance, inBlocksCount, inBytesCount, inCipher, inCipherSize, inCompression, initialKexDone, inMac, inMacResult, inMacSize, inPacketsCount, inSettings, kex, kexFutureHolder, kexHandler, kexInitializedFuture, kexState, lastKeyTimeValue, maxRekeyBlocks, maxRekeyBytes, maxRekeyInterval, maxRekyPackets, negotiationResult, outBlocksCount, outBytesCount, outCipher, outCipherSize, outCompression, outMac, outMacSize, outPacketsCount, outSettings, random, requestLock, seqi, seqo, serverProposal, serverVersion, SESSION, sessionId, sessionListenerProxy, sessionListeners, tunnelListenerProxy, tunnelListeners, uncompressBuffer, unmodClientProposal, unmodNegotiationResult, unmodServerProposal
authStart, idleStart, initialKexProposal
closeFuture, futureLock, state
log
REMOTE_COMMAND_WAIT_EVENTS
DEFAULT_SSH_VERSION_PREFIX, FALLBACK_SSH_VERSION_PREFIX, MAX_VERSION_LINE_LENGTH
EMPTY
NONE
Constructor and Description |
---|
ClientSessionImpl(ClientFactoryManager client,
IoSession ioSession) |
Modifier and Type | Method and Description |
---|---|
AuthFuture |
auth()
Starts the authentication process.
|
void |
exceptionCaught(Throwable t)
Handle any exceptions that occurred on this session.
|
Map<Object,Object> |
getMetadataMap()
Access to the metadata.
|
protected List<Service> |
getServices() |
Set<ClientSession.ClientSessionEvent> |
getSessionState() |
protected void |
handleDisconnect(int code,
String msg,
String lang,
Buffer buffer) |
protected CurrentService |
initializeCurrentService()
Creates a new
CurrentService instance managing this session's current SSH service. |
protected String |
nextServiceName() |
protected void |
preClose()
preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately.
|
protected void |
sendInitialServiceRequest() |
protected void |
signalAuthFailure(Throwable t) |
protected void |
signalSessionEvent(SessionListener.Event event)
Sends a session event to all currently registered session listeners
|
void |
switchToNextService() |
protected <C extends Collection<ClientSession.ClientSessionEvent>> |
updateCurrentSessionState(C state) |
Set<ClientSession.ClientSessionEvent> |
waitFor(Collection<ClientSession.ClientSessionEvent> mask,
long timeout)
Wait for any one of a specific state to be signaled.
|
addPasswordIdentity, addPublicKeyIdentity, checkKeys, createChannel, createChannel, createDirectTcpipChannel, createExecChannel, createShellChannel, createSubsystemChannel, getClientProxyConnector, getConnectAddress, getConnectionContext, getConnectionService, getFactoryManager, getForwarder, getHostBasedAuthenticationReporter, getKeyIdentityProvider, getPasswordAuthenticationReporter, getPasswordIdentityProvider, getPublicKeyAuthenticationReporter, getRegisteredIdentities, getServerKey, getServerKeyVerifier, getUserAuthFactories, getUserAuthService, getUserInteraction, initializeKeyExchangePhase, initializeProxyConnector, readIdentification, receiveKexInit, receiveKexInit, removePasswordIdentity, removePublicKeyIdentity, resolveAvailableSignaturesProposal, sendClientIdentification, sendKexInit, setClientProxyConnector, setConnectAddress, setHostBasedAuthenticationReporter, setKexSeed, setKeyIdentityProvider, setPasswordAuthenticationReporter, setPasswordIdentityProvider, setPublicKeyAuthenticationReporter, setServerKey, setServerKeyVerifier, setUserAuthFactories, setUserInteraction, signalExtraServerVersionInfo, startDynamicPortForwarding, startLocalPortForwarding, startRemotePortForwarding, startService, stopDynamicPortForwarding, stopLocalPortForwarding, stopRemotePortForwarding, switchToNoneCipher
addChannelListener, addPortForwardingEventListener, addSessionListener, aeadOutgoingBuffer, appendOutgoingMac, attachSession, calculatePadLength, checkRekey, comparePreferredKexProposalOption, createBuffer, decode, determineRekeyBlockLimit, doHandleMessage, doInvokeUnimplementedMessageHandler, doKexNegotiation, doWritePacket, encode, encryptOutgoingBuffer, getChannelListenerProxy, getCipherInformation, getClientKexData, getClientKexProposals, getClientVersion, getCompressionInformation, getInnerCloseable, getKex, getKexNegotiationResult, getKexState, getMacInformation, getNegotiatedKexParameter, getPortForwardingEventListenerProxy, getServerKexData, getServerKexProposals, getServerVersion, getService, getSession, getSession, getSessionId, getSessionListenerProxy, handleFirstKexPacketFollows, handleKexExtension, handleKexInit, handleKexMessage, handleMessage, handleNewCompression, handleNewKeys, handleServiceAccept, handleServiceAccept, handleServiceRequest, handleServiceRequest, initializeKeyExchangeMessageHandler, isRekeyBlocksCountExceeded, isRekeyDataSizeExceeded, isRekeyPacketCountsExceeded, isRekeyRequired, isRekeyTimeIntervalExceeded, messageReceived, negotiate, notImplemented, prepareBuffer, prepareNewKeys, preProcessEncodeBuffer, receiveKexInit, reExchangeKeys, refreshConfiguration, removeChannelListener, removePortForwardingEventListener, removeSessionListener, request, request, requestFailure, requestNewKeysExchange, requestSuccess, resolveIgnoreBufferDataLength, resolveOutputPacket, resolveSessionKexProposal, sendKexInit, sendNewKeys, setClientKexData, setInputEncoding, setNegotiationResult, setOutputEncoding, setServerKexData, validateIncomingMac, validateKexState, validateServiceKexState, validateTargetBuffer, writePacket, writePacket
attributeKeys, calculateNextIgnorePacketCount, checkAuthenticationTimeout, checkForTimeouts, checkIdleTimeout, clearAttributes, computeAttributeIfAbsent, createProposal, disconnect, doInvokeDebugMessageHandler, doInvokeIgnoreMessageHandler, doReadIdentification, getAttribute, getAttributesCount, getAuthTimeout, getAuthTimeoutStart, getBoundLocalPortForwards, getBoundRemotePortForward, getChannelStreamWriterResolver, getIdleTimeout, getIdleTimeoutStart, getIoSession, getKexProposal, getLocalForwardsBindings, getParentPropertyResolver, getProperties, getRemoteForwardsBindings, getReservedSessionMessagesHandler, getSessionDisconnectHandler, getStartedLocalPortForwards, getStartedRemotePortForwards, getTimeoutStatus, getUnknownChannelReferenceHandler, getUsername, handleDebug, handleDisconnect, handleIgnore, handleUnimplemented, invokeSessionSignaller, isAuthenticated, isLocalPortForwardingStartedForPort, isRemotePortForwardingStartedForPort, isServerSession, mergeProposals, removeAttribute, resetAuthTimeout, resetIdleTimeout, resizeKey, resolveAvailableSignaturesProposal, resolveChannelStreamWriterResolver, resolveIdentificationString, resolvePeerAddress, resolveReservedSessionMessagesHandler, resolveUnknownChannelReferenceHandler, sendDebugMessage, sendIdentification, sendIgnoreMessage, sendNotImplemented, setAttribute, setAuthenticated, setChannelStreamWriterResolver, setReservedSessionMessagesHandler, setSessionDisconnectHandler, setUnknownChannelReferenceHandler, setUsername, signalDisconnect, signalDisconnect, signalExceptionCaught, signalExceptionCaught, signalNegotiationEnd, signalNegotiationEnd, signalNegotiationOptionsCreated, signalNegotiationOptionsCreated, signalNegotiationStart, signalNegotiationStart, signalPeerIdentificationReceived, signalPeerIdentificationReceived, signalReadPeerIdentificationLine, signalReadPeerIdentificationLine, signalSendIdentification, signalSendIdentification, signalSessionClosed, signalSessionClosed, signalSessionCreated, signalSessionCreated, signalSessionEstablished, signalSessionEstablished, signalSessionEvent, toString
getCipherFactories, getCompressionFactories, getDelegate, getKexExtensionHandler, getKeyExchangeFactories, getMacFactories, getSignatureFactories, resolveEffectiveFactories, resolveEffectiveProvider, setCipherFactories, setCompressionFactories, setKexExtensionHandler, setKeyExchangeFactories, setMacFactories, setSignatureFactories
doCloseGracefully, doCloseImmediately
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, removeCloseFutureListener
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createDynamicPortForwardingTracker, createExecChannel, createLocalPortForwardingTracker, createLocalPortForwardingTracker, createRemotePortForwardingTracker, createShellChannel, executeRemoteCommand, executeRemoteCommand, executeRemoteCommand, passwordIteratorOf, providerOf, waitFor
createBuffer, createBuffer, disconnect, getAuthTimeout, getAuthTimeoutStart, getIdleTimeout, getIdleTimeoutStart, getIoSession, getKex, getLocalAddress, getRemoteAddress, getService, getTimeoutStatus, prepareBuffer, reExchangeKeys, request, request, request, request, resetAuthTimeout, resetIdleTimeout, resolveAttribute, resolveAttribute, sendDebugMessage, sendIgnoreMessage, setAuthenticated, writePacket, writePacket, writePacket, writePacket
getCipherInformation, getClientKexProposals, getClientVersion, getCompressionInformation, getKexNegotiationResult, getKexState, getMacInformation, getNegotiatedKexParameter, getServerKexProposals, getServerVersion, getSessionId, isAuthenticated, isDataIntegrityTransport, isSecureSessionTransport, isServerSession, isValidSessionPayloadSize, isValidVersionPrefix, validateSessionPayloadSize
disableSessionHeartbeat, getSessionHeartbeatInterval, getSessionHeartbeatType, setSessionHeartbeat, setSessionHeartbeat
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty, isEmpty, isEmpty
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttribute
attributeKeys, getAttribute, getAttributesCount, ofAttributesMap, ofKeyValuePair
addCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListener
setUsername
getUsername
getCipherFactories, getCipherFactoriesNameList, getCipherFactoriesNames, getCompressionFactories, getCompressionFactoriesNameList, getCompressionFactoriesNames, getKeyExchangeFactories, getMacFactories, getMacFactoriesNameList, getMacFactoriesNames, setCipherFactories, setCipherFactoriesNameList, setCipherFactoriesNames, setCipherFactoriesNames, setCompressionFactories, setCompressionFactoriesNameList, setCompressionFactoriesNames, setCompressionFactoriesNames, setKeyExchangeFactories, setMacFactories, setMacFactoriesNameList, setMacFactoriesNames, setMacFactoriesNames
getSignatureFactories, resolveSignatureFactories, setSignatureFactories, setSignatureFactoriesNameList, setSignatureFactoriesNames, setSignatureFactoriesNames
getSignatureFactories, getSignatureFactoriesNameList, getSignatureFactoriesNames
getKexExtensionHandler, setKexExtensionHandler
addSessionListener, getSessionListenerProxy, removeSessionListener
getReservedSessionMessagesHandler, setReservedSessionMessagesHandler
getSessionDisconnectHandler, setSessionDisconnectHandler
addChannelListener, getChannelListenerProxy, removeChannelListener
getChannelStreamWriterResolver, resolveChannelStreamWriter, resolveChannelStreamWriterResolver, setChannelStreamWriterResolver
addPortForwardingEventListener, getPortForwardingEventListenerProxy, removePortForwardingEventListener
getUnknownChannelReferenceHandler, resolveUnknownChannelReferenceHandler, setUnknownChannelReferenceHandler
setUserAuthFactoriesNames
getUserAuthFactoriesNameList, getUserAuthFactoriesNames, setUserAuthFactoriesNameList, setUserAuthFactoriesNames
startLocalPortForwarding
getBoundLocalPortForwards, getBoundRemotePortForward, getLocalForwardsBindings, getRemoteForwardsBindings, getStartedLocalPortForwards, getStartedRemotePortForwards, isLocalPortForwardingStartedForPort, isRemotePortForwardingStartedForPort
public ClientSessionImpl(ClientFactoryManager client, IoSession ioSession) throws Exception
Exception
protected CurrentService initializeCurrentService()
AbstractSession
CurrentService
instance managing this session's current SSH service.
This initialization method is invoked once from the AbstractSession
constructor. Do not rely on subclass
fields being initialized.
initializeCurrentService
in class AbstractSession
CurrentService
instance for the sessionprotected List<Service> getServices()
getServices
in class AbstractSession
public AuthFuture auth() throws IOException
ClientSession
ClientAuthenticationManager.addPasswordIdentity(String)
or
ClientAuthenticationManager.addPublicKeyIdentity(java.security.KeyPair)
.IOException
- if failed to generate the futureClientAuthenticationManager.addPasswordIdentity(String)
,
ClientAuthenticationManager.addPublicKeyIdentity(java.security.KeyPair)
public void exceptionCaught(Throwable t)
SessionHelper
SshException
.exceptionCaught
in interface Session
exceptionCaught
in class SessionHelper
t
- the exception to processprotected void preClose()
AbstractCloseable
preClose
in class AbstractSession
protected void handleDisconnect(int code, String msg, String lang, Buffer buffer) throws Exception
handleDisconnect
in class SessionHelper
Exception
protected void signalAuthFailure(Throwable t)
protected String nextServiceName()
public void switchToNextService() throws IOException
IOException
protected void signalSessionEvent(SessionListener.Event event) throws Exception
SessionHelper
signalSessionEvent
in class SessionHelper
event
- The event to sendException
- If any of the registered listeners threw an exception.protected void sendInitialServiceRequest() throws IOException
IOException
public Set<ClientSession.ClientSessionEvent> waitFor(Collection<ClientSession.ClientSessionEvent> mask, long timeout)
ClientSession
mask
- The request ClientSession.ClientSessionEvent
s masktimeout
- Wait time in milliseconds - non-positive means foreverClientSession.ClientSessionEvent.TIMEOUT
value is set)public Set<ClientSession.ClientSessionEvent> getSessionState()
ClientSession.waitFor(Collection, long)
protected <C extends Collection<ClientSession.ClientSessionEvent>> C updateCurrentSessionState(C state)
public Map<Object,Object> getMetadataMap()
ClientSession
Map
- Note: access to the map is not synchronized
in any way - up to
the user to take care of mutual exclusion if necessaryCopyright © 2008–2024 The Apache Software Foundation. All rights reserved.