Package com.avaya.clientservices.credentials

## Class UserCredential

- java.lang.Object
- - com.avaya.clientservices.credentials.UserCredential

-     public final class UserCredential
      extends java.lang.Object

  Represents a user credential that can be used to respond to an authentication credential challenge.

  Credentials may consist of username, password, HA1 String and domain information. Depending on the system configuration, some of the parameters may not be available or applicable for a particular credential. For example, some credential may be made up of username and password only. In such case, the domain and HA1 String will be just empty strings. In some other configurations (e.g., for SIP authentication), the HA1 String and the username are the only user credential information available from the configuration server for a user. In such case, the user credential will have empty strings for password and domain.

  This interface includes all of the convenient methods for constructing a UserCredential.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `UserCredential​(java.lang.String portalUserToken)` | Constructor of a credential using Portal User Token.
    `UserCredential​(java.lang.String username, java.lang.String password)` | Constructor of a credential using username and password.
    `UserCredential​(java.lang.String username, java.lang.String password, java.lang.String domain)` | Constructor of a credential using username, password and domain.
    `UserCredential​(java.lang.String username, java.lang.String password, java.lang.String domain, java.lang.String ha1String)` | Constructor of a credential using username, password, domain and HA1 string.
    `UserCredential​(java.lang.String username, java.lang.String password, java.lang.String domain, java.lang.String ha1String, java.util.Date credentialExpiry)` | Constructor of a credential using username, password, domain and HA1 string.
    `UserCredential​(java.lang.String username, java.lang.String password, java.lang.String domain, java.util.Date credentialExpiry)` | Constructor of a credential using username, password and domain.
    `UserCredential​(java.lang.String username, java.lang.String password, java.util.Date credentialExpiry)` | Constructor of a credential using username and password.
    `UserCredential​(java.lang.String accessToken, java.util.Date expires)` | Constructor of a credential using Access Token and expires time.
    `UserCredential​(java.lang.String accessToken, java.util.Date expires, java.lang.String idToken)` | Constructor of a credential using Access Token and expires time.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(java.lang.Object obj)` |
    `java.lang.String` | `getAccessToken()` | Get the Access token for OAuth2 bearer.
    `java.util.Date` | `getCredentialExpiry()` | The time until which the credential is valid.
    `java.lang.String` | `getDomain()` | Get the domain for this credential.
    `java.lang.String` | `getHA1String()` | Get the HA1String for this credential.
    `java.lang.String` | `getIdToken()` | Get the OAuth2 ID token containing identity information about the authenticated user.
    `java.lang.String` | `getPassword()` | Get the password for this credential.
    `java.lang.String` | `getPortalUserToken()` | Get the Portal User Token of this credential.
    `java.lang.String` | `getUsername()` | Get the username for this credential.
    `int` | `hashCode()` |
    `java.lang.String` | `toString()` |

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

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

- - ### Constructor Detail

    - #### UserCredential

          public UserCredential​(java.lang.String username,
                                java.lang.String password)

      Constructor of a credential using username and password.
      Parameters:
        `username` - username for this credential
        `password` - password for this credential

    - #### UserCredential

          public UserCredential​(java.lang.String username,
                                java.lang.String password,
                                java.util.Date credentialExpiry)

      Constructor of a credential using username and password.
      Parameters:
        `username` - username for this credential
        `password` - password for this credential
        `credentialExpiry` - time until which the credential is valid.

    - #### UserCredential

          public UserCredential​(java.lang.String username,
                                java.lang.String password,
                                java.lang.String domain)

      Constructor of a credential using username, password and domain.
      Parameters:
        `username` - username for this credential
        `password` - password for this credential
        `domain` - domain for this credential (empty string if n/a)

    - #### UserCredential

          public UserCredential​(java.lang.String username,
                                java.lang.String password,
                                java.lang.String domain,
                                java.util.Date credentialExpiry)

      Constructor of a credential using username, password and domain.
      Parameters:
        `username` - username for this credential
        `password` - password for this credential
        `domain` - domain for this credential (empty string if n/a)
        `credentialExpiry` - time until which the credential is valid.

    - #### UserCredential

          public UserCredential​(java.lang.String username,
                                java.lang.String password,
                                java.lang.String domain,
                                java.lang.String ha1String)

      Constructor of a credential using username, password, domain and HA1 string.
      Parameters:
        `username` - username for this credential
        `password` - password for this credential (empty string if n/a)
        `domain` - domain for this credential (empty string if n/a)
        `ha1String` - HA1 string for this credential (empty string if n/a)

    - #### UserCredential

          public UserCredential​(java.lang.String username,
                                java.lang.String password,
                                java.lang.String domain,
                                java.lang.String ha1String,
                                java.util.Date credentialExpiry)

      Constructor of a credential using username, password, domain and HA1 string.
      Parameters:
        `username` - username for this credential
        `password` - password for this credential (empty string if n/a)
        `domain` - domain for this credential (empty string if n/a)
        `ha1String` - HA1 string for this credential (empty string if n/a)
        `credentialExpiry` - time until which the credential is valid.

    - #### UserCredential

          public UserCredential​(java.lang.String portalUserToken)

      Constructor of a credential using Portal User Token.
      Parameters:
        `portalUserToken` - token of this credential

    - #### UserCredential

          public UserCredential​(java.lang.String accessToken,
                                java.util.Date expires)

      Constructor of a credential using Access Token and expires time. When expires is set to null, then access token is only used once.
      Parameters:
        `accessToken` - OAuth2 access_token
        `expires` - The time until which the token is valid.

    - #### UserCredential

          public UserCredential​(java.lang.String accessToken,
                                java.util.Date expires,
                                java.lang.String idToken)

      Constructor of a credential using Access Token and expires time. When expires is set to null, then access token is only used once.
      Parameters:
        `accessToken` - OAuth2 access_token
        `expires` - The time until which the token is valid.
        `idToken` - The OAuth2 ID token containing identity information about the authenticated user.

  - ### Method Detail

    - #### getUsername

          public java.lang.String getUsername()

      Get the username for this credential.
      Returns:
        The username.

    - #### getPassword

          public java.lang.String getPassword()

      Get the password for this credential.
      Returns:
        The password.

    - #### getDomain

          public java.lang.String getDomain()

      Get the domain for this credential.
      Returns:
        The domain.

    - #### getHA1String

          public java.lang.String getHA1String()

      Get the HA1String for this credential.
      Returns:
        The HA1String.

    - #### getPortalUserToken

          public java.lang.String getPortalUserToken()

      Get the Portal User Token of this credential.
      Returns:
        Portal User Token.

    - #### getAccessToken

          public java.lang.String getAccessToken()

      Get the Access token for OAuth2 bearer.
      Returns:
        Access Token.

    - #### getCredentialExpiry

          public java.util.Date getCredentialExpiry()

      The time until which the credential is valid. Date equal to current Date treated as one time access token Date less then current Date treated as token expired
      Returns:
        The time until which the credential is valid.

    - #### getIdToken

          public java.lang.String getIdToken()

      Get the OAuth2 ID token containing identity information about the authenticated user.
      Returns:
        Id Token.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals​(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`