Stay organized with collections
Save and categorize content based on your preferences.
PasswordAuthentication
class PasswordAuthentication
The class PasswordAuthentication is a data holder that is used by Authenticator. It is simply a repository for a user name and a password.
Summary
Public constructors |
Creates a new PasswordAuthentication object from the given user name and password.
|
Public methods |
CharArray! |
Returns the user password.
|
String! |
Returns the user name.
|
Public constructors
PasswordAuthentication
PasswordAuthentication(
userName: String!,
password: CharArray!)
Creates a new PasswordAuthentication
object from the given user name and password.
Note that the given user password is cloned before it is stored in the new PasswordAuthentication
object.
Parameters |
userName |
String!: the user name |
password |
CharArray!: the user's password |
Public methods
getPassword
fun getPassword(): CharArray!
Returns the user password.
Note that this method returns a reference to the password. It is the caller's responsibility to zero out the password information after it is no longer needed.
getUserName
fun getUserName(): String!
Returns the user name.
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,["# PasswordAuthentication\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPasswordAuthentication\n======================\n\n```\nclass PasswordAuthentication\n```\n\n|---|--------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [java.net.PasswordAuthentication](#) |\n\nThe class PasswordAuthentication is a data holder that is used by Authenticator. It is simply a repository for a user name and a password.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [PasswordAuthentication](#PasswordAuthentication(kotlin.String,%20kotlin.CharArray))`(`userName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `password:` `[CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)!`)` Creates a new `PasswordAuthentication` object from the given user name and password. |\n\n| Public methods ||\n|------------------------------------------------------------------------------------------|--------------------------------------------------------------|\n| [CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)! | [getPassword](#getPassword())`()` Returns the user password. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getUserName](#getUserName())`()` Returns the user name. |\n\nPublic constructors\n-------------------\n\n### PasswordAuthentication\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nPasswordAuthentication(\n userName: String!, \n password: CharArray!)\n```\n\nCreates a new `PasswordAuthentication` object from the given user name and password.\n\nNote that the given user password is cloned before it is stored in the new `PasswordAuthentication` object.\n\n| Parameters ||\n|------------|---------------------------------------------------------------------------------------------------------------|\n| `userName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the user name |\n| `password` | [CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)!: the user's password |\n\nPublic methods\n--------------\n\n### getPassword\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getPassword(): CharArray!\n```\n\nReturns the user password.\n\nNote that this method returns a reference to the password. It is the caller's responsibility to zero out the password information after it is no longer needed.\n\n| Return ||\n|------------------------------------------------------------------------------------------|--------------|\n| [CharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-array/index.html)! | the password |\n\n### getUserName\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getUserName(): String!\n```\n\nReturns the user name.\n\n| Return ||\n|-----------------------------------------------------------------------------------|---------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | the user name |"]]