Package com.avaya.clientservices.credentials

## Interface CredentialProvider

-     public interface CredentialProvider

  Interface defining a credential provider.

  A credential provider needs to know how to handle an authentication challenge and provide a response based on credentials.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `onAuthenticationChallenge​(Challenge challenge, CredentialCompletionHandler credentialCompletionHandler)` | This method is called to authenticate a challenge and provide a response back to the requester.
    `void` | `onAuthenticationChallengeCancelled​(Challenge challenge)` | This method is called to cancel the previous credential request has been accepted.
    `void` | `onCredentialAccepted​(Challenge challenge)` | This method is called to report that the credential returned in the previous credential request has been accepted.
    `boolean` | `supportsPreEmptiveChallenge()` | This method is called to check if the associated credential provider supports pre-emptive challenge

- - ### Method Detail

    - #### onAuthenticationChallenge

          void onAuthenticationChallenge​(Challenge challenge,
                                         CredentialCompletionHandler credentialCompletionHandler)

      This method is called to authenticate a challenge and provide a response back to the requester.

      The challenge contains information about the credentials needed and the number of previous failures (if any). When credentials are available that can satisfy the challenge, the credentialCompletionHandler should be invoked. This need not happen synchronously. Note that if, when originally passing the ICredentialProvider interface pointer into the SDK via a user configuration structure, a username/domain was also provided in that same structure, then that same username/domain must be provided in the ICredential passed to the completion handler. Also note that if no credentials are available that can satisfy the challenge, it is expected that a NULL ICredential will be passed to the completion handler to complete the challenge/response transaction.

      Parameters:
        `challenge` - The challenge to be used for getting the authentication credential.
        `credentialCompletionHandler` - Callback to be used to return the credential.

    - #### onCredentialAccepted

          void onCredentialAccepted​(Challenge challenge)

      This method is called to report that the credential returned in the previous credential request has been accepted.

      ICredential provider needs to track the previous credential request based on the original challenge.

      Parameters:
        `challenge` - The challenge used for getting the authentication credential.

    - #### onAuthenticationChallengeCancelled

          void onAuthenticationChallengeCancelled​(Challenge challenge)

      This method is called to cancel the previous credential request has been accepted.

      ICredential provider needs to track the previous credential request based on the original challenge.

      Parameters:
        `challenge` - The challenge used for getting the authentication credential.

    - #### supportsPreEmptiveChallenge

          boolean supportsPreEmptiveChallenge()

      This method is called to check if the associated credential provider supports pre-emptive challenge

      A pre-emptive challenge will be issued prior to sending an request to the server. It can be used in some scenarios (like OAuth), where the UI has credentials that the server can validate. Default value is false. Some authentication schemes (like digest) require that an unauthenticated request be sent to the server to generate a challenge response from the server. An interface that implements CredentialProvider and responds with OAuth tokens shall return true when this method is invoked. On contrary, an interface that returns username/password type, shall return false.

      Returns:
        boolean indicating the pre-emptive challenge support