JavaTM 2 Platform
Standard Ed. 6

java.net
类 PasswordAuthentication

java.lang.Object
  继承者 java.net.PasswordAuthentication

public final class PasswordAuthentication
extends Object

PasswordAuthentication 类是供 Authenticator 使用的数据持有者。它只是用户名和密码的存储库。

从以下版本开始:
1.2
另请参见:
Authenticator, Authenticator.getPasswordAuthentication()

构造方法摘要
PasswordAuthentication(String userName, char[] password)
          根据给定用户名和密码创建新的 PasswordAuthentication 对象。
 
方法摘要
 char[] getPassword()
          返回用户密码。
 String getUserName()
          返回用户名。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

PasswordAuthentication

public PasswordAuthentication(String userName,
                              char[] password)
根据给定用户名和密码创建新的 PasswordAuthentication 对象。

注意,要在将给定用户密码存储在新的 PasswordAuthentication 对象中之前复制该密码。

参数:
userName - 用户名
password - 用户密码
方法详细信息

getUserName

public String getUserName()
返回用户名。

返回:
用户名

getPassword

public char[] getPassword()
返回用户密码。

注意,此方法返回到密码的引用。不再需要密码信息后,调用方负责将其归零。

返回:
密码

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策