public interface SessionDisconnectHandler
Modifier and Type | Method and Description |
---|---|
default boolean |
handleAuthCountDisconnectReason(Session session,
Service service,
String serviceName,
String method,
String user,
int currentAuthCount,
int maxAuthCount)
Invoked if the number of authentication attempts exceeded the maximum allowed
|
default boolean |
handleAuthParamsDisconnectReason(Session session,
Service service,
String authUser,
String username,
String authService,
String serviceName)
Invoked if the authentication parameters changed in mid-authentication process.
|
default boolean |
handleKexDisconnectReason(Session session,
Map<KexProposalOption,String> c2sOptions,
Map<KexProposalOption,String> s2cOptions,
Map<KexProposalOption,String> negotiatedGuess,
KexProposalOption option)
Invoked if after KEX negotiation parameters resolved one of the options violates some internal constraint (e.g.,
cannot negotiate a value, or RFC 8308 - section
2.2).
|
default boolean |
handleSessionsCountDisconnectReason(Session session,
Service service,
String username,
int currentSessionCount,
int maxSessionCount)
Called to inform that the maximum allowed concurrent sessions threshold has been exceeded.
|
default boolean |
handleTimeoutDisconnectReason(Session session,
TimeoutIndicator timeoutStatus)
Invoked when an internal timeout has expired (e.g., authentication, idle).
|
default boolean |
handleUnsupportedServiceDisconnectReason(Session session,
int cmd,
String serviceName,
Buffer buffer)
Invoked when a request has been made related to an unknown SSH service as described in
RFC 4253 - section 10.
|
default boolean handleTimeoutDisconnectReason(Session session, TimeoutIndicator timeoutStatus) throws IOException
session
- The session whose timeout has expiredtimeoutStatus
- The expired timeouttrue
if expired timeout should be reset (i.e., no disconnect). If false
then session will disconnect due to the expired timeoutIOException
- If failed to handle the eventdefault boolean handleSessionsCountDisconnectReason(Session session, Service service, String username, int currentSessionCount, int maxSessionCount) throws IOException
session
- The session that caused the excessservice
- The Service
instance through which the request was receivedusername
- The authenticated username that is associated with the session.currentSessionCount
- The current sessions countmaxSessionCount
- The maximum allowed sessions counttrue
if accept the exceeding session regardless of the threshold. If
false
then exceeding session will be disconnectedIOException
- If failed to handle the event, Note: choosing to ignore this disconnect reason
does not reset the current concurrent sessions counter in any way - i.e., the handler
will be re-invoked every time the threshold is exceeded.CoreModuleProperties.MAX_CONCURRENT_SESSIONS
default boolean handleUnsupportedServiceDisconnectReason(Session session, int cmd, String serviceName, Buffer buffer) throws IOException
session
- The session through which the command was receivedcmd
- The service related commandserviceName
- The service namebuffer
- Any extra data received in the packet containing the requesttrue
if disregard the request (e.g., the handler handled it)IOException
- If failed to handle the requestdefault boolean handleAuthCountDisconnectReason(Session session, Service service, String serviceName, String method, String user, int currentAuthCount, int maxAuthCount) throws IOException
session
- The session being authenticatedservice
- The Service
instance through which the request was receivedserviceName
- The authentication service namemethod
- The authentication method nameuser
- The authentication usernamecurrentAuthCount
- The authentication attempt countmaxAuthCount
- The maximum allowed attemptstrue
if OK to ignore the exceeded attempt count and allow more attempts.
Note: choosing to ignore this disconnect reason does not reset the current count
- i.e., it will be re-invoked on the next attempt.IOException
- If failed to handle the eventdefault boolean handleAuthParamsDisconnectReason(Session session, Service service, String authUser, String username, String authService, String serviceName) throws IOException
session
- The session being authenticatedservice
- The Service
instance through which the request was receivedauthUser
- The original username being authenticatedusername
- The requested usernameauthService
- The original authentication service nameserviceName
- The requested service nametrue
if OK to ignore the changeIOException
- If failed to handle the eventdefault boolean handleKexDisconnectReason(Session session, Map<KexProposalOption,String> c2sOptions, Map<KexProposalOption,String> s2cOptions, Map<KexProposalOption,String> negotiatedGuess, KexProposalOption option) throws IOException
session
- The session where the violation occurredc2sOptions
- The client optionss2cOptions
- The server optionsnegotiatedGuess
- The negotiated KEX optionsoption
- The violating KexProposalOption
true
if disregard the violation - if false
then session will disconnectIOException
- if attempted to exchange some packets to fix the situationCopyright © 2008–2024 The Apache Software Foundation. All rights reserved.