Class UserAuthPassword

All Implemented Interfaces:
UserAuth, ClientSessionHolder, UserAuthInstance<ClientSession>, NamedResource

public class UserAuthPassword extends AbstractUserAuth
Implements the client-side "password" authentication mechanism
Author:
Apache MINA SSHD Project
  • Field Details

  • Constructor Details

    • UserAuthPassword

      public UserAuthPassword()
  • Method Details

    • init

      public void init(ClientSession session, String service) throws Exception
      Specified by:
      init in interface UserAuth
      Overrides:
      init in class AbstractUserAuth
      Parameters:
      session - The ClientSession
      service - The requesting service name
      Throws:
      Exception - If failed to initialize the mechanism
    • sendAuthDataRequest

      protected boolean sendAuthDataRequest(ClientSession session, String service) throws Exception
      Specified by:
      sendAuthDataRequest in class AbstractUserAuth
      Throws:
      Exception
    • resolveAttemptedPassword

      protected String resolveAttemptedPassword(ClientSession session, String service) throws Exception
      Throws:
      Exception
    • processAuthDataRequest

      protected boolean processAuthDataRequest(ClientSession session, String service, Buffer buffer) throws Exception
      Specified by:
      processAuthDataRequest in class AbstractUserAuth
      Throws:
      Exception
    • sendPassword

      protected IoWriteFuture sendPassword(Buffer buffer, ClientSession session, String oldPassword, String newPassword) throws Exception
      Sends the password via a SSH_MSG_USERAUTH_REQUEST message. If old and new password are not the same then it requests a password modification from the server (which may be denied if the server does not support this feature).
      Parameters:
      buffer - The Buffer to re-use for sending the message
      session - The target ClientSession
      oldPassword - The previous password
      newPassword - The new password
      Returns:
      An IoWriteFuture that can be used to wait and check on the success/failure of the request packet being sent
      Throws:
      Exception - If failed to send the message.
    • signalAuthMethodSuccess

      public void signalAuthMethodSuccess(ClientSession session, String service, Buffer buffer) throws Exception
      Description copied from interface: UserAuth
      Signal reception of SSH_MSG_USERAUTH_SUCCESS message
      Parameters:
      session - The ClientSession
      service - The requesting service name
      buffer - The Buffer containing the success message (after having consumed the relevant data from it)
      Throws:
      Exception - If failed to handle the callback - Note: may cause session close
    • signalAuthMethodFailure

      public void signalAuthMethodFailure(ClientSession session, String service, boolean partial, List<String> serverMethods, Buffer buffer) throws Exception
      Description copied from interface: UserAuth
      Signals reception of SSH_MSG_USERAUTH_FAILURE message
      Parameters:
      session - The ClientSession
      service - The requesting service name
      partial - true if some partial authentication success so far
      serverMethods - The List of authentication methods that can continue
      buffer - The Buffer containing the failure message (after having consumed the relevant data from it)
      Throws:
      Exception - If failed to handle the callback - Note: may cause session close