Stay organized with collections
Save and categorize content based on your preferences.
PasswordCallback
open class PasswordCallback : Callback, Serializable
Underlying security services instantiate and pass a PasswordCallback
to the handle
method of a CallbackHandler
to retrieve password information.
Summary
Public constructors |
Construct a PasswordCallback with a prompt and a boolean specifying whether the password should be displayed as it is being typed.
|
Public methods |
open Unit |
Clear the retrieved password.
|
open CharArray! |
Get the retrieved password.
|
open String! |
Get the prompt.
|
open Boolean |
Return whether the password should be displayed as it is being typed.
|
open Unit |
Set the retrieved password.
|
Public constructors
PasswordCallback
PasswordCallback(
prompt: String!,
echoOn: Boolean)
Construct a PasswordCallback
with a prompt and a boolean specifying whether the password should be displayed as it is being typed.
Parameters |
prompt |
String!: the prompt used to request the password.
|
echoOn |
Boolean: true if the password should be displayed as it is being typed. |
Exceptions |
java.lang.IllegalArgumentException |
if prompt is null or if prompt has a length of 0. |
Public methods
clearPassword
open fun clearPassword(): Unit
Clear the retrieved password.
getPassword
open fun getPassword(): CharArray!
Get the retrieved password.
This method returns a copy of the retrieved password.
Return |
CharArray! |
the retrieved password, which may be null. |
getPrompt
open fun getPrompt(): String!
Get the prompt.
isEchoOn
open fun isEchoOn(): Boolean
Return whether the password should be displayed as it is being typed.
Return |
Boolean |
the whether the password should be displayed as it is being typed. |
setPassword
open fun setPassword(password: CharArray!): Unit
Set the retrieved password.
This method makes a copy of the input password before storing it.
Parameters |
password |
CharArray!: the retrieved password, which may be null. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# PasswordCallback\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPasswordCallback\n================\n\n```\nopen class PasswordCallback : Callback, Serializable\n```\n\n|---|----------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [javax.security.auth.callback.PasswordCallback](#) |\n\nUnderlying security services instantiate and pass a `PasswordCallback` to the `handle` method of a `CallbackHandler` to retrieve password information.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [PasswordCallback](#PasswordCallback(kotlin.String,%20kotlin.Boolean))`(`prompt:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `echoOn:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Construct a `PasswordCallback` with a prompt and a boolean specifying whether the password should be displayed as it is being typed. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [clearPassword](#clearPassword())`()` Clear the retrieved password. |\n| open [CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)! | [getPassword](#getPassword())`()` Get the retrieved password. |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getPrompt](#getPrompt())`()` Get the prompt. |\n| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isEchoOn](#isEchoOn())`()` Return whether the password should be displayed as it is being typed. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setPassword](#setPassword(kotlin.CharArray))`(`password:` `[CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)!`)` Set the retrieved password. |\n\nPublic constructors\n-------------------\n\n### PasswordCallback\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nPasswordCallback(\n prompt: String!, \n echoOn: Boolean)\n```\n\nConstruct a `PasswordCallback` with a prompt and a boolean specifying whether the password should be displayed as it is being typed.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `prompt` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the prompt used to request the password. \u003cbr /\u003e |\n| `echoOn` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): true if the password should be displayed as it is being typed. |\n\n| Exceptions ||\n|--------------------------------------|-------------------------------------------------------|\n| `java.lang.IllegalArgumentException` | if `prompt` is null or if `prompt` has a length of 0. |\n\nPublic methods\n--------------\n\n### clearPassword\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun clearPassword(): Unit\n```\n\nClear the retrieved password. \n\n### getPassword\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getPassword(): CharArray!\n```\n\nGet the retrieved password.\n\nThis method returns a copy of the retrieved password.\n\n\u003cbr /\u003e\n\n| Return ||\n|------------------------------------------------------------------------------------------|--------------------------------------------|\n| [CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)! | the retrieved password, which may be null. |\n\n**See Also**\n\n- [#setPassword](#setPassword(kotlin.CharArray)) \n\n### getPrompt\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getPrompt(): String!\n```\n\nGet the prompt.\n\n\u003cbr /\u003e\n\n| Return ||\n|-----------------------------------------------------------------------------------|-------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | the prompt. |\n\n### isEchoOn\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun isEchoOn(): Boolean\n```\n\nReturn whether the password should be displayed as it is being typed.\n\n\u003cbr /\u003e\n\n| Return ||\n|------------------------------------------------------------------------------------|--------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | the whether the password should be displayed as it is being typed. |\n\n### setPassword\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun setPassword(password: CharArray!): Unit\n```\n\nSet the retrieved password.\n\nThis method makes a copy of the input *password* before storing it.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| `password` | [CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)!: the retrieved password, which may be null. |\n\n**See Also**\n\n- [#getPassword](#getPassword())"]]