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
public abstract class AbstractClientSession extends AbstractSession implements ClientSession
Provides default implementations ofClientSessionrelated methods- Author:
- Apache MINA SSHD Project
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sshd.common.session.helpers.AbstractSession
AbstractSession.MessageCodingSettings
-
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T extends Object>
-
Nested classes/interfaces inherited from interface org.apache.sshd.client.session.ClientSession
ClientSession.ClientSessionEvent
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
SessionHeartbeatController.HeartbeatType
-
-
Field Summary
Fields Modifier and Type Field Description protected booleansendImmediateClientIdentificationprotected booleansendImmediateKexInit-
Fields 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, 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
-
Fields inherited from class org.apache.sshd.common.session.helpers.SessionHelper
authStart, idleStart, initialKexProposal
-
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolver
NONE
-
Fields inherited from interface org.apache.sshd.client.session.ClientSession
REMOTE_COMMAND_WAIT_EVENTS
-
Fields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY
-
Fields inherited from interface org.apache.sshd.common.session.SessionContext
DEFAULT_SSH_VERSION_PREFIX, FALLBACK_SSH_VERSION_PREFIX, MAX_VERSION_LINE_LENGTH
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractClientSession(ClientFactoryManager factoryManager, IoSession ioSession)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPasswordIdentity(String password)voidaddPublicKeyIdentity(KeyPair kp)protected voidcheckKeys()Indicates the the key exchange is completed and the exchanged keys can now be verified - e.g., client can verify the server's keyClientChannelcreateChannel(String type)Create a channel of the given type.ClientChannelcreateChannel(String type, String subType)Create a channel of the given type and sub-type.ChannelDirectTcpipcreateDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote)Create a direct tcp-ip channel which can be used to stream data to a remote port from the server.ChannelExeccreateExecChannel(byte[] command, PtyChannelConfigurationHolder ptyConfig, Map<String,?> env)Create a channel to execute a command using specific PTY settings and/or environment.ChannelExeccreateExecChannel(String command, Charset charset, PtyChannelConfigurationHolder ptyConfig, Map<String,?> env)Create a channel to execute a command using specific PTY settings and/or environment.ChannelShellcreateShellChannel(PtyChannelConfigurationHolder ptyConfig, Map<String,?> env)Create a channel to start a shell using specific PTY settings and/or environment.ChannelSubsystemcreateSubsystemChannel(String subsystem)Create a subsystem channel.ClientProxyConnectorgetClientProxyConnector()SocketAddressgetConnectAddress()Returns the original address (after having been translated through host configuration entries if any) that was request to connect.AttributeRepositorygetConnectionContext()protected ConnectionServicegetConnectionService()ClientFactoryManagergetFactoryManager()protected ForwardergetForwarder()HostBasedAuthenticationReportergetHostBasedAuthenticationReporter()KeyIdentityProvidergetKeyIdentityProvider()PasswordAuthenticationReportergetPasswordAuthenticationReporter()PasswordIdentityProvidergetPasswordIdentityProvider()RetrievePasswordIdentityProviderused to provide password candidatesPublicKeyAuthenticationReportergetPublicKeyAuthenticationReporter()AuthenticationIdentitiesProvidergetRegisteredIdentities()PublicKeygetServerKey()Retrieves the server's keyServerKeyVerifiergetServerKeyVerifier()Retrieve the server key verifier to be used to check the key when connecting to an SSH server.List<UserAuthFactory>getUserAuthFactories()protected ClientUserAuthServicegetUserAuthService()UserInteractiongetUserInteraction()protected voidinitializeKeyExchangePhase()protected voidinitializeProxyConnector()protected booleanreadIdentification(Buffer buffer)Read the other side identification.protected voidreceiveKexInit(Map<KexProposalOption,String> proposal, byte[] seed)protected byte[]receiveKexInit(Buffer buffer)StringremovePasswordIdentity(String password)KeyPairremovePublicKeyIdentity(KeyPair kp)protected StringresolveAvailableSignaturesProposal(FactoryManager manager)Computes the list of available host key signature algorithms supported.protected IoWriteFuturesendClientIdentification()protected byte[]sendKexInit(Map<KexProposalOption,String> proposal)Send the key exchange initialization packet.voidsetClientProxyConnector(ClientProxyConnector proxyConnector)voidsetConnectAddress(SocketAddress connectAddress)voidsetHostBasedAuthenticationReporter(HostBasedAuthenticationReporter reporter)protected voidsetKexSeed(byte... seed)voidsetKeyIdentityProvider(KeyIdentityProvider keyIdentityProvider)voidsetPasswordAuthenticationReporter(PasswordAuthenticationReporter reporter)voidsetPasswordIdentityProvider(PasswordIdentityProvider provider)voidsetPublicKeyAuthenticationReporter(PublicKeyAuthenticationReporter reporter)voidsetServerKey(PublicKey serverKey)voidsetServerKeyVerifier(ServerKeyVerifier serverKeyVerifier)voidsetUserAuthFactories(List<UserAuthFactory> userAuthFactories)voidsetUserInteraction(UserInteraction userInteraction)protected voidsignalExtraServerVersionInfo(String version, List<String> lines)SshdSocketAddressstartDynamicPortForwarding(SshdSocketAddress local)Start dynamic local port forwarding using a SOCKS proxy.SshdSocketAddressstartLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote)Start forwarding the given local address on the client to the given address on the server.SshdSocketAddressstartRemotePortForwarding(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)voidstopDynamicPortForwarding(SshdSocketAddress local)Stop a previously started dynamic port forwarding.voidstopLocalPortForwarding(SshdSocketAddress local)Stop forwarding the given local address.voidstopRemotePortForwarding(SshdSocketAddress remote)Stop forwarding of the given remote address.KeyExchangeFutureswitchToNoneCipher()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, doWritePacket, encode, encryptOutgoingBuffer, 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, request, request, requestFailure, requestNewKeysExchange, requestSuccess, resolveIgnoreBufferDataLength, resolveOutputPacket, resolveSessionKexProposal, sendKexInit, sendNewKeys, setClientKexData, setInputEncoding, setNegotiationResult, setOutputEncoding, setServerKexData, validateIncomingMac, validateKexState, validateServiceKexState, validateTargetBuffer, writePacket, writePacket
-
Methods 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, toString
-
Methods inherited from class org.apache.sshd.common.kex.AbstractKexFactoryManager
getCipherFactories, getCompressionFactories, getDelegate, getKexExtensionHandler, getKeyExchangeFactories, getMacFactories, getSignatureFactories, resolveEffectiveFactories, resolveEffectiveProvider, setCipherFactories, setCompressionFactories, setKexExtensionHandler, setKeyExchangeFactories, setMacFactories, setSignatureFactories
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediately
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, removeCloseFutureListener
-
Methods 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, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.AttributeRepository
attributeKeys, getAttribute, getAttributesCount
-
Methods inherited from interface org.apache.sshd.common.AttributeStore
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttribute
-
Methods inherited from interface org.apache.sshd.common.channel.ChannelListenerManager
addChannelListener, getChannelListenerProxy, removeChannelListener
-
Methods inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolverManager
getChannelStreamWriterResolver, resolveChannelStreamWriter, resolveChannelStreamWriterResolver, setChannelStreamWriterResolver
-
Methods inherited from interface org.apache.sshd.client.ClientAuthenticationManager
setUserAuthFactoriesNames
-
Methods inherited from interface org.apache.sshd.client.session.ClientSession
auth, createDynamicPortForwardingTracker, createExecChannel, createExecChannel, createLocalPortForwardingTracker, createLocalPortForwardingTracker, createRemotePortForwardingTracker, createShellChannel, executeRemoteCommand, executeRemoteCommand, executeRemoteCommand, getMetadataMap, getSessionState, waitFor, waitFor
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Methods inherited from interface org.apache.sshd.common.kex.extension.KexExtensionHandlerManager
getKexExtensionHandler, setKexExtensionHandler
-
Methods 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, setMacFactoriesNames
-
Methods inherited from interface org.apache.sshd.common.auth.MutableUserHolder
setUsername
-
Methods inherited from interface org.apache.sshd.common.forward.PortForwardingEventListenerManager
addPortForwardingEventListener, getPortForwardingEventListenerProxy, removePortForwardingEventListener
-
Methods inherited from interface org.apache.sshd.common.forward.PortForwardingInformationProvider
getBoundLocalPortForwards, getBoundRemotePortForward, getLocalForwardsBindings, getRemoteForwardsBindings, getStartedLocalPortForwards, getStartedRemotePortForwards, isLocalPortForwardingStartedForPort, isRemotePortForwardingStartedForPort
-
Methods inherited from interface org.apache.sshd.common.forward.PortForwardingManager
startLocalPortForwarding
-
Methods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty, isEmpty
-
Methods inherited from interface org.apache.sshd.common.session.ReservedSessionMessagesManager
getReservedSessionMessagesHandler, setReservedSessionMessagesHandler
-
Methods 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, writePacket
-
Methods inherited from interface org.apache.sshd.common.session.SessionContext
getCipherInformation, getClientKexProposals, getClientVersion, getCompressionInformation, getKexNegotiationResult, getKexState, getMacInformation, getNegotiatedKexParameter, getServerKexProposals, getServerVersion, getSessionId, isAuthenticated, isServerSession
-
Methods inherited from interface org.apache.sshd.common.session.SessionDisconnectHandlerManager
getSessionDisconnectHandler, setSessionDisconnectHandler
-
Methods inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
disableSessionHeartbeat, getSessionHeartbeatInterval, getSessionHeartbeatType, setSessionHeartbeat, setSessionHeartbeat
-
Methods inherited from interface org.apache.sshd.common.session.SessionListenerManager
addSessionListener, getSessionListenerProxy, removeSessionListener
-
Methods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesHolder
getSignatureFactories, getSignatureFactoriesNameList, getSignatureFactoriesNames
-
Methods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesManager
setSignatureFactories, setSignatureFactoriesNameList, setSignatureFactoriesNames, setSignatureFactoriesNames
-
Methods inherited from interface org.apache.sshd.common.session.UnknownChannelReferenceHandlerManager
getUnknownChannelReferenceHandler, resolveUnknownChannelReferenceHandler, setUnknownChannelReferenceHandler
-
Methods inherited from interface org.apache.sshd.common.auth.UserAuthFactoriesManager
getUserAuthFactoriesNameList, getUserAuthFactoriesNames, setUserAuthFactoriesNameList, setUserAuthFactoriesNames
-
Methods inherited from interface org.apache.sshd.common.auth.UsernameHolder
getUsername
-
-
-
-
Constructor Detail
-
AbstractClientSession
protected AbstractClientSession(ClientFactoryManager factoryManager, IoSession ioSession)
-
-
Method Detail
-
getConnectionContext
public AttributeRepository getConnectionContext()
- Specified by:
getConnectionContextin interfaceClientSession- Returns:
- The "context" data provided when session connection was established -
nullif none.
-
getFactoryManager
public ClientFactoryManager getFactoryManager()
- Specified by:
getFactoryManagerin interfaceClientSession- Specified by:
getFactoryManagerin interfaceFactoryManagerHolder- Overrides:
getFactoryManagerin classSessionHelper- Returns:
- The currently associated
FactoryManager
-
getConnectAddress
public SocketAddress 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
public void setConnectAddress(SocketAddress connectAddress)
-
getServerKey
public PublicKey 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
public void setServerKey(PublicKey serverKey)
-
getServerKeyVerifier
public ServerKeyVerifier 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
public void setServerKeyVerifier(ServerKeyVerifier serverKeyVerifier)
- Specified by:
setServerKeyVerifierin interfaceClientAuthenticationManager
-
getUserInteraction
public UserInteraction getUserInteraction()
- Specified by:
getUserInteractionin interfaceClientAuthenticationManager- Returns:
- A
UserInteractionobject to communicate with the user (may benullto indicate that no such communication is allowed)
-
setUserInteraction
public void setUserInteraction(UserInteraction userInteraction)
- Specified by:
setUserInteractionin interfaceClientAuthenticationManager
-
getPasswordAuthenticationReporter
public PasswordAuthenticationReporter getPasswordAuthenticationReporter()
- Specified by:
getPasswordAuthenticationReporterin interfaceClientAuthenticationManager
-
setPasswordAuthenticationReporter
public void setPasswordAuthenticationReporter(PasswordAuthenticationReporter reporter)
- Specified by:
setPasswordAuthenticationReporterin interfaceClientAuthenticationManager
-
getUserAuthFactories
public List<UserAuthFactory> getUserAuthFactories()
- Specified by:
getUserAuthFactoriesin interfaceUserAuthFactoriesManager<ClientSession,UserAuth,UserAuthFactory>
-
setUserAuthFactories
public void setUserAuthFactories(List<UserAuthFactory> userAuthFactories)
- Specified by:
setUserAuthFactoriesin interfaceUserAuthFactoriesManager<ClientSession,UserAuth,UserAuthFactory>
-
getRegisteredIdentities
public AuthenticationIdentitiesProvider getRegisteredIdentities()
- Specified by:
getRegisteredIdentitiesin interfaceClientAuthenticationManager- Returns:
- The
AuthenticationIdentitiesProviderto be used for attempting password or public key authentication
-
getPasswordIdentityProvider
public PasswordIdentityProvider 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:
ClientAuthenticationManager.addPasswordIdentity(String)
-
setPasswordIdentityProvider
public void setPasswordIdentityProvider(PasswordIdentityProvider provider)
- Specified by:
setPasswordIdentityProviderin interfaceClientAuthenticationManager
-
getKeyIdentityProvider
public KeyIdentityProvider getKeyIdentityProvider()
- Specified by:
getKeyIdentityProviderin interfaceKeyIdentityProviderHolder
-
setKeyIdentityProvider
public void setKeyIdentityProvider(KeyIdentityProvider keyIdentityProvider)
- Specified by:
setKeyIdentityProviderin interfaceKeyIdentityProviderHolder
-
getPublicKeyAuthenticationReporter
public PublicKeyAuthenticationReporter getPublicKeyAuthenticationReporter()
- Specified by:
getPublicKeyAuthenticationReporterin interfaceClientAuthenticationManager
-
setPublicKeyAuthenticationReporter
public void setPublicKeyAuthenticationReporter(PublicKeyAuthenticationReporter reporter)
- Specified by:
setPublicKeyAuthenticationReporterin interfaceClientAuthenticationManager
-
getHostBasedAuthenticationReporter
public HostBasedAuthenticationReporter getHostBasedAuthenticationReporter()
- Specified by:
getHostBasedAuthenticationReporterin interfaceClientAuthenticationManager
-
setHostBasedAuthenticationReporter
public void setHostBasedAuthenticationReporter(HostBasedAuthenticationReporter reporter)
- Specified by:
setHostBasedAuthenticationReporterin interfaceClientAuthenticationManager
-
getClientProxyConnector
public ClientProxyConnector getClientProxyConnector()
- Specified by:
getClientProxyConnectorin interfaceClientProxyConnectorHolder
-
setClientProxyConnector
public void setClientProxyConnector(ClientProxyConnector proxyConnector)
- Specified by:
setClientProxyConnectorin interfaceClientProxyConnectorHolder
-
addPasswordIdentity
public void addPasswordIdentity(String password)
- 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
public String removePasswordIdentity(String password)
- 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
public void addPublicKeyIdentity(KeyPair kp)
- 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
public KeyPair removePublicKeyIdentity(KeyPair kp)
- 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
protected void initializeKeyExchangePhase() throws Exception- Throws:
Exception
-
initializeProxyConnector
protected void initializeProxyConnector() throws Exception- Throws:
Exception
-
sendClientIdentification
protected IoWriteFuture sendClientIdentification() throws Exception
- Throws:
Exception
-
createChannel
public ClientChannel createChannel(String type) throws IOException
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
public ClientChannel createChannel(String type, String subType) throws IOException
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 IOException
Description 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 IOException
Description 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
public ChannelSubsystem createSubsystemChannel(String subsystem) throws IOException
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
protected ClientUserAuthService getUserAuthService()
-
getConnectionService
protected ConnectionService 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
public void stopLocalPortForwarding(SshdSocketAddress local) throws IOException
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
public void stopRemotePortForwarding(SshdSocketAddress remote) throws IOException
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
public SshdSocketAddress startDynamicPortForwarding(SshdSocketAddress local) throws IOException
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
public void stopDynamicPortForwarding(SshdSocketAddress local) throws IOException
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
protected Forwarder getForwarder()
- Overrides:
getForwarderin classSessionHelper
-
resolveAvailableSignaturesProposal
protected String resolveAvailableSignaturesProposal(FactoryManager manager)
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
public void startService(String name, Buffer buffer) throws Exception
- 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 IOException
Description 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
protected boolean readIdentification(Buffer buffer) throws Exception
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
protected void signalExtraServerVersionInfo(String version, List<String> lines) throws Exception
- Throws:
Exception
-
sendKexInit
protected byte[] sendKexInit(Map<KexProposalOption,String> proposal) throws Exception
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
protected byte[] receiveKexInit(Buffer buffer) throws Exception
- Overrides:
receiveKexInitin classAbstractSession- Throws:
Exception
-
receiveKexInit
protected void receiveKexInit(Map<KexProposalOption,String> proposal, byte[] seed) throws IOException
- Specified by:
receiveKexInitin classAbstractSession- Throws:
IOException
-
checkKeys
protected void checkKeys() throws IOExceptionDescription 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
public KeyExchangeFuture switchToNoneCipher() throws IOException
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
-
-