Package org.apache.sshd.client.session
Class AbstractClientSession
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.util.closeable.IoBaseCloseable
org.apache.sshd.common.util.closeable.AbstractCloseable
org.apache.sshd.common.util.closeable.AbstractInnerCloseable
org.apache.sshd.common.kex.AbstractKexFactoryManager
org.apache.sshd.common.session.helpers.SessionHelper
org.apache.sshd.common.session.helpers.AbstractSession
org.apache.sshd.client.session.AbstractClientSession
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,ClientAuthenticationManager,ClientProxyConnectorHolder,ClientSession,AttributeRepository,AttributeStore,MutableUserHolder,UserAuthFactoriesManager<ClientSession,,UserAuth, UserAuthFactory> UsernameHolder,ChannelListenerManager,ChannelStreamWriterResolver,ChannelStreamWriterResolverManager,Closeable,FactoryManagerHolder,PortForwardingEventListenerManager,PortForwardingInformationProvider,PortForwardingManager,KexExtensionHandlerManager,KexFactoryManager,KeyIdentityProviderHolder,PropertyResolver,ReservedSessionMessagesManager,Session,SessionContext,SessionDisconnectHandlerManager,SessionHeartbeatController,SessionListenerManager,UnknownChannelReferenceHandlerManager,SignatureFactoriesHolder,SignatureFactoriesManager,ConnectionEndpointsIndicator
- Direct Known Subclasses:
ClientSessionImpl
Provides default implementations of
ClientSession related methods-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sshd.common.session.helpers.AbstractSession
AbstractSession.MessageCodingSettingsNested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.StateNested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T>Nested classes/interfaces inherited from interface org.apache.sshd.client.session.ClientSession
ClientSession.ClientSessionEventNested classes/interfaces inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
SessionHeartbeatController.HeartbeatType -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SocketAddressprivate final AttributeRepositoryprivate HostBasedAuthenticationReporterprivate final AuthenticationIdentitiesProviderprivate KeyIdentityProviderprivate PasswordAuthenticationReporterprivate PasswordIdentityProviderprivate ClientProxyConnectorprivate PublicKeyAuthenticationReporterprotected final booleanprotected final booleanprivate PublicKeyprivate ServerKeyVerifierprivate List<UserAuthFactory> private UserInteractionFields inherited from class org.apache.sshd.common.session.helpers.AbstractSession
channelListenerProxy, channelListeners, clientProposal, clientVersion, currentService, decodeLock, decoderBuffer, decoderLength, decoderState, encodeLock, firstKexPacketFollows, ignorePacketDataLength, ignorePacketsCount, ignorePacketsFrequency, ignorePacketsVariance, inBlocksCount, inBytesCount, inCipher, inCipherSize, inCompression, initialKexDone, initialKexInitSequenceNumber, 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, strictKex, tunnelListenerProxy, tunnelListeners, uncompressBuffer, unmodClientProposal, unmodNegotiationResult, unmodServerProposalFields inherited from class org.apache.sshd.common.session.helpers.SessionHelper
authStart, idleStart, initialKexProposalFields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, stateFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolver
NONEFields inherited from interface org.apache.sshd.client.session.ClientSession
REMOTE_COMMAND_WAIT_EVENTSFields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTYFields inherited from interface org.apache.sshd.common.session.SessionContext
DEFAULT_SSH_VERSION_PREFIX, FALLBACK_SSH_VERSION_PREFIX, MAX_VERSION_LINE_LENGTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractClientSession(ClientFactoryManager factoryManager, IoSession ioSession) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPasswordIdentity(String password) voidprotected voidIndicates the the key exchange is completed and the exchanged keys can now be verified - e.g., client can verify the server's keycreateChannel(String type) Create a channel of the given type.createChannel(String type, String subType) Create a channel of the given type and sub-type.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.createExecChannel(byte[] command, PtyChannelConfigurationHolder ptyConfig, Map<String, ?> env) Create a channel to execute a command using specific PTY settings and/or environment.createExecChannel(String command, Charset charset, PtyChannelConfigurationHolder ptyConfig, Map<String, ?> env) Create a channel to execute a command using specific PTY settings and/or environment.createShellChannel(PtyChannelConfigurationHolder ptyConfig, Map<String, ?> env) Create a channel to start a shell using specific PTY settings and/or environment.createSubsystemChannel(String subsystem) Create a subsystem channel.Returns the original address (after having been translated through host configuration entries if any) that was request to connect.protected ConnectionServiceprotected ForwarderRetrievePasswordIdentityProviderused to provide password candidatesRetrieves the server's keyRetrieve the server key verifier to be used to check the key when connecting to an SSH server.Retrieve the list of named factories forUserAuthobjects.protected ClientUserAuthServiceprotected voidprotected voidprotected booleanreadIdentification(Buffer buffer) Read the other side identification.protected voidreceiveKexInit(Map<KexProposalOption, String> proposal, byte[] seed) protected byte[]receiveKexInit(Buffer buffer) removePasswordIdentity(String password) protected StringComputes the list of available host key signature algorithms supported.protected IoWriteFutureprotected byte[]sendKexInit(Map<KexProposalOption, String> proposal) Send the key exchange initialization packet.voidsetClientProxyConnector(ClientProxyConnector proxyConnector) voidsetConnectAddress(SocketAddress connectAddress) voidprotected voidsetKexSeed(byte... seed) voidsetKeyIdentityProvider(KeyIdentityProvider keyIdentityProvider) voidvoidvoidvoidsetServerKey(PublicKey serverKey) voidsetServerKeyVerifier(ServerKeyVerifier serverKeyVerifier) voidsetUserAuthFactories(List<UserAuthFactory> userAuthFactories) voidsetUserInteraction(UserInteraction userInteraction) protected voidsignalExtraServerVersionInfo(String version, List<String> lines) Start dynamic local port forwarding using a SOCKS proxy.startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) Start forwarding the given local address on the client to the given address on the server.startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) Start forwarding tcpip from the given address on the server to the given address on the client.voidstartService(String name, Buffer buffer) voidStop a previously started dynamic port forwarding.voidStop forwarding the given local address.voidStop forwarding of the given remote address.Switch to a none cipher for performance.Methods inherited from class org.apache.sshd.common.session.helpers.AbstractSession
addChannelListener, addPortForwardingEventListener, addSessionListener, aeadOutgoingBuffer, appendOutgoingMac, attachSession, calculatePadLength, checkRekey, comparePreferredKexProposalOption, createBuffer, decode, determineRekeyBlockLimit, doHandleMessage, doInvokeUnimplementedMessageHandler, doKexNegotiation, doStrictKexProposal, doWritePacket, encode, encryptOutgoingBuffer, failStrictKex, getChannelListenerProxy, getCipherInformation, getClientKexData, getClientKexProposals, getClientVersion, getCompressionInformation, getInnerCloseable, getKex, getKexNegotiationResult, getKexState, getMacInformation, getNegotiatedKexParameter, getPortForwardingEventListenerProxy, getServerKexData, getServerKexProposals, getServerVersion, getService, getServices, getSession, getSession, getSessionId, getSessionListenerProxy, handleFirstKexPacketFollows, handleKexExtension, handleKexInit, handleKexMessage, handleMessage, handleNewCompression, handleNewKeys, handleServiceAccept, handleServiceAccept, handleServiceRequest, handleServiceRequest, initializeCurrentService, initializeKeyExchangeMessageHandler, isRekeyBlocksCountExceeded, isRekeyDataSizeExceeded, isRekeyPacketCountsExceeded, isRekeyRequired, isRekeyTimeIntervalExceeded, messageReceived, negotiate, notImplemented, preClose, prepareBuffer, prepareNewKeys, preProcessEncodeBuffer, receiveKexInit, reExchangeKeys, refreshConfiguration, removeChannelListener, removePortForwardingEventListener, removeSessionListener, removeValue, request, request, requestFailure, requestNewKeysExchange, requestSuccess, resolveIgnoreBufferDataLength, resolveOutputPacket, resolveSessionKexProposal, sendKexInit, sendNewKeys, setClientKexData, setInputEncoding, setNegotiationResult, setOutputEncoding, setServerKexData, validateIncomingMac, validateKexState, validateServiceKexState, validateTargetBuffer, writePacket, writePacketMethods inherited from class org.apache.sshd.common.session.helpers.SessionHelper
attributeKeys, calculateNextIgnorePacketCount, checkAuthenticationTimeout, checkForTimeouts, checkIdleTimeout, clearAttributes, computeAttributeIfAbsent, createProposal, disconnect, doInvokeDebugMessageHandler, doInvokeIgnoreMessageHandler, doReadIdentification, exceptionCaught, getAttribute, getAttributesCount, getAuthTimeout, getAuthTimeoutStart, getBoundLocalPortForwards, getBoundRemotePortForward, getChannelStreamWriterResolver, getIdleTimeout, getIdleTimeoutStart, getIoSession, getKexProposal, getLocalForwardsBindings, getParentPropertyResolver, getProperties, getRemoteForwardsBindings, getReservedSessionMessagesHandler, getSessionDisconnectHandler, getStartedLocalPortForwards, getStartedRemotePortForwards, getTimeoutStatus, getUnknownChannelReferenceHandler, getUsername, handleDebug, handleDisconnect, 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, signalSessionEvent, toStringMethods inherited from class org.apache.sshd.common.kex.AbstractKexFactoryManager
getCipherFactories, getCompressionFactories, getDelegate, getKexExtensionHandler, getKeyExchangeFactories, getMacFactories, getSignatureFactories, resolveEffectiveFactories, resolveEffectiveProvider, setCipherFactories, setCompressionFactories, setKexExtensionHandler, setKeyExchangeFactories, setMacFactories, setSignatureFactoriesMethods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediatelyMethods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, removeCloseFutureListenerMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.AttributeRepository
attributeKeys, getAttribute, getAttributesCountMethods inherited from interface org.apache.sshd.common.AttributeStore
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttributeMethods inherited from interface org.apache.sshd.common.channel.ChannelListenerManager
addChannelListener, getChannelListenerProxy, removeChannelListenerMethods inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolverManager
getChannelStreamWriterResolver, resolveChannelStreamWriter, resolveChannelStreamWriterResolver, setChannelStreamWriterResolverMethods inherited from interface org.apache.sshd.client.ClientAuthenticationManager
setUserAuthFactoriesNamesMethods inherited from interface org.apache.sshd.client.session.ClientSession
auth, createDynamicPortForwardingTracker, createExecChannel, createExecChannel, createLocalPortForwardingTracker, createLocalPortForwardingTracker, createRemotePortForwardingTracker, createShellChannel, executeRemoteCommand, executeRemoteCommand, executeRemoteCommand, getMetadataMap, getSessionState, waitFor, waitForMethods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListenerMethods inherited from interface org.apache.sshd.common.kex.extension.KexExtensionHandlerManager
getKexExtensionHandler, setKexExtensionHandlerMethods inherited from interface org.apache.sshd.common.kex.KexFactoryManager
getCipherFactories, getCipherFactoriesNameList, getCipherFactoriesNames, getCompressionFactories, getCompressionFactoriesNameList, getCompressionFactoriesNames, getKeyExchangeFactories, getMacFactories, getMacFactoriesNameList, getMacFactoriesNames, setCipherFactories, setCipherFactoriesNameList, setCipherFactoriesNames, setCipherFactoriesNames, setCompressionFactories, setCompressionFactoriesNameList, setCompressionFactoriesNames, setCompressionFactoriesNames, setKeyExchangeFactories, setMacFactories, setMacFactoriesNameList, setMacFactoriesNames, setMacFactoriesNamesMethods inherited from interface org.apache.sshd.common.auth.MutableUserHolder
setUsernameMethods inherited from interface org.apache.sshd.common.forward.PortForwardingEventListenerManager
addPortForwardingEventListener, getPortForwardingEventListenerProxy, removePortForwardingEventListenerMethods inherited from interface org.apache.sshd.common.forward.PortForwardingInformationProvider
getBoundLocalPortForwards, getBoundRemotePortForward, getLocalForwardsBindings, getRemoteForwardsBindings, getStartedLocalPortForwards, getStartedRemotePortForwards, isLocalPortForwardingStartedForPort, isRemotePortForwardingStartedForPortMethods inherited from interface org.apache.sshd.common.forward.PortForwardingManager
startLocalPortForwardingMethods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty, isEmptyMethods inherited from interface org.apache.sshd.common.session.ReservedSessionMessagesManager
getReservedSessionMessagesHandler, setReservedSessionMessagesHandlerMethods inherited from interface org.apache.sshd.common.session.Session
createBuffer, createBuffer, disconnect, exceptionCaught, getAuthTimeout, getAuthTimeoutStart, getIdleTimeout, getIdleTimeoutStart, getIoSession, getKex, getLocalAddress, getRemoteAddress, getService, getTimeoutStatus, prepareBuffer, reExchangeKeys, request, request, request, request, resetAuthTimeout, resetIdleTimeout, resolveAttribute, sendDebugMessage, sendIgnoreMessage, setAuthenticated, writePacket, writePacket, writePacket, writePacketMethods inherited from interface org.apache.sshd.common.session.SessionContext
getCipherInformation, getClientKexProposals, getClientVersion, getCompressionInformation, getKexNegotiationResult, getKexState, getMacInformation, getNegotiatedKexParameter, getServerKexProposals, getServerVersion, getSessionId, isAuthenticated, isServerSessionMethods inherited from interface org.apache.sshd.common.session.SessionDisconnectHandlerManager
getSessionDisconnectHandler, setSessionDisconnectHandlerMethods inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
disableSessionHeartbeat, getSessionHeartbeatInterval, getSessionHeartbeatType, setSessionHeartbeat, setSessionHeartbeatMethods inherited from interface org.apache.sshd.common.session.SessionListenerManager
addSessionListener, getSessionListenerProxy, removeSessionListenerMethods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesHolder
getSignatureFactories, getSignatureFactoriesNameList, getSignatureFactoriesNamesMethods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesManager
setSignatureFactories, setSignatureFactoriesNameList, setSignatureFactoriesNames, setSignatureFactoriesNamesMethods inherited from interface org.apache.sshd.common.session.UnknownChannelReferenceHandlerManager
getUnknownChannelReferenceHandler, resolveUnknownChannelReferenceHandler, setUnknownChannelReferenceHandlerMethods inherited from interface org.apache.sshd.common.auth.UserAuthFactoriesManager
getUserAuthFactoriesNameList, getUserAuthFactoriesNames, setUserAuthFactoriesNameList, setUserAuthFactoriesNamesMethods inherited from interface org.apache.sshd.common.auth.UsernameHolder
getUsername
-
Field Details
-
sendImmediateClientIdentification
protected final boolean sendImmediateClientIdentification -
sendImmediateKexInit
protected final boolean sendImmediateKexInit -
identities
-
identitiesProvider
-
connectionContext
-
serverKey
-
serverKeyVerifier
-
userInteraction
-
passwordIdentityProvider
-
passwordAuthenticationReporter
-
keyIdentityProvider
-
publicKeyAuthenticationReporter
-
hostBasedAuthenticationReporter
-
userAuthFactories
-
connectAddress
-
proxyConnector
-
-
Constructor Details
-
AbstractClientSession
-
-
Method Details
-
getConnectionContext
- Specified by:
getConnectionContextin interfaceClientSession- Returns:
- The "context" data provided when session connection was established -
nullif none.
-
getFactoryManager
- Specified by:
getFactoryManagerin interfaceClientSession- Specified by:
getFactoryManagerin interfaceFactoryManagerHolder- Overrides:
getFactoryManagerin classSessionHelper- Returns:
- The currently associated
FactoryManager
-
getConnectAddress
Description copied from interface:ClientSessionReturns the original address (after having been translated through host configuration entries if any) that was request to connect. It contains the original host or address string that was used. Note: this may be different than the result of theSession.getIoSession()report of the remote peer- Specified by:
getConnectAddressin interfaceClientSession- Returns:
- The original requested address
-
setConnectAddress
-
getServerKey
Description copied from interface:ClientSessionRetrieves the server's key- Specified by:
getServerKeyin interfaceClientSession- Returns:
- The server's
PublicKey-nullif KEX not started or not completed
-
setServerKey
-
getServerKeyVerifier
Description copied from interface:ClientAuthenticationManagerRetrieve the server key verifier to be used to check the key when connecting to an SSH server.- Specified by:
getServerKeyVerifierin interfaceClientAuthenticationManager- Returns:
- the
ServerKeyVerifierto use - nevernull
-
setServerKeyVerifier
- Specified by:
setServerKeyVerifierin interfaceClientAuthenticationManager
-
getUserInteraction
- Specified by:
getUserInteractionin interfaceClientAuthenticationManager- Returns:
- A
UserInteractionobject to communicate with the user (may benullto indicate that no such communication is allowed)
-
setUserInteraction
- Specified by:
setUserInteractionin interfaceClientAuthenticationManager
-
getPasswordAuthenticationReporter
- Specified by:
getPasswordAuthenticationReporterin interfaceClientAuthenticationManager
-
setPasswordAuthenticationReporter
- Specified by:
setPasswordAuthenticationReporterin interfaceClientAuthenticationManager
-
getUserAuthFactories
Description copied from interface:UserAuthFactoriesManagerRetrieve the list of named factories forUserAuthobjects.- Specified by:
getUserAuthFactoriesin interfaceUserAuthFactoriesManager<ClientSession,UserAuth, UserAuthFactory> - Returns:
- a list of named
UserAuthfactories, nevernull/empty
-
setUserAuthFactories
- Specified by:
setUserAuthFactoriesin interfaceUserAuthFactoriesManager<ClientSession,UserAuth, UserAuthFactory>
-
getRegisteredIdentities
- Specified by:
getRegisteredIdentitiesin interfaceClientAuthenticationManager- Returns:
- The
AuthenticationIdentitiesProviderto be used for attempting password or public key authentication
-
getPasswordIdentityProvider
Description copied from interface:ClientAuthenticationManagerRetrievePasswordIdentityProviderused to provide password candidates- Specified by:
getPasswordIdentityProviderin interfaceClientAuthenticationManager- Returns:
- The
PasswordIdentityProviderinstance - ignored ifnull(i.e., no passwords available). - See Also:
-
setPasswordIdentityProvider
- Specified by:
setPasswordIdentityProviderin interfaceClientAuthenticationManager
-
getKeyIdentityProvider
- Specified by:
getKeyIdentityProviderin interfaceKeyIdentityProviderHolder- Returns:
- The
KeyIdentityProviderused to provide key-pair(s) for public key authentication
-
setKeyIdentityProvider
- Specified by:
setKeyIdentityProviderin interfaceKeyIdentityProviderHolder
-
getPublicKeyAuthenticationReporter
- Specified by:
getPublicKeyAuthenticationReporterin interfaceClientAuthenticationManager
-
setPublicKeyAuthenticationReporter
- Specified by:
setPublicKeyAuthenticationReporterin interfaceClientAuthenticationManager
-
getHostBasedAuthenticationReporter
- Specified by:
getHostBasedAuthenticationReporterin interfaceClientAuthenticationManager
-
setHostBasedAuthenticationReporter
- Specified by:
setHostBasedAuthenticationReporterin interfaceClientAuthenticationManager
-
getClientProxyConnector
- Specified by:
getClientProxyConnectorin interfaceClientProxyConnectorHolder
-
setClientProxyConnector
- Specified by:
setClientProxyConnectorin interfaceClientProxyConnectorHolder
-
addPasswordIdentity
- Specified by:
addPasswordIdentityin interfaceClientAuthenticationManager- Parameters:
password- Password to be added - may not benull/empty. Note: this password is in addition to whatever passwords are available via thePasswordIdentityProvider(if any)
-
removePasswordIdentity
- Specified by:
removePasswordIdentityin interfaceClientAuthenticationManager- Parameters:
password- The password to remove - ignored ifnull/empty- Returns:
- The removed password - same one that was added via
ClientAuthenticationManager.addPasswordIdentity(String)- ornullif no match found
-
addPublicKeyIdentity
- Specified by:
addPublicKeyIdentityin interfaceClientAuthenticationManager- Parameters:
kp- TheKeyPairto add - may not benullNote: this key is in addition to whatever keys are available via theKeyIdentityProvider(if any)
-
removePublicKeyIdentity
- Specified by:
removePublicKeyIdentityin interfaceClientAuthenticationManager- Parameters:
kp- TheKeyPairto remove - ignored ifnull- Returns:
- The removed
KeyPair- same one that was added viaClientAuthenticationManager.addPublicKeyIdentity(KeyPair)- ornullif no match found
-
initializeKeyExchangePhase
- Throws:
Exception
-
initializeProxyConnector
- Throws:
Exception
-
sendClientIdentification
- Throws:
Exception
-
createChannel
Description copied from interface:ClientSessionCreate a channel of the given type. Same as callingcreateChannel(type, null).- Specified by:
createChannelin interfaceClientSession- Parameters:
type- The channel type- Returns:
- The created
ClientChannel - Throws:
IOException- If failed to create the requested channel
-
createChannel
Description copied from interface:ClientSessionCreate a channel of the given type and sub-type.- Specified by:
createChannelin interfaceClientSession- Parameters:
type- The channel typesubType- The channel sub-type- Returns:
- The created
ClientChannel - Throws:
IOException- If failed to create the requested channel
-
createExecChannel
public ChannelExec createExecChannel(String command, Charset charset, PtyChannelConfigurationHolder ptyConfig, Map<String, ?> env) throws IOExceptionDescription copied from interface:ClientSessionCreate a channel to execute a command using specific PTY settings and/or environment.- Specified by:
createExecChannelin interfaceClientSession- Parameters:
command- The command to executecharset- TheCharsetto use for sending the command stringptyConfig- The PTY configuration to use - ifnullthen internal defaults are usedenv- Extra environment configuration to be transmitted to the server - ignored ifnull/empty.- Returns:
- The created
ChannelExec - Throws:
IOException- If failed to create the requested channel
-
createExecChannel
public ChannelExec createExecChannel(byte[] command, PtyChannelConfigurationHolder ptyConfig, Map<String, ?> env) throws IOExceptionDescription copied from interface:ClientSessionCreate a channel to execute a command using specific PTY settings and/or environment.- Specified by:
createExecChannelin interfaceClientSession- Parameters:
command- The command to executeptyConfig- The PTY configuration to use - ifnullthen internal defaults are usedenv- Extra environment configuration to be transmitted to the server - ignored ifnull/empty.- Returns:
- The created
ChannelExec - Throws:
IOException- If failed to create the requested channel
-
createSubsystemChannel
Description copied from interface:ClientSessionCreate a subsystem channel.- Specified by:
createSubsystemChannelin interfaceClientSession- Parameters:
subsystem- The subsystem name- Returns:
- The created
ChannelSubsystem - Throws:
IOException- If failed to create the requested channel
-
createDirectTcpipChannel
public ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws IOException Description copied from interface:ClientSessionCreate a direct tcp-ip channel which can be used to stream data to a remote port from the server.- Specified by:
createDirectTcpipChannelin interfaceClientSession- Parameters:
local- The local addressremote- The remote address- Returns:
- The created
ChannelDirectTcpip - Throws:
IOException- If failed to create the requested channel
-
getUserAuthService
-
getConnectionService
- Specified by:
getConnectionServicein classSessionHelper
-
startLocalPortForwarding
public SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws IOException Description copied from interface:PortForwardingManagerStart forwarding the given local address on the client to the given address on the server.- Specified by:
startLocalPortForwardingin interfacePortForwardingManager- Parameters:
local- The local addressremote- The remote address- Returns:
- The bound
SshdSocketAddress - Throws:
IOException- If failed to create the requested binding
-
stopLocalPortForwarding
Description copied from interface:PortForwardingManagerStop forwarding the given local address.- Specified by:
stopLocalPortForwardingin interfacePortForwardingManager- Parameters:
local- The local address- Throws:
IOException- If failed to cancel the requested binding
-
startRemotePortForwarding
public SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException Description copied from interface:PortForwardingManagerStart 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:- "" means that connections are to be accepted on all protocol families supported by the SSH implementation
- "0.0.0.0" means to listen on all IPv4 addresses
- "::" means to listen on all IPv6 addresses
- "localhost" means to listen on all protocol families supported by the SSH implementation on loopback addresses only, [RFC3330] and RFC3513]
- "127.0.0.1" and "::1" indicate listening on the loopback interfaces for IPv4 and IPv6 respectively
- Specified by:
startRemotePortForwardingin interfacePortForwardingManager- Parameters:
remote- The remote addresslocal- The local address- Returns:
- The bound
SshdSocketAddress - Throws:
IOException- If failed to create the requested binding
-
stopRemotePortForwarding
Description copied from interface:PortForwardingManagerStop forwarding of the given remote address.- Specified by:
stopRemotePortForwardingin interfacePortForwardingManager- Parameters:
remote- The remote address- Throws:
IOException- If failed to cancel the requested binding
-
startDynamicPortForwarding
Description copied from interface:PortForwardingManagerStart dynamic local port forwarding using a SOCKS proxy.- Specified by:
startDynamicPortForwardingin interfacePortForwardingManager- Parameters:
local- The local address- Returns:
- The bound
SshdSocketAddress - Throws:
IOException- If failed to create the requested binding
-
stopDynamicPortForwarding
Description copied from interface:PortForwardingManagerStop a previously started dynamic port forwarding.- Specified by:
stopDynamicPortForwardingin interfacePortForwardingManager- Parameters:
local- The local address- Throws:
IOException- If failed to cancel the requested binding
-
getForwarder
- Overrides:
getForwarderin classSessionHelper
-
resolveAvailableSignaturesProposal
Description copied from class:SessionHelperComputes the list of available host key signature algorithms supported.- Specified by:
resolveAvailableSignaturesProposalin classSessionHelper- Parameters:
manager- TheFactoryManager- Returns:
- A comma-separated list of all the signature protocols to be included in the
proposal -
null/empty if no proposal
-
startService
- Specified by:
startServicein interfaceSession- Parameters:
name- Service namebuffer- Extra information provided when the service start request was received- Throws:
Exception- If failed to start it
-
createShellChannel
public ChannelShell createShellChannel(PtyChannelConfigurationHolder ptyConfig, Map<String, ?> env) throws IOExceptionDescription copied from interface:ClientSessionCreate a channel to start a shell using specific PTY settings and/or environment.- Specified by:
createShellChannelin interfaceClientSession- Parameters:
ptyConfig- The PTY configuration to use - ifnullthen internal defaults are usedenv- Extra environment configuration to be transmitted to the server - ignored ifnull/empty.- Returns:
- The created
ChannelShell - Throws:
IOException- If failed to create the requested channel
-
readIdentification
Description copied from class:AbstractSessionRead the other side identification. This method is specific to the client or server side, but both should callSessionHelper.doReadIdentification(Buffer, boolean)and store the result in the needed property.- Specified by:
readIdentificationin classAbstractSession- Parameters:
buffer- TheBuffercontaining the remote identification- Returns:
trueif the identification has been fully read orfalseif more data is needed- Throws:
Exception- if an error occurs such as a bad protocol version or unsuccessful KEX was involved
-
signalExtraServerVersionInfo
- Throws:
Exception
-
sendKexInit
Description copied from class:AbstractSessionSend the key exchange initialization packet. This packet contains random data along with our proposal.- Overrides:
sendKexInitin classAbstractSession- Parameters:
proposal- our proposal for key exchange negotiation- Returns:
- the sent packet data which must be kept for later use when deriving the session keys
- Throws:
Exception- if an error occurred sending the packet
-
setKexSeed
protected void setKexSeed(byte... seed) - Specified by:
setKexSeedin classAbstractSession- Parameters:
seed- The result of the KEXINIT handshake - required for correct session key establishment
-
receiveKexInit
- Overrides:
receiveKexInitin classAbstractSession- Throws:
Exception
-
receiveKexInit
protected void receiveKexInit(Map<KexProposalOption, String> proposal, byte[] seed) throws IOException- Specified by:
receiveKexInitin classAbstractSession- Throws:
IOException
-
checkKeys
Description copied from class:AbstractSessionIndicates the the key exchange is completed and the exchanged keys can now be verified - e.g., client can verify the server's key- Specified by:
checkKeysin classAbstractSession- Throws:
IOException- If validation failed
-
switchToNoneCipher
Description copied from interface:ClientSessionSwitch to a none cipher for performance.
This should be done after the authentication phase has been performed. After such a switch, interactive channels are not allowed anymore. Both client and server must have been configured to support the none cipher. If that's not the case, the returned future will be set with an exception.
- Specified by:
switchToNoneCipherin interfaceClientSession- Returns:
- an
KeyExchangeFuturethat can be used to wait for the exchange to be finished - Throws:
IOException- if a key exchange is already running
-