# PasswordCallback

public class **PasswordCallback** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Callback](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/callback/Callback.html) [Serializable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html) <br />

Underlying security services instantiate and pass a
`PasswordCallback` to the `handle`
method of a `CallbackHandler` to retrieve password information.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/callback/CallbackHandler.html`

### Public Constructor Summary

|---|---|
|   | [PasswordCallback](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/callback/PasswordCallback.html#PasswordCallback(java.lang.String,%20boolean))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) prompt, boolean echoOn) Construct a `PasswordCallback` with a prompt and a boolean specifying whether the password should be displayed as it is being typed. |

### Public Method Summary

|---|---|
| void | [clearPassword](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/callback/PasswordCallback.html#clearPassword())() Clear the retrieved password. |
| char\[\] | [getPassword](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/callback/PasswordCallback.html#getPassword())() Get the retrieved password. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getPrompt](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/callback/PasswordCallback.html#getPrompt())() Get the prompt. |
| boolean | [isEchoOn](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/callback/PasswordCallback.html#isEchoOn())() Return whether the password should be displayed as it is being typed. |
| void | [setPassword](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/callback/PasswordCallback.html#setPassword(char[]))(char\[\] password) Set the retrieved password. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**PasswordCallback**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) prompt, boolean echoOn)

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

<br />

##### Parameters

| prompt | the prompt used to request the password. <br /> |
| echoOn | true if the password should be displayed as it is being typed. |
|---|---|

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `prompt` is null or if `prompt` has a length of 0. |
|---|---|

## Public Methods

#### public void
**clearPassword**
()

Clear the retrieved password.

#### public char\[\]
**getPassword**
()

Get the retrieved password.

This method returns a copy of the retrieved password.

<br />

##### Returns

- the retrieved password, which may be null.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/callback/PasswordCallback.html#setPassword(char[])`

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getPrompt**
()

Get the prompt.

<br />

##### Returns

- the prompt.

#### public boolean
**isEchoOn**
()

Return whether the password
should be displayed as it is being typed.

<br />

##### Returns

- the whether the password should be displayed as it is being typed.

#### public void
**setPassword**
(char\[\] password)

Set the retrieved password.

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

<br />

##### Parameters

| password | the retrieved password, which may be null. |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/callback/PasswordCallback.html#getPassword()`