Interface PasswordAuthenticator

All Known Implementing Classes:
AcceptAllPasswordAuthenticator, JaasPasswordAuthenticator, RejectAllPasswordAuthenticator, StaticPasswordAuthenticator
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PasswordAuthenticator
Used to authenticate users based on a password.
Author:
Apache MINA SSHD Project
  • Method Details

    • authenticate

      boolean authenticate(String username, String password, ServerSession session) throws PasswordChangeRequiredException, AsyncAuthException
      Check the validity of a password.
      Parameters:
      username - The username credential
      password - The provided password
      session - The ServerSession attempting the authentication
      Returns:
      true indicating if authentication succeeded
      Throws:
      PasswordChangeRequiredException - If the password is expired or not strong enough to suit the server's policy
      AsyncAuthException - If the authentication is performed asynchronously
    • handleClientPasswordChangeRequest

      default boolean handleClientPasswordChangeRequest(ServerSession session, String username, String oldPassword, String newPassword)
      Invoked when the client sends a SSH_MSG_USERAUTH_REQUEST indicating a password change. This can happen if the authenticate method threw PasswordChangeRequiredException thus telling the client that it needs to provide a new password. Throws UnsupportedOperationException by default.
      Parameters:
      session - The ServerSession attempting the authentication
      username - The username credential
      oldPassword - The old password
      newPassword - The new password
      Returns:
      true if password change accepted