Package org.apache.sshd.server.session
Class AbstractServerSession
- 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.server.session.AbstractServerSession
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,AttributeRepository,AttributeStore,MutableUserHolder,UserAuthFactoriesManager<ServerSession,UserAuth,UserAuthFactory>,UsernameHolder,ChannelListenerManager,ChannelStreamWriterResolver,ChannelStreamWriterResolverManager,Closeable,FactoryManagerHolder,PortForwardingEventListenerManager,PortForwardingInformationProvider,KexExtensionHandlerManager,KexFactoryManager,KeyPairProviderHolder,PropertyResolver,ReservedSessionMessagesManager,Session,SessionContext,SessionDisconnectHandlerManager,SessionHeartbeatController,SessionListenerManager,UnknownChannelReferenceHandlerManager,SignatureFactoriesHolder,SignatureFactoriesManager,ConnectionEndpointsIndicator,ServerAuthenticationManager,ServerProxyAcceptorHolder,ServerSession
- Direct Known Subclasses:
ServerSessionImpl
public abstract class AbstractServerSession extends AbstractSession implements ServerSession
Provides default implementations forServerSessionrelated 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.common.session.SessionHeartbeatController
SessionHeartbeatController.HeartbeatType
-
-
Field Summary
-
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.common.PropertyResolver
EMPTY
-
Fields inherited from interface org.apache.sshd.server.ServerAuthenticationManager
DEFAULT_USER_AUTH_GSS_FACTORY, DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY, DEFAULT_USER_AUTH_PASSWORD_FACTORY, DEFAULT_USER_AUTH_PUBLIC_KEY_FACTORY
-
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 protectedAbstractServerSession(ServerFactoryManager factoryManager, IoSession ioSession)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 keyintgetActiveSessionCountForUser(String userName)Retrieve the current number of sessions active for a given username.SocketAddressgetClientAddress()protected ConnectionServicegetConnectionService()ServerFactoryManagergetFactoryManager()GSSAuthenticatorgetGSSAuthenticator()Retrieve theGSSAuthenticatorto be used by the SSH server.HostBasedAuthenticatorgetHostBasedAuthenticator()Retrieve theHostBasedAuthenticatorto be used by the SSH server.KeyPairgetHostKey()HostKeyCertificateProvidergetHostKeyCertificateProvider()longgetId()KeyboardInteractiveAuthenticatorgetKeyboardInteractiveAuthenticator()Retrieve theKeyboardInteractiveAuthenticatorto be used by the SSH server.KeyPairProvidergetKeyPairProvider()PasswordAuthenticatorgetPasswordAuthenticator()Retrieve thePasswordAuthenticatorto be used by the SSH server.PublickeyAuthenticatorgetPublickeyAuthenticator()Retrieve thePublickeyAuthenticatorto be used by SSH server.ServerProxyAcceptorgetServerProxyAcceptor()List<UserAuthFactory>getUserAuthFactories()protected voidhandleServiceAccept(String serviceName, Buffer buffer)protected booleanhandleServiceRequest(String serviceName, Buffer buffer)protected booleanreadIdentification(Buffer buffer)Read the other side identification.protected voidreceiveKexInit(Map<KexProposalOption,String> proposal, byte[] seed)protected StringresolveAvailableSignaturesProposal(FactoryManager proposedManager)Computes the list of available host key signature algorithms supported.protected StringresolveEmptySignaturesProposal(Iterable<String> supported, Iterable<String> provided)Called byresolveAvailableSignaturesProposal(FactoryManager)if none of the provided keys is supported - last chance for the derived implementation to do somethingprotected byte[]sendKexInit(Map<KexProposalOption,String> proposal)Send the key exchange initialization packet.protected IoWriteFuturesendServerIdentification(List<String> headerLines)Sends the server identification + any extra header linesvoidsetClientAddress(SocketAddress clientAddress)voidsetGSSAuthenticator(GSSAuthenticator gssAuthenticator)voidsetHostBasedAuthenticator(HostBasedAuthenticator hostBasedAuthenticator)voidsetHostKeyCertificateProvider(HostKeyCertificateProvider hostKeyCertificateProvider)protected voidsetKexSeed(byte... seed)voidsetKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator interactiveAuthenticator)voidsetKeyPairProvider(KeyPairProvider keyPairProvider)voidsetPasswordAuthenticator(PasswordAuthenticator passwordAuthenticator)voidsetPublickeyAuthenticator(PublickeyAuthenticator publickeyAuthenticator)voidsetServerProxyAcceptor(ServerProxyAcceptor proxyAcceptor)voidsetUserAuthFactories(List<UserAuthFactory> userAuthFactories)IoWriteFuturesignalAuthenticationSuccess(String username, String authService, Buffer buffer)voidstartService(String name, Buffer buffer)-
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, handleServiceRequest, initializeCurrentService, initializeKeyExchangeMessageHandler, isRekeyBlocksCountExceeded, isRekeyDataSizeExceeded, isRekeyPacketCountsExceeded, isRekeyRequired, isRekeyTimeIntervalExceeded, messageReceived, negotiate, notImplemented, preClose, prepareBuffer, prepareNewKeys, preProcessEncodeBuffer, receiveKexInit, 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, getForwarder, 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.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.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.server.ServerAuthenticationManager
setUserAuthFactoriesNames
-
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
-
AbstractServerSession
protected AbstractServerSession(ServerFactoryManager factoryManager, IoSession ioSession)
-
-
Method Detail
-
getFactoryManager
public ServerFactoryManager getFactoryManager()
- Specified by:
getFactoryManagerin interfaceFactoryManagerHolder- Specified by:
getFactoryManagerin interfaceServerSession- Overrides:
getFactoryManagerin classSessionHelper- Returns:
- The currently associated
FactoryManager
-
getServerProxyAcceptor
public ServerProxyAcceptor getServerProxyAcceptor()
- Specified by:
getServerProxyAcceptorin interfaceServerProxyAcceptorHolder
-
setServerProxyAcceptor
public void setServerProxyAcceptor(ServerProxyAcceptor proxyAcceptor)
- Specified by:
setServerProxyAcceptorin interfaceServerProxyAcceptorHolder
-
getClientAddress
public SocketAddress getClientAddress()
- Specified by:
getClientAddressin interfaceServerSession- Returns:
- The
SocketAddressof the remote client. If no proxy wrapping was used then this is the same as theIoSession#getRemoteAddress(). Otherwise, it indicates the real client's address that was somehow transmitted via the proxy meta-data
-
setClientAddress
public void setClientAddress(SocketAddress clientAddress)
-
getPasswordAuthenticator
public PasswordAuthenticator getPasswordAuthenticator()
Description copied from interface:ServerAuthenticationManagerRetrieve thePasswordAuthenticatorto be used by the SSH server. If no authenticator has been configured (i.e. this method returnsnull), then client authentication requests based on passwords will be rejected.- Specified by:
getPasswordAuthenticatorin interfaceServerAuthenticationManager- Returns:
- the
PasswordAuthenticatorornull
-
setPasswordAuthenticator
public void setPasswordAuthenticator(PasswordAuthenticator passwordAuthenticator)
- Specified by:
setPasswordAuthenticatorin interfaceServerAuthenticationManager
-
getPublickeyAuthenticator
public PublickeyAuthenticator getPublickeyAuthenticator()
Description copied from interface:ServerAuthenticationManagerRetrieve thePublickeyAuthenticatorto be used by SSH server. If no authenticator has been configured (i.e. this method returnsnull), then client authentication requests based on keys will be rejected.- Specified by:
getPublickeyAuthenticatorin interfaceServerAuthenticationManager- Returns:
- the
PublickeyAuthenticatorornull
-
setPublickeyAuthenticator
public void setPublickeyAuthenticator(PublickeyAuthenticator publickeyAuthenticator)
- Specified by:
setPublickeyAuthenticatorin interfaceServerAuthenticationManager
-
getKeyboardInteractiveAuthenticator
public KeyboardInteractiveAuthenticator getKeyboardInteractiveAuthenticator()
Description copied from interface:ServerAuthenticationManagerRetrieve theKeyboardInteractiveAuthenticatorto be used by the SSH server. If no authenticator has been configured (i.e. this method returnsnull), then client authentication requests based on this method will be rejected.- Specified by:
getKeyboardInteractiveAuthenticatorin interfaceServerAuthenticationManager- Returns:
- The
KeyboardInteractiveAuthenticatorornull
-
setKeyboardInteractiveAuthenticator
public void setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator interactiveAuthenticator)
- Specified by:
setKeyboardInteractiveAuthenticatorin interfaceServerAuthenticationManager
-
getGSSAuthenticator
public GSSAuthenticator getGSSAuthenticator()
Description copied from interface:ServerAuthenticationManagerRetrieve theGSSAuthenticatorto be used by the SSH server. If no authenticator has been configured (i.e. this method returnsnull), then client authentication requests based on gssapi will be rejected.- Specified by:
getGSSAuthenticatorin interfaceServerAuthenticationManager- Returns:
- the
GSSAuthenticatorornull
-
setGSSAuthenticator
public void setGSSAuthenticator(GSSAuthenticator gssAuthenticator)
- Specified by:
setGSSAuthenticatorin interfaceServerAuthenticationManager
-
getHostBasedAuthenticator
public HostBasedAuthenticator getHostBasedAuthenticator()
Description copied from interface:ServerAuthenticationManagerRetrieve theHostBasedAuthenticatorto be used by the SSH server. If no authenticator has been configured (i.e. this method returnsnull), then client authentication requests based on this method will be rejected.- Specified by:
getHostBasedAuthenticatorin interfaceServerAuthenticationManager- Returns:
- the
HostBasedAuthenticatorornull
-
setHostBasedAuthenticator
public void setHostBasedAuthenticator(HostBasedAuthenticator hostBasedAuthenticator)
- Specified by:
setHostBasedAuthenticatorin interfaceServerAuthenticationManager
-
getUserAuthFactories
public List<UserAuthFactory> getUserAuthFactories()
- Specified by:
getUserAuthFactoriesin interfaceUserAuthFactoriesManager<ServerSession,UserAuth,UserAuthFactory>
-
setUserAuthFactories
public void setUserAuthFactories(List<UserAuthFactory> userAuthFactories)
- Specified by:
setUserAuthFactoriesin interfaceUserAuthFactoriesManager<ServerSession,UserAuth,UserAuthFactory>
-
getKeyPairProvider
public KeyPairProvider getKeyPairProvider()
- Specified by:
getKeyPairProviderin interfaceKeyPairProviderHolder
-
getHostKeyCertificateProvider
public HostKeyCertificateProvider getHostKeyCertificateProvider()
- Specified by:
getHostKeyCertificateProviderin interfaceServerAuthenticationManager- Returns:
- a
HostKeyCertificateProviderif available, null as default
-
setHostKeyCertificateProvider
public void setHostKeyCertificateProvider(HostKeyCertificateProvider hostKeyCertificateProvider)
- Specified by:
setHostKeyCertificateProviderin interfaceServerAuthenticationManager
-
setKeyPairProvider
public void setKeyPairProvider(KeyPairProvider keyPairProvider)
- Specified by:
setKeyPairProviderin interfaceKeyPairProviderHolder
-
sendServerIdentification
protected IoWriteFuture sendServerIdentification(List<String> headerLines) throws Exception
Sends the server identification + any extra header lines- Parameters:
headerLines- Extra header lines to be prepended to the actual identification string - ignored ifnull/empty- Returns:
- An
IoWriteFuturethat can be used to be notified of identification data being written successfully or failing - Throws:
Exception- If failed to send identification- See Also:
- RFC 4253 - section 4.2
-
checkKeys
protected void 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
-
handleServiceRequest
protected boolean handleServiceRequest(String serviceName, Buffer buffer) throws Exception
- Overrides:
handleServiceRequestin classAbstractSession- Throws:
Exception
-
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
-
signalAuthenticationSuccess
public IoWriteFuture signalAuthenticationSuccess(String username, String authService, Buffer buffer) throws Exception
Description copied from interface:ServerSession- Marks the session as authenticated.
- Starts the specified service.
- Sends the
SSH_MSG_USERAUTH_SUCCESSmessage.
- Specified by:
signalAuthenticationSuccessin interfaceServerSession- Parameters:
username- The authenticated usernameauthService- The service to startbuffer- Any extra data received to use to start the service- Returns:
- An
IoWriteFuturethat can be used to wait for theSSH_MSG_USERAUTH_SUCCESSmessage send result - Throws:
Exception- if cannot handle the request
-
handleServiceAccept
protected void handleServiceAccept(String serviceName, Buffer buffer) throws Exception
- Overrides:
handleServiceAcceptin classAbstractSession- 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
-
resolveAvailableSignaturesProposal
protected String resolveAvailableSignaturesProposal(FactoryManager proposedManager) throws IOException, GeneralSecurityException
Description copied from class:SessionHelperComputes the list of available host key signature algorithms supported.- Specified by:
resolveAvailableSignaturesProposalin classSessionHelper- Parameters:
proposedManager- TheFactoryManager- Returns:
- A comma-separated list of all the signature protocols to be included in the
proposal -
null/empty if no proposal - Throws:
IOException- If failed to read/parse the keys dataGeneralSecurityException- If failed to generate the keys
-
resolveEmptySignaturesProposal
protected String resolveEmptySignaturesProposal(Iterable<String> supported, Iterable<String> provided)
Called byresolveAvailableSignaturesProposal(FactoryManager)if none of the provided keys is supported - last chance for the derived implementation to do something- Parameters:
supported- The supported key types - may benull/emptyprovided- The available signature types - may benull/empty- Returns:
- The resolved proposal -
nullby default
-
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
-
receiveKexInit
protected void receiveKexInit(Map<KexProposalOption,String> proposal, byte[] seed) throws IOException
- Specified by:
receiveKexInitin classAbstractSession- Throws:
IOException
-
getHostKey
public KeyPair getHostKey()
- Specified by:
getHostKeyin interfaceServerSession- Returns:
- The
KeyPairrepresenting the current session's used keys on KEX -nullif not negotiated yet
-
getActiveSessionCountForUser
public int getActiveSessionCountForUser(String userName)
Description copied from interface:ServerSessionRetrieve the current number of sessions active for a given username.- Specified by:
getActiveSessionCountForUserin interfaceServerSession- Parameters:
userName- The name of the user - ignored ifnull/empty- Returns:
- The current number of live
SshSessionobjects associated with the user
-
getId
public long getId()
- Returns:
- The underlying
IoSessionid.
-
getConnectionService
protected ConnectionService getConnectionService()
- Specified by:
getConnectionServicein classSessionHelper
-
-