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.
  • Constructor Details

    • AuthenticationProtocolServer

      public AuthenticationProtocolServer(TransportProtocolServer transport)
      Construct the protocol using the given transport
      Parameters:
      transport -
      Throws:
      IOException
  • Method Details

    • getContext

      public SshServerContext getContext()
      Specified by:
      getContext in class com.sshtools.common.ssh.ExecutorOperationSupport<com.sshtools.synergy.ssh.SshContext>
    • stop

      public void stop()
      Called by the TransportProtocol when the service stops.
      Specified by:
      stop in interface com.sshtools.synergy.ssh.Service
    • start

      public void start()
      Called by the TransportProtocol when the service starts. Here we check for an authentication banner and send if configured.
      Specified by:
      start in interface com.sshtools.synergy.ssh.Service
    • processMessage

      public boolean processMessage(byte[] msg) throws IOException
      Process an SSH message.
      Specified by:
      processMessage in interface com.sshtools.synergy.ssh.Service
      Parameters:
      msg - the message to process
      Returns:
      true if the message was processed, otherwise false
      Throws:
      IOException
    • getParameter

      public Object getParameter(String name)
    • setParameter

      public void setParameter(String name, Object value)
    • 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 interface com.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 interface com.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
    • failedAuthentication

      public void failedAuthentication()
      A failed authentication attempt should call this method.
      Specified by:
      failedAuthentication in interface com.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
      Throws:
      IOException
    • failedAuthentication

      public void failedAuthentication(boolean partial, boolean ignoreFailed)
      Specified by:
      failedAuthentication in interface com.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
    • getIdleTimeoutSeconds

      public int getIdleTimeoutSeconds()
      Specified by:
      getIdleTimeoutSeconds in interface com.sshtools.synergy.ssh.Service
    • idle

      public boolean idle()
      Specified by:
      idle in interface com.sshtools.synergy.ssh.Service
    • getName

      public String getName()
      Specified by:
      getName in interface com.sshtools.synergy.ssh.Service
    • canContinue

      public boolean canContinue()
      Specified by:
      canContinue in interface com.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
    • markFailed

      public void markFailed()
      Specified by:
      markFailed in interface com.sshtools.common.auth.AbstractAuthenticationProtocol<SshServerContext>
    • getIdleLog

      public String getIdleLog()
      Specified by:
      getIdleLog in interface com.sshtools.synergy.ssh.Service