java.net
Class PasswordAuthentication

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.net.PasswordAuthentication

public final class PasswordAuthentication
extends Object sample code for java.lang.Object definition code for java.lang.Object

The class PasswordAuthentication is a data holder that is used by Authenticator. It is simply a repository for a user name and a password.

Since:
1.2
See Also:
Authenticator sample code for java.net.Authenticator definition code for java.net.Authenticator , Authenticator.getPasswordAuthentication() sample code for java.net.Authenticator.getPasswordAuthentication() definition code for java.net.Authenticator.getPasswordAuthentication()

Constructor Summary
PasswordAuthentication sample code for java.net.PasswordAuthentication.PasswordAuthentication(java.lang.String, char[]) definition code for java.net.PasswordAuthentication.PasswordAuthentication(java.lang.String, char[]) (String sample code for java.lang.String definition code for java.lang.String  userName, char[] password)
          Creates a new PasswordAuthentication object from the given user name and password.
 
Method Summary
 char[] getPassword sample code for java.net.PasswordAuthentication.getPassword() definition code for java.net.PasswordAuthentication.getPassword() ()
          Returns the user password.
 String sample code for java.lang.String definition code for java.lang.String getUserName sample code for java.net.PasswordAuthentication.getUserName() definition code for java.net.PasswordAuthentication.getUserName() ()
          Returns the user name.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

PasswordAuthentication sample code for java.net.PasswordAuthentication(java.lang.String, char[]) definition code for java.net.PasswordAuthentication(java.lang.String, char[])

public PasswordAuthentication(String sample code for java.lang.String definition code for java.lang.String  userName,
                              char[] password)
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 - the user name
password - the user's password
Method Detail

getUserName sample code for java.net.PasswordAuthentication.getUserName() definition code for java.net.PasswordAuthentication.getUserName()

public String sample code for java.lang.String definition code for java.lang.String  getUserName()
Returns the user name.

Returns:
the user name

getPassword sample code for java.net.PasswordAuthentication.getPassword() definition code for java.net.PasswordAuthentication.getPassword()

public char[] getPassword()
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.

Returns:
the password