Class PasswordCallback

    • Constructor Detail

      • PasswordCallback

        public PasswordCallback​(String prompt,
                                boolean echoOn)
        Creates a new PasswordCallback instance.
        Parameters:
        prompt - the message that should be displayed to the user
        echoOn - determines whether the user input should be echoed
    • Method Detail

      • getPrompt

        public String getPrompt()
        Returns the prompt that was specified when creating this PasswordCallback
        Returns:
        the prompt
      • isEchoOn

        public boolean isEchoOn()
        Queries whether this PasswordCallback expects user input to be echoed, which is specified during the creation of the object.
        Returns:
        true if (and only if) user input should be echoed
      • setPassword

        public void setPassword​(char[] password)
        Sets the password. The CallbackHandler that performs the actual provisioning or input of the password needs to call this method to hand back the password to the security service that requested it.
        Parameters:
        password - the password. A copy of this is stored, so subsequent changes to the input array do not affect the PasswordCallback.
      • getPassword

        public char[] getPassword()
        Returns the password. The security service that needs the password usually calls this method once the CallbackHandler has finished its work.
        Returns:
        the password. A copy of the internal password is created and returned, so subsequent changes to the internal password do not affect the result.
      • clearPassword

        public void clearPassword()
        Clears the password stored in this PasswordCallback.