Interface PasswordChange

All Superinterfaces:
Operation

public interface PasswordChange extends Operation
The object that can be used to change the password.

Example:

 private void changePassword(Operations operations, String username) {
     operations.passwordChange()
         .username(username)
         .passwordChanger((context, handler) -> {
             if (context.lastRecoverableError().isPresent()) {
                 // Display error.
             }
             char[] oldPassword = askUserForOldPassword();
             char[] newPassword = askUserForNewPassword();
             if (oldPassword != null && newPassword != null) {
                 handler.passwords(oldPassword, newPassword);
             } else {
                 handler.cancel();
             }
         })
         .onError(passwordError -> {
             // handle error
         })
         .onSuccess(() -> {
             // handle success
         })
         .execute();
 }
 
  • Method Details

    • username

      PasswordChange username(String username)
      The username whose password must be changed.

      Providing the username is required.

      Parameters:
      username - the username
      Returns:
      a PasswordChange
    • passwordChanger

      PasswordChange passwordChanger(PasswordChanger passwordChanger)
      Specifies the object that will be informed of the potential recoverable errors and is responsible for obtaining the password from the end-user.

      Providing the password changer is required.

      Parameters:
      passwordChanger - the PasswordChanger.
      Returns:
      a PasswordChange
    • onError

      PasswordChange onError(Consumer<PasswordChangeError> errorConsumer)
      The method invoked when the password could not be changed: the password was not enrolled, the password is locked or the operation was canceled.

      The specified object will receive a PasswordChangeError. This object will be invoked in the main/UI thread.

      Providing the object handling the error is required.

      Parameters:
      errorConsumer - the consumer of an PasswordChangeError
      Returns:
      a PasswordChange
    • onSuccess

      PasswordChange onSuccess(Runnable onSuccess)
      Specifies the object that will be invoked if the password was successfully modified. This object will be invoked in the main/UI thread.

      Providing the object handling the success is required.

      Parameters:
      onSuccess - the object invoked on successful password modification
      Returns:
      a PasswordChange