public abstract class AbstractServerSession extends AbstractSession implements ServerSession
ServerSession related methodsAbstractCloseable.StateSession.TimeoutStatusAttributeStore.AttributeKey<T>authed, authTimeoutStart, channelListenerProxy, channelListeners, clientProposal, clientVersion, currentService, decodeLock, decoderBuffer, decoderLength, decoderState, encodeLock, firstKexPacketFollows, i_c, i_s, idleTimeoutStart, ignorePacketDataLength, ignorePacketsCount, ignorePacketsFrequency, ignorePacketsVariance, inBlocksCount, inBytesCount, inCipher, inCipherSize, inCompression, inMac, inMacResult, inPacketsCount, ioSession, isServer, kex, kexFutureHolder, kexState, lastKeyTimeValue, maxRekeyBlocks, maxRekeyBytes, maxRekeyInterval, maxRekyPackets, negotiationResult, outBlocksCount, outBytesCount, outCipher, outCipherSize, outCompression, outMac, outPacketsCount, pendingPackets, random, requestLock, seqi, seqo, serverProposal, serverVersion, SESSION, sessionId, sessionListenerProxy, sessionListeners, timeoutStatus, tunnelListenerProxy, tunnelListeners, uncompressBuffer, usernamecloseFuture, lock, statelogDEFAULT_SSH_VERSION_PREFIX, FALLBACK_SSH_VERSION_PREFIX, MAX_VERSION_LINE_LENGTHEMPTYCLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUTAUTH_METHODS, AUTO_WELCOME_BANNER_VALUE, DEFAULT_BANNER_PHASE, DEFAULT_MAX_AUTH_REQUESTS, DEFAULT_USER_AUTH_GSS_FACTORY, DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY, DEFAULT_USER_AUTH_PASSWORD_FACTORY, DEFAULT_USER_AUTH_PUBLIC_KEY_FACTORY, DEFAULT_WELCOME_BANNER_LANGUAGE, MAX_AUTH_REQUESTS, WELCOME_BANNER, WELCOME_BANNER_CHARSET, WELCOME_BANNER_LANGUAGE, WELCOME_BANNER_PHASE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractServerSession(ServerFactoryManager factoryManager,
IoSession ioSession) |
| Modifier and Type | Method and 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 key
|
int |
getActiveSessionCountForUser(String userName)
Retrieve the current number of sessions active for a given username.
|
SocketAddress |
getClientAddress() |
ServerFactoryManager |
getFactoryManager() |
GSSAuthenticator |
getGSSAuthenticator()
Retrieve the
GSSAuthenticator to be used by the SSH server. |
HostBasedAuthenticator |
getHostBasedAuthenticator()
Retrieve the
HostBasedAuthenticator to be used by the SSH server. |
KeyPair |
getHostKey() |
long |
getId()
Returns the session id.
|
KeyboardInteractiveAuthenticator |
getKeyboardInteractiveAuthenticator()
Retrieve the
KeyboardInteractiveAuthenticator to be used by
the SSH server. |
PasswordAuthenticator |
getPasswordAuthenticator()
Retrieve the
PasswordAuthenticator to be used by the SSH server. |
PublickeyAuthenticator |
getPublickeyAuthenticator()
Retrieve the
PublickeyAuthenticator to be used by SSH server. |
ServerProxyAcceptor |
getServerProxyAcceptor() |
List<NamedFactory<UserAuth>> |
getUserAuthFactories()
Retrieve the list of named factories for
UserAuth objects. |
protected void |
handleServiceAccept(String serviceName,
Buffer buffer) |
protected boolean |
handleServiceRequest(String serviceName,
Buffer buffer) |
protected boolean |
readIdentification(Buffer buffer)
Read the other side identification.
|
protected void |
receiveKexInit(Map<KexProposalOption,String> proposal,
byte[] seed) |
protected String |
resolveAvailableSignaturesProposal(FactoryManager proposedManager) |
protected String |
resolveEmptySignaturesProposal(Iterable<String> supported,
Iterable<String> provided)
Called by
resolveAvailableSignaturesProposal(FactoryManager)
if none of the provided keys is supported - last chance for the derived
implementation to do something |
protected byte[] |
sendKexInit(Map<KexProposalOption,String> proposal)
Send the key exchange initialization packet.
|
protected IoWriteFuture |
sendServerIdentification(String... headerLines)
Sends the server identification + any extra header lines
|
void |
setClientAddress(SocketAddress clientAddress) |
void |
setGSSAuthenticator(GSSAuthenticator gssAuthenticator) |
void |
setHostBasedAuthenticator(HostBasedAuthenticator hostBasedAuthenticator) |
protected void |
setKexSeed(byte... seed) |
void |
setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator interactiveAuthenticator) |
void |
setPasswordAuthenticator(PasswordAuthenticator passwordAuthenticator) |
void |
setPublickeyAuthenticator(PublickeyAuthenticator publickeyAuthenticator) |
void |
setServerProxyAcceptor(ServerProxyAcceptor proxyAcceptor) |
void |
setUserAuthFactories(List<NamedFactory<UserAuth>> userAuthFactories) |
void |
startService(String name) |
addChannelListener, addPortForwardingEventListener, addSessionListener, attachSession, calculateNextIgnorePacketCount, checkAuthenticationTimeout, checkForTimeouts, checkIdleTimeout, checkRekey, comparePreferredKexProposalOption, createBuffer, createBuffer, createProposal, decode, disconnect, doHandleMessage, doReadIdentification, doWritePacket, encode, exceptionCaught, getAttribute, getAuthTimeout, getChannelListenerProxy, getCipherInformation, getClientVersion, getCompressionInformation, getIdleTimeout, getInnerCloseable, getIoSession, getKex, getLock, getMacInformation, getNegotiatedKexParameter, getParentPropertyResolver, getPortForwardingEventListenerProxy, getProperties, getReservedSessionMessagesHandler, getServerVersion, getService, getServices, getSession, getSession, getSessionId, getSessionListenerProxy, getTimeoutStatus, getUsername, handleDebug, handleDisconnect, handleDisconnect, handleFirstKexPacketFollows, handleIgnore, handleKexInit, handleKexMessage, handleMessage, handleNewKeys, handleServiceAccept, handleServiceRequest, handleUnimplemented, invokeSessionSignaller, isAuthenticated, isRekeyBlocksCountExceeded, isRekeyDataSizeExceeded, isRekeyPacketCountsExceeded, isRekeyRequired, isRekeyTimeIntervalExceeded, mergeProposals, messageReceived, negotiate, notImplemented, preClose, prepareBuffer, receiveKexInit, receiveKexInit, receiveNewKeys, reExchangeKeys, refreshConfiguration, removeAttribute, removeChannelListener, removePortForwardingEventListener, removeSessionListener, request, requestFailure, requestNewKeysExchange, requestSuccess, resetIdleTimeout, resizeKey, resolveAttribute, resolveAvailableSignaturesProposal, resolveIdentificationString, resolveIgnoreBufferDataLength, resolvePeerAddress, resolveReservedSessionMessagesHandler, sendDebugMessage, sendIdentification, sendIgnoreMessage, sendKexInit, sendNewKeys, sendNotImplemented, setAttribute, setAuthenticated, setNegotiationResult, setReservedSessionMessagesHandler, setUsername, signalExceptionCaught, signalExceptionCaught, signalNegotiationEnd, signalNegotiationEnd, signalNegotiationStart, signalNegotiationStart, signalSessionClosed, signalSessionClosed, signalSessionCreated, signalSessionCreated, signalSessionEvent, signalSessionEvent, toString, validateKexState, validateTargetBuffer, writePacket, writePacketgetCipherFactories, getCompressionFactories, getKeyExchangeFactories, getKeyPairProvider, getMacFactories, getSignatureFactories, resolveEffectiveFactories, resolveEffectiveProvider, setCipherFactories, setCompressionFactories, setKeyExchangeFactories, setKeyPairProvider, setMacFactories, setSignatureFactoriesdoCloseGracefully, doCloseImmediatelyaddCloseFutureListener, builder, close, isClosed, isClosing, removeCloseFutureListenergetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateBuffer, createBuffer, disconnect, exceptionCaught, getAuthTimeout, getCipherInformation, getClientVersion, getCompressionInformation, getIdleTimeout, getIoSession, getKex, getMacInformation, getNegotiatedKexParameter, getServerVersion, getService, getSessionId, getTimeoutStatus, isAuthenticated, isValidVersionPrefix, prepareBuffer, reExchangeKeys, request, resetIdleTimeout, sendDebugMessage, sendIgnoreMessage, setAuthenticated, writePacket, writePacketgetCipherFactories, getCipherFactoriesNameList, getCipherFactoriesNames, getCompressionFactories, getCompressionFactoriesNameList, getCompressionFactoriesNames, getKeyExchangeFactories, getMacFactories, getMacFactoriesNameList, getMacFactoriesNames, setCipherFactories, setCipherFactoriesNameList, setCipherFactoriesNames, setCipherFactoriesNames, setCompressionFactories, setCompressionFactoriesNameList, setCompressionFactoriesNames, setCompressionFactoriesNames, setKeyExchangeFactories, setMacFactories, setMacFactoriesNameList, setMacFactoriesNames, setMacFactoriesNamesgetKeyPairProvider, setKeyPairProvidergetSignatureFactories, getSignatureFactories, getSignatureFactoriesNameList, getSignatureFactoriesNames, resolveSignatureFactories, setSignatureFactories, setSignatureFactoriesNameList, setSignatureFactoriesNames, setSignatureFactoriesNamesaddSessionListener, getSessionListenerProxy, removeSessionListenergetReservedSessionMessagesHandler, setReservedSessionMessagesHandleraddChannelListener, getChannelListenerProxy, removeChannelListeneraddPortForwardingEventListener, getPortForwardingEventListenerProxy, removePortForwardingEventListenergetBoolean, getBooleanProperty, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringPropertygetAttribute, removeAttribute, resolveAttribute, resolveAttribute, resolveAttribute, resolveAttribute, setAttributeaddCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListenersetUsernamegetUsernamegetUserAuthFactoriesNameList, getUserAuthFactoriesNames, resolveUserAuthFactories, resolveUserAuthFactories, setUserAuthFactoriesNameList, setUserAuthFactoriesNames, setUserAuthFactoriesNamesprotected AbstractServerSession(ServerFactoryManager factoryManager, IoSession ioSession)
public ServerFactoryManager getFactoryManager()
getFactoryManager in interface FactoryManagerHoldergetFactoryManager in interface ServerSessiongetFactoryManager in class AbstractSessionFactoryManagerpublic ServerProxyAcceptor getServerProxyAcceptor()
getServerProxyAcceptor in interface ServerProxyAcceptorHolderpublic void setServerProxyAcceptor(ServerProxyAcceptor proxyAcceptor)
setServerProxyAcceptor in interface ServerProxyAcceptorHolderpublic SocketAddress getClientAddress()
getClientAddress in interface ServerSessionSocketAddress of the remote client. If no proxy wrapping
was used then this is the same as the IoSession#getRemoteAddress().
Otherwise, it indicates the real client's address that was somehow transmitted
via the proxy meta-datapublic void setClientAddress(SocketAddress clientAddress)
public PasswordAuthenticator getPasswordAuthenticator()
ServerAuthenticationManagerPasswordAuthenticator to be used by the SSH server.
If no authenticator has been configured (i.e. this method returns
null), then client authentication requests based on passwords
will be rejected.getPasswordAuthenticator in interface ServerAuthenticationManagerPasswordAuthenticator or nullpublic void setPasswordAuthenticator(PasswordAuthenticator passwordAuthenticator)
setPasswordAuthenticator in interface ServerAuthenticationManagerpublic PublickeyAuthenticator getPublickeyAuthenticator()
ServerAuthenticationManagerPublickeyAuthenticator to be used by SSH server.
If no authenticator has been configured (i.e. this method returns
null), then client authentication requests based on keys will be
rejected.getPublickeyAuthenticator in interface ServerAuthenticationManagerPublickeyAuthenticator or nullpublic void setPublickeyAuthenticator(PublickeyAuthenticator publickeyAuthenticator)
setPublickeyAuthenticator in interface ServerAuthenticationManagerpublic KeyboardInteractiveAuthenticator getKeyboardInteractiveAuthenticator()
ServerAuthenticationManagerKeyboardInteractiveAuthenticator to be used by
the SSH server. If no authenticator has been configured (i.e. this method returns
null), then client authentication requests based on this method
will be rejected.getKeyboardInteractiveAuthenticator in interface ServerAuthenticationManagerKeyboardInteractiveAuthenticator or nullpublic void setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator interactiveAuthenticator)
setKeyboardInteractiveAuthenticator in interface ServerAuthenticationManagerpublic GSSAuthenticator getGSSAuthenticator()
ServerAuthenticationManagerGSSAuthenticator to be used by the SSH server.
If no authenticator has been configured (i.e. this method returns
null), then client authentication requests based on gssapi
will be rejected.getGSSAuthenticator in interface ServerAuthenticationManagerGSSAuthenticator or nullpublic void setGSSAuthenticator(GSSAuthenticator gssAuthenticator)
setGSSAuthenticator in interface ServerAuthenticationManagerpublic HostBasedAuthenticator getHostBasedAuthenticator()
ServerAuthenticationManagerHostBasedAuthenticator to be used by the SSH server. If
no authenticator has been configured (i.e. this method returns null),
then client authentication requests based on this method will be rejected.getHostBasedAuthenticator in interface ServerAuthenticationManagerHostBasedAuthenticator or nullpublic void setHostBasedAuthenticator(HostBasedAuthenticator hostBasedAuthenticator)
setHostBasedAuthenticator in interface ServerAuthenticationManagerpublic List<NamedFactory<UserAuth>> getUserAuthFactories()
ServerAuthenticationManagerUserAuth objects.getUserAuthFactories in interface ServerAuthenticationManagerUserAuth factories, never null/emptypublic void setUserAuthFactories(List<NamedFactory<UserAuth>> userAuthFactories)
setUserAuthFactories in interface ServerAuthenticationManagerprotected IoWriteFuture sendServerIdentification(String... headerLines)
headerLines - Extra header lines to be prepended to the actual
identification string - ignored if null/emptyIoWriteFuture that can be used to be notified of
identification data being written successfully or failingprotected void checkKeys()
AbstractSessioncheckKeys in class AbstractSessionprotected boolean handleServiceRequest(String serviceName, Buffer buffer) throws Exception
handleServiceRequest in class AbstractSessionExceptionpublic void startService(String name) throws Exception
startService in interface Sessionname - Service nameException - If failed to start itprotected void handleServiceAccept(String serviceName, Buffer buffer) throws Exception
handleServiceAccept in class AbstractSessionExceptionprotected byte[] sendKexInit(Map<KexProposalOption,String> proposal) throws IOException
AbstractSessionsendKexInit in class AbstractSessionproposal - our proposal for key exchange negotiationIOException - if an error occurred sending the packetprotected void setKexSeed(byte... seed)
setKexSeed in class AbstractSessionseed - The result of the KEXINIT handshake - required for correct
session key establishmentprotected String resolveAvailableSignaturesProposal(FactoryManager proposedManager)
resolveAvailableSignaturesProposal in class AbstractSessionproposedManager - The FactoryManagernull/empty if no proposalprotected String resolveEmptySignaturesProposal(Iterable<String> supported, Iterable<String> provided)
resolveAvailableSignaturesProposal(FactoryManager)
if none of the provided keys is supported - last chance for the derived
implementation to do somethingsupported - The supported key types - may be null/emptyprovided - The available signature types - may be null/emptynull by defaultprotected boolean readIdentification(Buffer buffer) throws IOException
AbstractSessionAbstractSession.doReadIdentification(Buffer, boolean) and
store the result in the needed property.readIdentification in class AbstractSessionbuffer - The Buffer containing the remote identificationtrue if the identification has been fully read or
false if more data is neededIOException - if an error occurs such as a bad protocol versionprotected void receiveKexInit(Map<KexProposalOption,String> proposal, byte[] seed) throws IOException
receiveKexInit in class AbstractSessionIOExceptionpublic KeyPair getHostKey()
getHostKey in interface ServerSessionKeyPair representing the current session's used keys
on KEX - null if not negotiated yetpublic int getActiveSessionCountForUser(String userName)
ServerSessiongetActiveSessionCountForUser in interface ServerSessionuserName - The name of the user - ignored if null/emptySshSession objects associated with the userpublic long getId()
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.