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

Package com.sas.services.connection

# Class PasswordCredential

java.lang.Object
com.sas.services.connection.Credential
com.sas.services.connection.PasswordCredential

All Implemented Interfaces:
  `Serializable`, `Cloneable`

@SASScope("ALL") @BinaryCompatibilityOnly public class PasswordCredential extends Credential
Login credentials for an IOM server.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `PasswordCredential(String domain)`
  Constructor used by the `newInstance()` methods and subclasses.
  ``
  `PasswordCredential(String userName, String password)`
  Construct login credentials.
  ``
  `PasswordCredential(String userName, String password, String domain)`
  Construct login credentials.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object that)`
  `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.
  `String`
  `getUserName()`
  Get the user name.
  `int`
  `hashCode()`
  `static PasswordCredential`
  `newInstance(String userName, char[] passwordAsChars, String domain)`
  Create a new instance of this class using a character array for the password.
  `static PasswordCredential`
  `newInstance(String userName, com.sas.net.crypto.SealedString passwordAsSealedString, String domain)`
  Create a new instance of this class using a `SealedString` for the password.
  `void`
  `setPassword(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(String userName)`
  Set the user name.
  `String`
  `toString()`

  ### Methods inherited from class com.sas.services.connection.Credential

  `clone, getDomain, getLocale, setDomain, setLocale`

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### PasswordCredential

    public PasswordCredential(String userName, String password, 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(String userName, 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(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 Details

  - ### newInstance

    public static PasswordCredential newInstance(String userName, com.sas.net.crypto.SealedString passwordAsSealedString, 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(String userName, char[] passwordAsChars, 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(String userName)
    Set the user name.
    Parameters:
      `userName` - the user name

  - ### getUserName

    public String getUserName()
    Get the user name.
    Returns:
      the user name

  - ### setPassword

    public void setPassword(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 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(Object that)
    Overrides:
      `equals` in class `Credential`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Credential`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`