The object that can be used to trigger an authentication operation.

Usage example:

 class AuthenticatorSelectorImpl extends AuthenticatorSelector {
async selectAuthenticator(
context: AuthenticatorSelectionContext,
handler: AuthenticatorSelectionHandler,
): Promise<void> {
await handler.aaid(aaid).catch(console.error);
}
}

class PinUserVerifierImpl extends PinUserVerifier {
async verifyPin(
context: PinUserVerificationContext,
handler: PinUserVerificationHandler,
): Promise<void> {
await handler.verifyPin(pin).catch(console.error);
}
}

class BiometricUserVerifierImpl implements BiometricUserVerifier {
async verifyBiometric(
context: BiometricUserVerificationContext,
handler: BiometricUserVerificationHandler,
): Promise<void> {
await handler.verifyBiometric().catch(console.error);
}
}

[...]
async function authenticate(
client: MobileAuthenticationClient,
username: string,
sessionProvider?: SessionProvider,
): Promise<void> {
await client.operations.authentication
.username(username)
.sessionProvider(sessionProvider)
.authenticatorSelector(AuthenticatorSelectorImpl(...))
.pinUserVerifier(PinUserVerifierImpl(...))
.biometricUserVerifier(BiometricUserVerifierImpl(...))
.onSuccess((authorizationProvider) {
// handle success
})
.onError((error) {
// handle error
})
.execute();
}
[...]

Hierarchy

Methods

  • Specifies the username that must be used to authenticate.

    IMPORTANT
    Providing the username is required.

    Parameters

    • username: string

      the username.

    Returns Authentication

    the Authentication object.

  • The retry policy to be used to obtain an AuthorizationProvider after the user authenticates successfully. If obtaining an AuthorizationProvider fails on the first try, the SDK will retry according to the provided RetryPolicy. This policy is used when the backend is the Identity Suite and cookies are created after a successful authentication.

    Parameters

    • retryPolicy: RetryPolicy

      the retry policy to be used when retrieving the AuthorizationProvider. By default, the code will retry 3 times with a time interval of 1 second between tries.

    Returns Authentication

    the Authentication object.

  • Specifies the object that will be invoked if the authentication was successful.

    IMPORTANT
    Providing the onSuccess is required.

    Parameters

    • onSuccess: ((authorizationProvider?) => void)

      the callback which receives an optional AuthorizationProvider.

        • (authorizationProvider?): void
        • Parameters

          Returns void

    Returns Authentication

    the Authentication object.

  • Executes the operation asynchronously.

    Returns Promise<void>

Generated using TypeDoc