PasswordAuthentication | java.net |
This simple immutable class encapsulates a username and a password. The password is stored as a character array rather than as a String object so that the caller can erase the contents of the array after use for increased security. Note that the PasswordAuthentication( ) constructor clones the specified password character array, but getPassword( ) returns a reference to the object's internal array.Application programmers defining an Authenticator object for their application need to create and return a PasswordAuthentication object from the getPasswordAuthentication( ) method of that object. System programmers writing URLStreamHandler implementations or otherwise interacting with a network server that requests password authentication may obtain a PasswordAutentication object representing the user's name and password by calling the static Authenticator.requestPasswordAuthentication( ) method.public final class PasswordAuthentication { // Public Constructors public PasswordAuthentication (String userName , char[ ] password ); // Public Instance Methods public char[ ] getPassword ( ); public String getUserName ( ); }
Returned By Authenticator.{getPasswordAuthentication( ), requestPasswordAuthentication( )} |