鴻蒙OS PasswordAuthentication

2022-06-10 17:13 更新

PasswordAuthentication

java.lang.Object

|---java.net.PasswordAuthentication

public final class PasswordAuthentication
extends Object

PasswordAuthentication 類是 Authenticator 使用的數(shù)據(jù)持有者。 它只是用戶名和密碼的存儲庫。

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
PasswordAuthentication(String userName, char[] password) 從給定的用戶名和密碼創(chuàng)建一個新的 PasswordAuthentication 對象。

方法總結(jié)

修飾符和類型 方法 描述
char[] getPassword() 返回用戶密碼。
String getUserName() 返回用戶名。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

構(gòu)造函數(shù)詳細信息

PasswordAuthentication

public PasswordAuthentication(String userName, char[] password)

從給定的用戶名和密碼創(chuàng)建一個新的 PasswordAuthentication 對象。

請注意,給定的用戶密碼在存儲到新的 PasswordAuthentication 對象之前會被克隆。

參數(shù):

參數(shù)名稱 參數(shù)描述
userName 用戶名
password 用戶密碼

方法詳情

getUserName

public String getUserName()

返回用戶名。

返回:

用戶名

getPassword

public char[] getPassword()

返回用戶密碼。

請注意,此方法返回對密碼的引用。 調(diào)用者有責任在不再需要密碼信息后將其清零。

返回:

密碼

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號