Class AbstractClientSession
- All Implemented Interfaces:
Closeable, AutoCloseable, Channel, ClientAuthenticationManager, ClientSession, org.apache.sshd.common.AttributeRepository, org.apache.sshd.common.AttributeStore, org.apache.sshd.common.auth.MutableUserHolder, org.apache.sshd.common.auth.UserAuthFactoriesManager<ClientSession, UserAuth, UserAuthFactory>, org.apache.sshd.common.auth.UsernameHolder, ChannelListenerManager, ChannelStreamWriterResolver, ChannelStreamWriterResolverManager, org.apache.sshd.common.Closeable, FactoryManagerHolder, PortForwardingEventListenerManager, PortForwardingInformationProvider, PortForwardingManager, KexExtensionHandlerManager, KexFactoryManager, org.apache.sshd.common.keyprovider.KeyIdentityProviderHolder, org.apache.sshd.common.PropertyResolver, ReservedSessionMessagesManager, Session, org.apache.sshd.common.session.SessionContext, SessionDisconnectHandlerManager, org.apache.sshd.common.session.SessionHeartbeatController, SessionListenerManager, UnknownChannelReferenceHandlerManager, org.apache.sshd.common.signature.SignatureFactoriesHolder, org.apache.sshd.common.signature.SignatureFactoriesManager, org.apache.sshd.common.util.net.ConnectionEndpointsIndicator
- Direct Known Subclasses:
ClientSessionImpl
ClientSession related methods- Author:
- Apache MINA SSHD Project
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
org.apache.sshd.common.util.closeable.AbstractCloseable.StateNested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
org.apache.sshd.common.AttributeRepository.AttributeKey<T>Nested classes/interfaces inherited from interface ClientSession
ClientSession.ClientSessionEventNested classes/interfaces inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
org.apache.sshd.common.session.SessionHeartbeatController.HeartbeatType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.sshd.common.AttributeRepository.AttributeKey<org.apache.sshd.client.config.hosts.HostConfigEntry> static final org.apache.sshd.common.AttributeRepository.AttributeKey<ProxyData> protected final booleanprotected final booleanFields inherited from class AbstractSession
channelListenerProxy, channelListeners, clientVersion, currentService, random, serverVersion, SESSION, sessionListenerProxy, sessionListeners, tunnelListenerProxy, tunnelListenersFields inherited from class 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 ChannelStreamWriterResolver
NONEFields inherited from interface 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, org.apache.sshd.common.io.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(org.apache.sshd.common.util.net.SshdSocketAddress local, org.apache.sshd.common.util.net.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, org.apache.sshd.common.channel.PtyChannelConfigurationHolder ptyConfig, Map<String, ?> env) Create a channel to execute a command using specific PTY settings and/or environment.createExecChannel(String command, Charset charset, org.apache.sshd.common.channel.PtyChannelConfigurationHolder ptyConfig, Map<String, ?> env) Create a channel to execute a command using specific PTY settings and/or environment.createShellChannel(org.apache.sshd.common.channel.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.org.apache.sshd.common.AttributeRepositoryprotected ConnectionServiceprotected Forwarderorg.apache.sshd.client.config.hosts.HostConfigEntryRetrieves theHostConfigEntrythat was used to create this session.Retrieves this side's initial proposal for KEX negotiation.org.apache.sshd.common.keyprovider.KeyIdentityProviderorg.apache.sshd.client.auth.password.PasswordIdentityProviderRetrievePasswordIdentityProviderused to provide password candidatesObtains a read-only collection of all currently registered server host keys is OpenSSH format, i.e. key type as a string, followed by the base64-encoded key, prefixed with "@cert-authority" if it's a CA key.org.apache.sshd.client.auth.AuthenticationIdentitiesProviderRetrieves the server's host key: the one it presented in the last key exchange.Retrieve the server key verifier to be used to check the key when connecting to an SSH server.protected ClientUserAuthServiceprotected booleanreadIdentification(org.apache.sshd.common.util.buffer.Buffer buffer) Read the other side identification.voidregisterHostKey(PublicKey hostKey) Explicitly registers a known host key for the session.removePasswordIdentity(String password) protected StringComputes the list of available host key signature algorithms supported.voidsetConnectAddress(SocketAddress connectAddress) voidvoidsetKeyIdentityProvider(org.apache.sshd.common.keyprovider.KeyIdentityProvider keyIdentityProvider) voidvoidsetPasswordIdentityProvider(org.apache.sshd.client.auth.password.PasswordIdentityProvider provider) voidvoidsetServerKey(PublicKey serverKey) voidsetServerKeyVerifier(ServerKeyVerifier serverKeyVerifier) protected voidvoidsetUserAuthFactories(List<UserAuthFactory> userAuthFactories) voidsetUserInteraction(UserInteraction userInteraction) protected voidsignalExtraServerVersionInfo(String version, List<String> lines) org.apache.sshd.common.util.net.SshdSocketAddressstartDynamicPortForwarding(org.apache.sshd.common.util.net.SshdSocketAddress local) Start dynamic local port forwarding using a SOCKS proxy.org.apache.sshd.common.util.net.SshdSocketAddressstartLocalPortForwarding(org.apache.sshd.common.util.net.SshdSocketAddress local, org.apache.sshd.common.util.net.SshdSocketAddress remote) Start forwarding the given local address on the client to the given address on the server.org.apache.sshd.common.util.net.SshdSocketAddressstartRemotePortForwarding(org.apache.sshd.common.util.net.SshdSocketAddress remote, org.apache.sshd.common.util.net.SshdSocketAddress local) Start forwarding tcpip from the given address on the server to the given address on the client.voidstartService(String name, org.apache.sshd.common.util.buffer.Buffer buffer) voidstopDynamicPortForwarding(org.apache.sshd.common.util.net.SshdSocketAddress local) Stop a previously started dynamic port forwarding.voidstopLocalPortForwarding(org.apache.sshd.common.util.net.SshdSocketAddress local) Stop forwarding the given local address.voidstopRemotePortForwarding(org.apache.sshd.common.util.net.SshdSocketAddress remote) Stop forwarding of the given remote address.Switch to a none cipher for performance.Methods inherited from class AbstractSession
addChannelListener, addKexListener, addPortForwardingEventListener, addSessionListener, attachSession, createBuffer, doInvokeUnimplementedMessageHandler, getChannelListenerProxy, getCipherInformation, getClientKexProposals, getClientVersion, getCompressionInformation, getCurrentService, getFilterChain, getInnerCloseable, getKexNegotiationResult, getKexState, getMacInformation, getNegotiatedKexParameter, getPortForwardingEventListenerProxy, getServerKexProposals, getServerVersion, getService, getServices, getSession, getSession, getSessionId, getSessionListenerProxy, getTransport, handleKexExtension, handleMessage, handleNewCompression, handleServiceAccept, handleServiceAccept, handleServiceRequest, handleServiceRequest, initializeCurrentService, initializeKeyExchangePhase, isConnectionSecure, isStrictKex, notImplemented, preClose, prepareBuffer, reExchangeKeys, removeChannelListener, removeKexListener, removePortForwardingEventListener, removeSessionListener, request, request, resolveSessionKexProposal, start, validateTargetBuffer, writePacket, writePacketMethods inherited from class SessionHelper
attributeKeys, checkAuthenticationTimeout, checkForTimeouts, checkIdleTimeout, clearAttributes, computeAttributeIfAbsent, createProposal, disconnect, doInvokeDebugMessageHandler, doInvokeIgnoreMessageHandler, doReadIdentification, exceptionCaught, getAttribute, getAttributesCount, getAuthTimeout, getAuthTimeoutStart, getBoundLocalPortForwards, getBoundRemotePortForward, getChannelStreamWriterResolver, getIdleTimeout, getIdleTimeoutStart, getIoSession, 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, resolveAvailableSignaturesProposal, resolveChannelStreamWriterResolver, resolveIdentificationString, resolvePeerAddress, resolveReservedSessionMessagesHandler, resolveUnknownChannelReferenceHandler, sendDebugMessage, sendIgnoreMessage, sendNotImplemented, setAttribute, setAuthenticated, setChannelStreamWriterResolver, setReservedSessionMessagesHandler, setSessionDisconnectHandler, setUnknownChannelReferenceHandler, setUsername, signalDisconnect, signalExceptionCaught, signalNegotiationEnd, signalNegotiationOptionsCreated, signalNegotiationStart, signalPeerIdentificationReceived, signalReadPeerIdentificationLine, signalSendIdentification, signalSessionClosed, signalSessionCreated, signalSessionEvent, signalSessionStarting, toStringMethods inherited from class 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 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 ChannelListenerManager
addChannelListener, getChannelListenerProxy, removeChannelListenerMethods inherited from interface ChannelStreamWriterResolverManager
getChannelStreamWriterResolver, resolveChannelStreamWriter, resolveChannelStreamWriterResolver, setChannelStreamWriterResolverMethods inherited from interface ClientAuthenticationManager
setUserAuthFactoriesNamesMethods inherited from interface ClientSession
auth, createDynamicPortForwardingTracker, createExecChannel, createExecChannel, createLocalPortForwardingTracker, createLocalPortForwardingTracker, createRemotePortForwardingTracker, createShellChannel, executeRemoteCommand, executeRemoteCommand, executeRemoteCommand, 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 KexExtensionHandlerManager
getKexExtensionHandler, setKexExtensionHandlerMethods inherited from interface 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 PortForwardingEventListenerManager
addPortForwardingEventListener, getPortForwardingEventListenerProxy, removePortForwardingEventListenerMethods inherited from interface PortForwardingInformationProvider
getBoundLocalPortForwards, getBoundRemotePortForward, getLocalForwardsBindings, getRemoteForwardsBindings, getStartedLocalPortForwards, getStartedRemotePortForwards, isLocalPortForwardingStartedForPort, isRemotePortForwardingStartedForPortMethods inherited from interface 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 ReservedSessionMessagesManager
getReservedSessionMessagesHandler, setReservedSessionMessagesHandlerMethods inherited from interface Session
createBuffer, createBuffer, disconnect, exceptionCaught, getAuthTimeout, getAuthTimeoutStart, getFilterChain, getIdleTimeout, getIdleTimeoutStart, getIoSession, 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 SessionDisconnectHandlerManager
getSessionDisconnectHandler, setSessionDisconnectHandlerMethods inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
disableSessionHeartbeat, getSessionHeartbeatInterval, getSessionHeartbeatType, setSessionHeartbeat, setSessionHeartbeatMethods inherited from interface 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 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
-
HOST_CONFIG_ENTRY
public static final org.apache.sshd.common.AttributeRepository.AttributeKey<org.apache.sshd.client.config.hosts.HostConfigEntry> HOST_CONFIG_ENTRY -
PROXY_DATA
-
sendImmediateClientIdentification
protected final boolean sendImmediateClientIdentification -
sendImmediateKexInit
protected final boolean sendImmediateKexInit
-
-
Constructor Details
-
AbstractClientSession
protected AbstractClientSession(ClientFactoryManager factoryManager, org.apache.sshd.common.io.IoSession ioSession)
-
-
Method Details
-
setupFilterChain
protected void setupFilterChain()- Overrides:
setupFilterChainin classAbstractSession
-
getHostConfigEntry
public org.apache.sshd.client.config.hosts.HostConfigEntry getHostConfigEntry()Description copied from interface:ClientSessionRetrieves theHostConfigEntrythat was used to create this session.- Specified by:
getHostConfigEntryin interfaceClientSession- Returns:
- the
HostConfigEntry; ornullif none
-
getConnectionContext
public org.apache.sshd.common.AttributeRepository 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 host key: the one it presented in the last key exchange.- Specified by:
getServerKeyin interfaceClientSession- Returns:
- the server's
PublicKey; may benullif no key exchange has been completed yet
-
setServerKey
-
registerHostKey
Description copied from interface:ClientSessionExplicitly registers a known host key for the session. Intended to be used if the server announces additional host keys as part of the OpenSSH "hostkeys-00@openssh.com" extension, but it can also be used to register any host key at any other time.If the server presents a host key that matches any of the ones registered in the session, the key will be accepted implicitly without consulting the
ServerKeyVerifier.If the
hostKeyis a host certificate, the CA key will be registered. When the server presents a certificate, the certificate will be checked in any case and will be rejected if it is invalid or expired. If it is valid and not expired, it will be accepted implicitly if its CA key is already registered.- Specified by:
registerHostKeyin interfaceClientSession- Parameters:
hostKey- the host key to register
-
getRegisteredHostKeys
Description copied from interface:ClientSessionObtains a read-only collection of all currently registered server host keys is OpenSSH format, i.e. key type as a string, followed by the base64-encoded key, prefixed with "@cert-authority" if it's a CA key.For a normal key: "key-type AAAA..."; for a host certificate CA key "@cert-authority key-type AAAA...".
Note that this is not quite the format used in a OpenSSH
known_hostsfile as there are no host patterns.- Specified by:
getRegisteredHostKeysin interfaceClientSession- Returns:
- all currently registered server host keys; never
nullbut possibly empty, and never containingnull
-
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
-
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
- Specified by:
getUserAuthFactoriesin interfaceorg.apache.sshd.common.auth.UserAuthFactoriesManager<ClientSession, UserAuth, UserAuthFactory>
-
setUserAuthFactories
- Specified by:
setUserAuthFactoriesin interfaceorg.apache.sshd.common.auth.UserAuthFactoriesManager<ClientSession, UserAuth, UserAuthFactory>
-
getRegisteredIdentities
public org.apache.sshd.client.auth.AuthenticationIdentitiesProvider getRegisteredIdentities()- Specified by:
getRegisteredIdentitiesin interfaceClientAuthenticationManager- Returns:
- The
AuthenticationIdentitiesProviderto be used for attempting password or public key authentication
-
getPasswordIdentityProvider
public org.apache.sshd.client.auth.password.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:
-
setPasswordIdentityProvider
public void setPasswordIdentityProvider(org.apache.sshd.client.auth.password.PasswordIdentityProvider provider) - Specified by:
setPasswordIdentityProviderin interfaceClientAuthenticationManager
-
getKeyIdentityProvider
public org.apache.sshd.common.keyprovider.KeyIdentityProvider getKeyIdentityProvider()- Specified by:
getKeyIdentityProviderin interfaceorg.apache.sshd.common.keyprovider.KeyIdentityProviderHolder
-
setKeyIdentityProvider
public void setKeyIdentityProvider(org.apache.sshd.common.keyprovider.KeyIdentityProvider keyIdentityProvider) - Specified by:
setKeyIdentityProviderin interfaceorg.apache.sshd.common.keyprovider.KeyIdentityProviderHolder
-
getPublicKeyAuthenticationReporter
- Specified by:
getPublicKeyAuthenticationReporterin interfaceClientAuthenticationManager
-
setPublicKeyAuthenticationReporter
- Specified by:
setPublicKeyAuthenticationReporterin interfaceClientAuthenticationManager
-
getHostBasedAuthenticationReporter
- Specified by:
getHostBasedAuthenticationReporterin interfaceClientAuthenticationManager
-
setHostBasedAuthenticationReporter
- Specified by:
setHostBasedAuthenticationReporterin interfaceClientAuthenticationManager
-
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
-
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, org.apache.sshd.common.channel.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, org.apache.sshd.common.channel.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(org.apache.sshd.common.util.net.SshdSocketAddress local, org.apache.sshd.common.util.net.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 org.apache.sshd.common.util.net.SshdSocketAddress startLocalPortForwarding(org.apache.sshd.common.util.net.SshdSocketAddress local, org.apache.sshd.common.util.net.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(org.apache.sshd.common.util.net.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 org.apache.sshd.common.util.net.SshdSocketAddress startRemotePortForwarding(org.apache.sshd.common.util.net.SshdSocketAddress remote, org.apache.sshd.common.util.net.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(org.apache.sshd.common.util.net.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 org.apache.sshd.common.util.net.SshdSocketAddress startDynamicPortForwarding(org.apache.sshd.common.util.net.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(org.apache.sshd.common.util.net.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
- 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
public void startService(String name, org.apache.sshd.common.util.buffer.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(org.apache.sshd.common.channel.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
protected boolean readIdentification(org.apache.sshd.common.util.buffer.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
-
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
-
getKexProposal
protected Map<org.apache.sshd.common.kex.KexProposalOption, String> getKexProposal() throws ExceptionDescription copied from class:SessionHelperRetrieves this side's initial proposal for KEX negotiation. If no proposal exists yet, one is created and passed though theKexExtensionHandlerand theSessionListenerfor customization, otherwise the previously created proposal for the session is returned.- Overrides:
getKexProposalin classSessionHelper- Returns:
- the proposal
Map - Throws:
Exception- when no proposal can be created
-