All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.frameworkset.platform.security.authentication.PasswordCallback Maven / Gradle / Ivy

There is a newer version: 5.6.4
Show newest version
package com.frameworkset.platform.security.authentication;


public class PasswordCallback  implements Callback, java.io.Serializable {

    private static final long serialVersionUID = 2267422647454909926L;

    /**
     * @serial
     * @since 1.4
     */
    private String prompt;
    /**
     * @serial
     * @since 1.4
     */
    private boolean echoOn;
    /**
     * @serial
     * @since 1.4
     */
    private String inputPassword;

    /**
     * Construct a PasswordCallback with a prompt
     * and a boolean specifying whether the password should be displayed
     * as it is being typed.
     *
     * 

* * @param prompt the prompt used to request the password.

* * @param echoOn true if the password should be displayed * as it is being typed. * * @exception IllegalArgumentException if prompt is null or * if prompt has a length of 0. */ public PasswordCallback(String prompt, boolean echoOn) { if (prompt == null || prompt.length() == 0) throw new IllegalArgumentException(); this.prompt = prompt; this.echoOn = echoOn; } /** * Get the prompt. * *

* * @return the prompt. */ public String getPrompt() { return prompt; } /** * Return whether the password * should be displayed as it is being typed. * *

* * @return the whether the password * should be displayed as it is being typed. */ public boolean isEchoOn() { return echoOn; } /** * Set the retrieved password. * *

This method makes a copy of the input password * before storing it. * *

* * @param password the retrieved password, which may be null. * * @see #getPassword */ public void setPassword(String password) { this.inputPassword = password; } /** * Get the retrieved password. * *

This method returns a copy of the retrieved password. * *

* * @return the retrieved password, which may be null. * * @see #setPassword */ public String getPassword() { return inputPassword; } /** * Clear the retrieved password. */ public void clearPassword() { inputPassword = ""; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy