Class PasswordValidationCallback
java.lang.Object
jakarta.security.auth.message.callback.PasswordValidationCallback
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionPasswordValidationCallback(Subject subject, String username, char[] password) Creates a newPasswordValidationCallbackwith the specified subject, username, and password. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the password from memory for security purposes.char[]Returns the password to be validated.booleanReturns the result of the password validation.Returns theSubjectassociated with this callback.Returns the username to be validated.voidsetResult(boolean result) Sets the result of the password validation performed by the runtime.
-
Constructor Details
-
PasswordValidationCallback
Creates a newPasswordValidationCallbackwith the specified subject, username, and password.- Parameters:
subject- theSubjectto be populated upon successful authenticationusername- the username to validatepassword- the password to validate
-
-
Method Details
-
getSubject
Returns theSubjectassociated with this callback. The runtime populates this subject with authentication information upon successful validation.- Returns:
- the
Subjectfor this callback
-
getUsername
-
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-trueif the password validation succeeded,falseotherwise
-
getResult
public boolean getResult()Returns the result of the password validation.- Returns:
trueif the password was validated successfully,falseotherwise
-