Class: WCSCredentialTokenProvider

Constructor

new WCSCredentialTokenProvider(token, username, attendeeId, sessionId, mode)

Class used to provide credentials for WCS Token Authentication.

Parameters:
Name Type Argument Description
token string <optional>
username string <optional>
attendeeId string <optional>
sessionId string <optional>
mode string <optional>

Members

attendeeId :string

Attendee ID to be used for authentication.

Type:
  • string

mode :string

Mode to be used for authentication.

Type:
  • string

sessionId :string

Session ID to be used for authentication.

Type:
  • string

token :string

Token to be used used for authentication.

Type:
  • string

username :string

Username to be used for authentication.

Type:
  • string

Methods

onAuthenticationChallenge(challenge, callback) → {void}

Function called after credentials were required.

Parameters:
Name Type Description
challenge Object

It is not used right now.

callback function

Function to be called after credentials are retrieved.

Inherited From:
Returns:
{ void }

Callbacks

addOnInvalidCredentialsCallback(callback) → {void}

Adds callback on invalidCredentialsProvided.

Parameters:
Name Type Description
callback AvayaClientServices.Config.WCSCredentialTokenProvider#onInvalidCredentialsProvided
Inherited From:
Returns:
{ void }

removeOnInvalidCredentialsCallback(callback) → {void}

Removes callback from invalidCredentialsProvided.

Parameters:
Name Type Description
callback AvayaClientServices.Config.AbstractCredentialProvider#onInvalidCredentialsProvided
Inherited From:
Returns:
{ void }

Type Definitions

onInvalidCredentialsProvided(invalidCredentialsEvent) → {void}

Interface for callback function to be invoked when provided credentials are invalid.

Examples

Using callback to retry authentication using existing credentials provider:

credentialProvider.addOnInvalidCredentialsCallback(function (event) {
    // When consumer application keeps a reference to the credential
    // provider used to configure services, update corresponding field
    // e. g. username, token, mode and session or attendee Id:
    handle.credentialProvider.token= 'secure';

    // Signal to try to re-establish the connection:
    event.retry(handle.credentialProvider); // Optional argument could
                                            // be omitted only when using
                                            // the same reference as in
                                            // the user configuration.
});

Using callback to retry authentication using new credential provider:

credentialProvider.addOnInvalidCredentialsCallback(function (event) {
    // When there is no reference to existing credentials provider,
    // create a new one first. It is allowed to switch to different
    // kind of the provider.
    const credentialProvider = new AvayaClientServices.Config.WCSCredentialTokenProvider(
        'secret',
        'janedoe',
        'attendeeId',
        'sessionId',
        'mode'
    );

    // It is advised to set up a similar callback when using a new instance:
    credentialProvider.onInvalidCredentialsProvided(function (event) {
        console.error(event.getFailureCount());
    });

    // Signal to save new credentials and try to re-establish the connection:
    event.retry(credentialProvider);
});

Using callback to cancel authentication:

credentialProvider.addOnInvalidCredentialsCallback(function (event) {
    event.cancel();
});
Parameters:
Name Type Description
invalidCredentialsEvent AvayaClientServices.Config.InvalidCredentialsEvent

Event containing retry and cancel methods, and failure count.

Returns:
{ void }
©2016 Avaya Inc. All Rights Reserved.