Skip to content

Most visited

Recently visited

navigation
Added in API level 1

PasswordCallback

public class PasswordCallback
extends Object implements Callback, Serializable

java.lang.Object
   ↳ javax.security.auth.callback.PasswordCallback


Used in conjunction with a CallbackHandler to retrieve a password when needed.

Summary

Public constructors

PasswordCallback(String prompt, boolean echoOn)

Creates a new PasswordCallback instance.

Public methods

void clearPassword()

Clears the password stored in this PasswordCallback.

char[] getPassword()

Returns the password.

String getPrompt()

Returns the prompt that was specified when creating this PasswordCallback

boolean isEchoOn()

Queries whether this PasswordCallback expects user input to be echoed, which is specified during the creation of the object.

void setPassword(char[] password)

Sets the password.

Inherited methods

From class java.lang.Object

Public constructors

PasswordCallback

Added in API level 1
PasswordCallback (String prompt, 
                boolean echoOn)

Creates a new PasswordCallback instance.

Parameters
prompt String: the message that should be displayed to the user
echoOn boolean: determines whether the user input should be echoed

Public methods

clearPassword

Added in API level 1
void clearPassword ()

Clears the password stored in this PasswordCallback.

getPassword

Added in API level 1
char[] getPassword ()

Returns the password. The security service that needs the password usually calls this method once the CallbackHandler has finished its work.

Returns
char[] the password. A copy of the internal password is created and returned, so subsequent changes to the internal password do not affect the result.

getPrompt

Added in API level 1
String getPrompt ()

Returns the prompt that was specified when creating this PasswordCallback

Returns
String the prompt

isEchoOn

Added in API level 1
boolean isEchoOn ()

Queries whether this PasswordCallback expects user input to be echoed, which is specified during the creation of the object.

Returns
boolean true if (and only if) user input should be echoed

setPassword

Added in API level 1
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 char: the password. A copy of this is stored, so subsequent changes to the input array do not affect the PasswordCallback.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.