public interface SessionDisconnectHandler
Modifier and Type | Method and Description |
---|---|
default boolean |
handleAuthCountDisconnectReason(Session session,
Service service,
java.lang.String serviceName,
java.lang.String method,
java.lang.String user,
int currentAuthCount,
int maxAuthCount)
Invoked if the number of authentication attempts exceeded the maximum allowed
|
default boolean |
handleAuthParamsDisconnectReason(Session session,
Service service,
java.lang.String authUser,
java.lang.String username,
java.lang.String authService,
java.lang.String serviceName)
Invoked if the authentication parameters changed in mid-authentication process.
|
default boolean |
handleKexDisconnectReason(Session session,
java.util.Map<KexProposalOption,java.lang.String> c2sOptions,
java.util.Map<KexProposalOption,java.lang.String> s2cOptions,
java.util.Map<KexProposalOption,java.lang.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,
java.lang.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,
java.lang.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 java.io.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 timeoutjava.io.IOException
- If failed to handle the eventdefault boolean handleSessionsCountDisconnectReason(Session session, Service service, java.lang.String username, int currentSessionCount, int maxSessionCount) throws java.io.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 disconnectedjava.io.IOException
- 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, java.lang.String serviceName, Buffer buffer) throws java.io.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)java.io.IOException
- If failed to handle the requestdefault boolean handleAuthCountDisconnectReason(Session session, Service service, java.lang.String serviceName, java.lang.String method, java.lang.String user, int currentAuthCount, int maxAuthCount) throws java.io.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.java.io.IOException
- If failed to handle the eventdefault boolean handleAuthParamsDisconnectReason(Session session, Service service, java.lang.String authUser, java.lang.String username, java.lang.String authService, java.lang.String serviceName) throws java.io.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 changejava.io.IOException
- If failed to handle the eventdefault boolean handleKexDisconnectReason(Session session, java.util.Map<KexProposalOption,java.lang.String> c2sOptions, java.util.Map<KexProposalOption,java.lang.String> s2cOptions, java.util.Map<KexProposalOption,java.lang.String> negotiatedGuess, KexProposalOption option) throws java.io.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 disconnectjava.io.IOException
- if attempted to exchange some packets to fix the situation