***  This class provides Binary Compatibility only, not Source Compatibility  ***

com.sas.services.connection
Class PasswordCredential

com.sas.services.connection.PasswordCredential
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class PasswordCredential

Login credentials for an IOM server.

See Also:
Serialized Form

Constructor Summary
protected PasswordCredential(java.lang.String domain)
          Constructor used by the newInstance() methods and subclasses.
  PasswordCredential(java.lang.String userName, java.lang.String password)
          Construct login credentials.
  PasswordCredential(java.lang.String userName, java.lang.String password, java.lang.String domain)
          Construct login credentials.
 
Method Summary
 boolean equals(java.lang.Object that)
           
 java.lang.String getPassword()
          Get the password.
 char[] getPasswordAsChars()
          Get the password as a character array.
 com.sas.net.crypto.SealedString getPasswordAsSealedString()
          Get the password as a SealedString object.
 java.lang.String getUserName()
          Get the user name.
 int hashCode()
           
static PasswordCredential newInstance(java.lang.String userName, char[] passwordAsChars, java.lang.String domain)
          Create a new instance of this class using a character array for the password.
static PasswordCredential newInstance(java.lang.String userName, com.sas.net.crypto.SealedString passwordAsSealedString, java.lang.String domain)
          Create a new instance of this class using a SealedString for the password.
 void setPassword(java.lang.String password)
          Set the password.
 void setPasswordAsChars(char[] passwordAsChars)
          Set the password as a character array.
 void setPasswordAsSealedString(com.sas.net.crypto.SealedString passwordAsSealedString)
          Set the password as a SealedString object.
 void setUserName(java.lang.String userName)
          Set the user name.
 java.lang.String toString()
           
 
Methods inherited from class com.sas.services.connection.Credential
clone, getDomain, getLocale, setDomain, setLocale
 

Constructor Detail

PasswordCredential

public PasswordCredential(java.lang.String userName,
                          java.lang.String password,
                          java.lang.String domain)
Construct login credentials. This is not the preferred way of constructing an instance of this class. If possible, use one of the newInstance() methods instead for improved security.

Parameters:
userName - the user name
password - the password
domain - the authentication domain. The authentication domain indicates the context in which this user name and password are valid. Servers that require user name and password also have domains, and this domain must match the server's domain if this login is valid on the server. null and empty ("") domains are equivalent.

PasswordCredential

public PasswordCredential(java.lang.String userName,
                          java.lang.String password)
Construct login credentials. The authentication domain will be "" (empty string). This is not the preferred way of constructing an instance of this class. If possible, use one of the newInstance() methods instead for improved security.

Parameters:
userName - the user name
password - the password

PasswordCredential

protected PasswordCredential(java.lang.String domain)
Constructor used by the newInstance() methods and subclasses. Callers MUST call or override setUserName() and one of setPassword(), setPasswordAsSealedString(), or setPasswordAsChars() immediately after calling this constructor. Otherwise, the object will be in a bad state.

Parameters:
domain - the authentication domain
Method Detail

newInstance

public static PasswordCredential newInstance(java.lang.String userName,
                                             com.sas.net.crypto.SealedString passwordAsSealedString,
                                             java.lang.String domain)
Create a new instance of this class using a SealedString for the password. The password must be encapsulated in a SealedString object for improved security.

Parameters:
userName - the user name
passwordAsSealedString - the password
domain - the authentication domain. Can be null.
Returns:
a new password credential

newInstance

public static PasswordCredential newInstance(java.lang.String userName,
                                             char[] passwordAsChars,
                                             java.lang.String domain)
Create a new instance of this class using a character array for the password. The character array containing the password should be cleared after calling this method for improved security. The password will be stored internally as a SealedString object.

Parameters:
userName - the user name
passwordAsChars - the password
domain - the authentication domain. Can be null.
Returns:
a new password credential

setUserName

public void setUserName(java.lang.String userName)
Set the user name.

Parameters:
userName - the user name

getUserName

public java.lang.String getUserName()
Get the user name.

Returns:
the user name

setPassword

public void setPassword(java.lang.String password)
Set the password. This is not the preferred way of setting the password. If possible, use setPasswordAsSealedString(), or setPasswordAsChars() for improved security.

Parameters:
password - the password

setPasswordAsSealedString

public void setPasswordAsSealedString(com.sas.net.crypto.SealedString passwordAsSealedString)
Set the password as a SealedString object. The password must be encapsulated in a SealedString object for improved security.

Parameters:
passwordAsSealedString - the password

setPasswordAsChars

public void setPasswordAsChars(char[] passwordAsChars)
Set the password as a character array. The character array containing the password should be cleared after calling this method for improved security. The password will be stored internally as a SealedString object.

Parameters:
passwordAsChars - the password

getPassword

public java.lang.String getPassword()
Get the password. This is not the preferred way of getting the password. If possible, use getPasswordAsSealedString(), or getPasswordAsChars() for improved security.

Returns:
the password

getPasswordAsSealedString

public com.sas.net.crypto.SealedString getPasswordAsSealedString()
Get the password as a SealedString object. The password will be encapsulated in a SealedString object for improved security.

Returns:
the password

getPasswordAsChars

public char[] getPasswordAsChars()
Get the password as a character array. The caller should clear the character array containing the password when it is no longer needed for improved security.

Returns:
the password

equals

public boolean equals(java.lang.Object that)
Overrides:
equals in class Credential

hashCode

public int hashCode()
Overrides:
hashCode in class Credential

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

***  This class provides Binary Compatibility only, not Source Compatibility  ***




Copyright © 2009 SAS Institute Inc. All Rights Reserved.