Package com.sshtools.server
Class AuthenticationProtocolServer
java.lang.Object
com.sshtools.common.ssh.ExecutorOperationSupport<com.sshtools.synergy.ssh.SshContext>
com.sshtools.server.AuthenticationProtocolServer
- All Implemented Interfaces:
com.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
,com.sshtools.synergy.ssh.Service
public class AuthenticationProtocolServer
extends com.sshtools.common.ssh.ExecutorOperationSupport<com.sshtools.synergy.ssh.SshContext>
implements com.sshtools.synergy.ssh.Service, com.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
This class implements the SSH Authentication Protocol. The only required
interaction with this class would be if you were creating an
AuthenticationMechanism
. In this scenario you would simply call
either completedAuthentication()
or failedAuthentication()
to
inform the protocol that your authentication either completed or failed.-
Field Summary
Fields inherited from class com.sshtools.common.ssh.ExecutorOperationSupport
CALLBACKS, EVENTS, MESSAGES_INCOMING, MESSAGES_OUTGOING
Fields inherited from interface com.sshtools.common.auth.AbstractAuthenticationProtocol
SSH_MSG_USERAUTH_BANNER, SSH_MSG_USERAUTH_FAILURE, SSH_MSG_USERAUTH_REQUEST, SSH_MSG_USERAUTH_SUCCESS
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct the protocol using the given transport -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
Each successful completion of an authentication method should call this method.void
Inform the protocol that the current authentication should be discarded.void
A failed authentication attempt should call this method.void
failedAuthentication
(boolean partial, boolean ignoreFailed) int
getName()
getParameter
(String name) boolean
idle()
void
boolean
processMessage
(byte[] msg) Process an SSH message.void
setParameter
(String name, Object value) void
start()
Called by theTransportProtocol
when the service starts.void
stop()
Called by theTransportProtocol
when the service stops.Methods inherited from class com.sshtools.common.ssh.ExecutorOperationSupport
addIncomingTask, addOutgoingTask, addTask, cleanupOperations
-
Constructor Details
-
AuthenticationProtocolServer
Construct the protocol using the given transport- Parameters:
transport
-- Throws:
IOException
-
-
Method Details
-
getContext
- Specified by:
getContext
in classcom.sshtools.common.ssh.ExecutorOperationSupport<com.sshtools.synergy.ssh.SshContext>
-
stop
public void stop()Called by theTransportProtocol
when the service stops.- Specified by:
stop
in interfacecom.sshtools.synergy.ssh.Service
-
start
public void start()Called by theTransportProtocol
when the service starts. Here we check for an authentication banner and send if configured.- Specified by:
start
in interfacecom.sshtools.synergy.ssh.Service
-
processMessage
Process an SSH message.- Specified by:
processMessage
in interfacecom.sshtools.synergy.ssh.Service
- Parameters:
msg
- the message to process- Returns:
- true if the message was processed, otherwise false
- Throws:
IOException
-
getParameter
-
setParameter
-
completedAuthentication
public void completedAuthentication()Each successful completion of an authentication method should call this method. The state of the authentication is then determined and if completed the SSH_MSG_USERAUTH_SUCCESS message is sent, if a further authentication is required, SSH_MSG_USERAUTH_FAILURE is sent with the partial value set to true.- Specified by:
completedAuthentication
in interfacecom.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
- Throws:
IOException
-
discardAuthentication
public void discardAuthentication()Inform the protocol that the current authentication should be discarded. This will result in no failure message being sent to the client.- Specified by:
discardAuthentication
in interfacecom.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
-
failedAuthentication
public void failedAuthentication()A failed authentication attempt should call this method.- Specified by:
failedAuthentication
in interfacecom.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
- Throws:
IOException
-
failedAuthentication
public void failedAuthentication(boolean partial, boolean ignoreFailed) - Specified by:
failedAuthentication
in interfacecom.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
-
getIdleTimeoutSeconds
public int getIdleTimeoutSeconds()- Specified by:
getIdleTimeoutSeconds
in interfacecom.sshtools.synergy.ssh.Service
-
idle
public boolean idle()- Specified by:
idle
in interfacecom.sshtools.synergy.ssh.Service
-
getName
- Specified by:
getName
in interfacecom.sshtools.synergy.ssh.Service
-
canContinue
public boolean canContinue()- Specified by:
canContinue
in interfacecom.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
-
markFailed
public void markFailed()- Specified by:
markFailed
in interfacecom.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
-
getIdleLog
- Specified by:
getIdleLog
in interfacecom.sshtools.synergy.ssh.Service
-