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:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.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 forServerSession
related methods
-
-
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>
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
SessionHeartbeatController.HeartbeatType
-
-
Field Summary
Fields Modifier and Type Field Description private java.net.SocketAddress
clientAddress
private GSSAuthenticator
gssAuthenticator
private HostBasedAuthenticator
hostBasedAuthenticator
private HostKeyCertificateProvider
hostKeyCertificateProvider
private KeyboardInteractiveAuthenticator
interactiveAuthenticator
private KeyPairProvider
keyPairProvider
private PasswordAuthenticator
passwordAuthenticator
private ServerProxyAcceptor
proxyAcceptor
private PublickeyAuthenticator
publickeyAuthenticator
private java.util.List<UserAuthFactory>
userAuthFactories
-
Fields inherited from class org.apache.sshd.common.session.helpers.AbstractSession
channelListenerProxy, channelListeners, clientProposal, clientVersion, currentService, decodeLock, decoderBuffer, decoderLength, decoderState, discarding, encodeLock, firstKexPacketFollows, ignorePacketDataLength, ignorePacketsCount, ignorePacketsFrequency, ignorePacketsVariance, inBlocksCount, inBytesCount, inCipher, inCipherSize, inCompression, initialKexDone, initialKexInitSequenceNumber, inMac, inMacResult, inMacSize, inPacketsCount, inSettings, kex, kexFutureHolder, kexHandler, kexInitializedFuture, kexState, lastKeyTimeValue, maxRekeyBlocks, maxRekeyBytes, maxRekeyInterval, maxRekyPackets, negotiationResult, outBlocksCount, outBytesCount, outCipher, outCipherSize, outCompression, outMac, outMacSize, outPacketsCount, outSettings, random, requestLock, seqi, seqo, serverProposal, serverVersion, SESSION, sessionId, sessionListenerProxy, sessionListeners, strictKex, tunnelListenerProxy, tunnelListeners, uncompressBuffer, unmodClientProposal, unmodNegotiationResult, 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 protected
AbstractServerSession(ServerFactoryManager factoryManager, IoSession ioSession)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkKeys()
Indicates the the key exchange is completed and the exchanged keys can now be verified - e.g., client can verify the server's keyint
getActiveSessionCountForUser(java.lang.String userName)
Retrieve the current number of sessions active for a given username.java.net.SocketAddress
getClientAddress()
protected ConnectionService
getConnectionService()
ServerFactoryManager
getFactoryManager()
GSSAuthenticator
getGSSAuthenticator()
Retrieve theGSSAuthenticator
to be used by the SSH server.HostBasedAuthenticator
getHostBasedAuthenticator()
Retrieve theHostBasedAuthenticator
to be used by the SSH server.java.security.KeyPair
getHostKey()
HostKeyCertificateProvider
getHostKeyCertificateProvider()
long
getId()
KeyboardInteractiveAuthenticator
getKeyboardInteractiveAuthenticator()
Retrieve theKeyboardInteractiveAuthenticator
to be used by the SSH server.KeyPairProvider
getKeyPairProvider()
Retrieve theKeyPairProvider
that will be used to find the host key to use on the server side or the user key on the client side.PasswordAuthenticator
getPasswordAuthenticator()
Retrieve thePasswordAuthenticator
to be used by the SSH server.PublickeyAuthenticator
getPublickeyAuthenticator()
Retrieve thePublickeyAuthenticator
to be used by SSH server.ServerProxyAcceptor
getServerProxyAcceptor()
java.util.List<UserAuthFactory>
getUserAuthFactories()
Retrieve the list of named factories forUserAuth
objects.protected void
handleServiceAccept(java.lang.String serviceName, Buffer buffer)
protected boolean
handleServiceRequest(java.lang.String serviceName, Buffer buffer)
protected boolean
readIdentification(Buffer buffer)
Read the other side identification.protected void
receiveKexInit(java.util.Map<KexProposalOption,java.lang.String> proposal, byte[] seed)
protected java.lang.String
resolveAvailableSignaturesProposal(FactoryManager proposedManager)
Computes the list of available host key signature algorithms supported.protected java.lang.String
resolveEmptySignaturesProposal(java.lang.Iterable<java.lang.String> supported, java.lang.Iterable<java.lang.String> provided)
Called byresolveAvailableSignaturesProposal(FactoryManager)
if none of the provided keys is supported - last chance for the derived implementation to do somethingprotected byte[]
sendKexInit(java.util.Map<KexProposalOption,java.lang.String> proposal)
Send the key exchange initialization packet.protected IoWriteFuture
sendServerIdentification(java.util.List<java.lang.String> headerLines)
Sends the server identification + any extra header linesvoid
setClientAddress(java.net.SocketAddress clientAddress)
void
setGSSAuthenticator(GSSAuthenticator gssAuthenticator)
void
setHostBasedAuthenticator(HostBasedAuthenticator hostBasedAuthenticator)
void
setHostKeyCertificateProvider(HostKeyCertificateProvider hostKeyCertificateProvider)
protected void
setKexSeed(byte... seed)
void
setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator interactiveAuthenticator)
void
setKeyPairProvider(KeyPairProvider keyPairProvider)
void
setPasswordAuthenticator(PasswordAuthenticator passwordAuthenticator)
void
setPublickeyAuthenticator(PublickeyAuthenticator publickeyAuthenticator)
void
setServerProxyAcceptor(ServerProxyAcceptor proxyAcceptor)
void
setUserAuthFactories(java.util.List<UserAuthFactory> userAuthFactories)
IoWriteFuture
signalAuthenticationSuccess(java.lang.String username, java.lang.String authService, Buffer buffer)
void
startService(java.lang.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, doStrictKexProposal, doWritePacket, encode, encryptOutgoingBuffer, failStrictKex, getChannelListenerProxy, getCipherInformation, getClientKexData, getClientKexProposals, getClientVersion, getCompressionInformation, getInnerCloseable, getKex, getKexNegotiationResult, getKexState, getMacInformation, getNegotiatedKexParameter, getPortForwardingEventListenerProxy, getServerKexData, getServerKexProposals, getServerVersion, getService, getServices, getSession, getSession, getSessionId, getSessionListenerProxy, handleFirstKexPacketFollows, handleKexExtension, handleKexInit, handleKexMessage, handleMessage, handleNewCompression, handleNewKeys, handleServiceAccept, handleServiceRequest, initializeCurrentService, initializeKeyExchangeMessageHandler, isRekeyBlocksCountExceeded, isRekeyDataSizeExceeded, isRekeyPacketCountsExceeded, isRekeyRequired, isRekeyTimeIntervalExceeded, messageReceived, negotiate, notImplemented, performKexNegotiation, preClose, prepareBuffer, prepareNewKeys, preProcessEncodeBuffer, receiveKexInit, receiveKexInit, reExchangeKeys, refreshConfiguration, removeChannelListener, removePortForwardingEventListener, removeSessionListener, removeValue, request, request, requestFailure, requestNewKeysExchange, requestSuccess, resolveIgnoreBufferDataLength, resolveOutputPacket, resolveSessionKexProposal, sendKexInit, sendNewKeys, setClientKexData, setInputEncoding, setNegotiationResult, setOutputEncoding, setServerKexData, validateIncomingMac, validateKexState, validateServiceKexState, validateTargetBuffer, writePacket, 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
-
-
-
-
Field Detail
-
proxyAcceptor
private ServerProxyAcceptor proxyAcceptor
-
clientAddress
private java.net.SocketAddress clientAddress
-
passwordAuthenticator
private PasswordAuthenticator passwordAuthenticator
-
publickeyAuthenticator
private PublickeyAuthenticator publickeyAuthenticator
-
interactiveAuthenticator
private KeyboardInteractiveAuthenticator interactiveAuthenticator
-
gssAuthenticator
private GSSAuthenticator gssAuthenticator
-
hostBasedAuthenticator
private HostBasedAuthenticator hostBasedAuthenticator
-
userAuthFactories
private java.util.List<UserAuthFactory> userAuthFactories
-
keyPairProvider
private KeyPairProvider keyPairProvider
-
hostKeyCertificateProvider
private HostKeyCertificateProvider hostKeyCertificateProvider
-
-
Constructor Detail
-
AbstractServerSession
protected AbstractServerSession(ServerFactoryManager factoryManager, IoSession ioSession)
-
-
Method Detail
-
getFactoryManager
public ServerFactoryManager getFactoryManager()
- Specified by:
getFactoryManager
in interfaceFactoryManagerHolder
- Specified by:
getFactoryManager
in interfaceServerSession
- Overrides:
getFactoryManager
in classSessionHelper
- Returns:
- The currently associated
FactoryManager
-
getServerProxyAcceptor
public ServerProxyAcceptor getServerProxyAcceptor()
- Specified by:
getServerProxyAcceptor
in interfaceServerProxyAcceptorHolder
-
setServerProxyAcceptor
public void setServerProxyAcceptor(ServerProxyAcceptor proxyAcceptor)
- Specified by:
setServerProxyAcceptor
in interfaceServerProxyAcceptorHolder
-
getClientAddress
public java.net.SocketAddress getClientAddress()
- Specified by:
getClientAddress
in interfaceServerSession
- Returns:
- The
SocketAddress
of 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(java.net.SocketAddress clientAddress)
-
getPasswordAuthenticator
public PasswordAuthenticator getPasswordAuthenticator()
Description copied from interface:ServerAuthenticationManager
Retrieve thePasswordAuthenticator
to 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:
getPasswordAuthenticator
in interfaceServerAuthenticationManager
- Returns:
- the
PasswordAuthenticator
ornull
-
setPasswordAuthenticator
public void setPasswordAuthenticator(PasswordAuthenticator passwordAuthenticator)
- Specified by:
setPasswordAuthenticator
in interfaceServerAuthenticationManager
-
getPublickeyAuthenticator
public PublickeyAuthenticator getPublickeyAuthenticator()
Description copied from interface:ServerAuthenticationManager
Retrieve thePublickeyAuthenticator
to 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:
getPublickeyAuthenticator
in interfaceServerAuthenticationManager
- Returns:
- the
PublickeyAuthenticator
ornull
-
setPublickeyAuthenticator
public void setPublickeyAuthenticator(PublickeyAuthenticator publickeyAuthenticator)
- Specified by:
setPublickeyAuthenticator
in interfaceServerAuthenticationManager
-
getKeyboardInteractiveAuthenticator
public KeyboardInteractiveAuthenticator getKeyboardInteractiveAuthenticator()
Description copied from interface:ServerAuthenticationManager
Retrieve theKeyboardInteractiveAuthenticator
to 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:
getKeyboardInteractiveAuthenticator
in interfaceServerAuthenticationManager
- Returns:
- The
KeyboardInteractiveAuthenticator
ornull
-
setKeyboardInteractiveAuthenticator
public void setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator interactiveAuthenticator)
- Specified by:
setKeyboardInteractiveAuthenticator
in interfaceServerAuthenticationManager
-
getGSSAuthenticator
public GSSAuthenticator getGSSAuthenticator()
Description copied from interface:ServerAuthenticationManager
Retrieve theGSSAuthenticator
to 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:
getGSSAuthenticator
in interfaceServerAuthenticationManager
- Returns:
- the
GSSAuthenticator
ornull
-
setGSSAuthenticator
public void setGSSAuthenticator(GSSAuthenticator gssAuthenticator)
- Specified by:
setGSSAuthenticator
in interfaceServerAuthenticationManager
-
getHostBasedAuthenticator
public HostBasedAuthenticator getHostBasedAuthenticator()
Description copied from interface:ServerAuthenticationManager
Retrieve theHostBasedAuthenticator
to 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:
getHostBasedAuthenticator
in interfaceServerAuthenticationManager
- Returns:
- the
HostBasedAuthenticator
ornull
-
setHostBasedAuthenticator
public void setHostBasedAuthenticator(HostBasedAuthenticator hostBasedAuthenticator)
- Specified by:
setHostBasedAuthenticator
in interfaceServerAuthenticationManager
-
getUserAuthFactories
public java.util.List<UserAuthFactory> getUserAuthFactories()
Description copied from interface:UserAuthFactoriesManager
Retrieve the list of named factories forUserAuth
objects.- Specified by:
getUserAuthFactories
in interfaceUserAuthFactoriesManager<ServerSession,UserAuth,UserAuthFactory>
- Returns:
- a list of named
UserAuth
factories, nevernull
/empty
-
setUserAuthFactories
public void setUserAuthFactories(java.util.List<UserAuthFactory> userAuthFactories)
- Specified by:
setUserAuthFactories
in interfaceUserAuthFactoriesManager<ServerSession,UserAuth,UserAuthFactory>
-
getKeyPairProvider
public KeyPairProvider getKeyPairProvider()
Description copied from interface:KeyPairProviderHolder
Retrieve theKeyPairProvider
that will be used to find the host key to use on the server side or the user key on the client side.- Specified by:
getKeyPairProvider
in interfaceKeyPairProviderHolder
- Returns:
- the
KeyPairProvider
, nevernull
-
getHostKeyCertificateProvider
public HostKeyCertificateProvider getHostKeyCertificateProvider()
- Specified by:
getHostKeyCertificateProvider
in interfaceServerAuthenticationManager
- Returns:
- a
HostKeyCertificateProvider
if available, null as default
-
setHostKeyCertificateProvider
public void setHostKeyCertificateProvider(HostKeyCertificateProvider hostKeyCertificateProvider)
- Specified by:
setHostKeyCertificateProvider
in interfaceServerAuthenticationManager
-
setKeyPairProvider
public void setKeyPairProvider(KeyPairProvider keyPairProvider)
- Specified by:
setKeyPairProvider
in interfaceKeyPairProviderHolder
-
sendServerIdentification
protected IoWriteFuture sendServerIdentification(java.util.List<java.lang.String> headerLines) throws java.lang.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
IoWriteFuture
that can be used to be notified of identification data being written successfully or failing - Throws:
java.lang.Exception
- If failed to send identification- See Also:
- RFC 4253 - section 4.2
-
checkKeys
protected void checkKeys()
Description copied from class:AbstractSession
Indicates 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:
checkKeys
in classAbstractSession
-
handleServiceRequest
protected boolean handleServiceRequest(java.lang.String serviceName, Buffer buffer) throws java.lang.Exception
- Overrides:
handleServiceRequest
in classAbstractSession
- Throws:
java.lang.Exception
-
startService
public void startService(java.lang.String name, Buffer buffer) throws java.lang.Exception
- Specified by:
startService
in interfaceSession
- Parameters:
name
- Service namebuffer
- Extra information provided when the service start request was received- Throws:
java.lang.Exception
- If failed to start it
-
signalAuthenticationSuccess
public IoWriteFuture signalAuthenticationSuccess(java.lang.String username, java.lang.String authService, Buffer buffer) throws java.lang.Exception
Description copied from interface:ServerSession
- Marks the session as authenticated.
- Starts the specified service.
- Sends the
SSH_MSG_USERAUTH_SUCCESS
message.
- Specified by:
signalAuthenticationSuccess
in interfaceServerSession
- Parameters:
username
- The authenticated usernameauthService
- The service to startbuffer
- Any extra data received to use to start the service- Returns:
- An
IoWriteFuture
that can be used to wait for theSSH_MSG_USERAUTH_SUCCESS
message send result - Throws:
java.lang.Exception
- if cannot handle the request
-
handleServiceAccept
protected void handleServiceAccept(java.lang.String serviceName, Buffer buffer) throws java.lang.Exception
- Overrides:
handleServiceAccept
in classAbstractSession
- Throws:
java.lang.Exception
-
sendKexInit
protected byte[] sendKexInit(java.util.Map<KexProposalOption,java.lang.String> proposal) throws java.lang.Exception
Description copied from class:AbstractSession
Send the key exchange initialization packet. This packet contains random data along with our proposal.- Overrides:
sendKexInit
in 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:
java.lang.Exception
- if an error occurred sending the packet
-
setKexSeed
protected void setKexSeed(byte... seed)
- Specified by:
setKexSeed
in classAbstractSession
- Parameters:
seed
- The result of the KEXINIT handshake - required for correct session key establishment
-
resolveAvailableSignaturesProposal
protected java.lang.String resolveAvailableSignaturesProposal(FactoryManager proposedManager) throws java.io.IOException, java.security.GeneralSecurityException
Description copied from class:SessionHelper
Computes the list of available host key signature algorithms supported.- Specified by:
resolveAvailableSignaturesProposal
in 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:
java.io.IOException
- If failed to read/parse the keys datajava.security.GeneralSecurityException
- If failed to generate the keys
-
resolveEmptySignaturesProposal
protected java.lang.String resolveEmptySignaturesProposal(java.lang.Iterable<java.lang.String> supported, java.lang.Iterable<java.lang.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 -
null
by default
-
readIdentification
protected boolean readIdentification(Buffer buffer) throws java.lang.Exception
Description copied from class:AbstractSession
Read 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:
readIdentification
in classAbstractSession
- Parameters:
buffer
- TheBuffer
containing the remote identification- Returns:
true
if the identification has been fully read orfalse
if more data is needed- Throws:
java.lang.Exception
- if an error occurs such as a bad protocol version or unsuccessful KEX was involved
-
receiveKexInit
protected void receiveKexInit(java.util.Map<KexProposalOption,java.lang.String> proposal, byte[] seed) throws java.io.IOException
- Specified by:
receiveKexInit
in classAbstractSession
- Throws:
java.io.IOException
-
getHostKey
public java.security.KeyPair getHostKey()
- Specified by:
getHostKey
in interfaceServerSession
- Returns:
- The
KeyPair
representing the current session's used keys on KEX -null
if not negotiated yet
-
getActiveSessionCountForUser
public int getActiveSessionCountForUser(java.lang.String userName)
Description copied from interface:ServerSession
Retrieve the current number of sessions active for a given username.- Specified by:
getActiveSessionCountForUser
in interfaceServerSession
- Parameters:
userName
- The name of the user - ignored ifnull
/empty- Returns:
- The current number of live
SshSession
objects associated with the user
-
getId
public long getId()
- Returns:
- The underlying
IoSession
id.
-
getConnectionService
protected ConnectionService getConnectionService()
- Specified by:
getConnectionService
in classSessionHelper
-
-