Class PasswordValidationCallback

java.lang.Object
jakarta.security.auth.message.callback.PasswordValidationCallback
All Implemented Interfaces:
Callback

public class PasswordValidationCallback extends Object implements Callback
A callback that enables an authentication module to supply a username and password to the runtime and obtain the result of password validation. The runtime validates the credentials and updates the Subject if authentication succeeds.
  • Constructor Details

    • PasswordValidationCallback

      public PasswordValidationCallback(Subject subject, String username, char[] password)
      Creates a new PasswordValidationCallback with the specified subject, username, and password.
      Parameters:
      subject - the Subject to be populated upon successful authentication
      username - the username to validate
      password - the password to validate
  • Method Details

    • getSubject

      public Subject getSubject()
      Returns the Subject associated with this callback. The runtime populates this subject with authentication information upon successful validation.
      Returns:
      the Subject for this callback
    • getUsername

      public String getUsername()
      Returns the username to be validated.
      Returns:
      the username
    • getPassword

      public char[] getPassword()
      Returns the password to be validated.
      Returns:
      the password character array
    • clearPassword

      public void clearPassword()
      Clears the password from memory for security purposes. After calling this method, getPassword() will return an empty character array.
    • setResult

      public void setResult(boolean result)
      Sets the result of the password validation performed by the runtime.
      Parameters:
      result - true if the password validation succeeded, false otherwise
    • getResult

      public boolean getResult()
      Returns the result of the password validation.
      Returns:
      true if the password was validated successfully, false otherwise