Interface Authentication

All Superinterfaces:
HttpOperation<Authentication>, Operation

public interface Authentication extends HttpOperation<Authentication>
The object that can be used to trigger an authentication operation.

Usage example:

 private void authenticate(Operations operations, String username, SessionProvider sessionProvider) {
     operations.authentication()
          .username(username)
          .sessionProvider(sessionProvider)
          .authenticatorSelector((ctx, handler) -> {
              // select authenticator
          })
          .pinUserVerifier(new PinUserVerifier() {
              @Override
              public void verifyPin(UserVerificationContext context, PinUserVerificationHandler handler) {
                  // verify user
              }

              @Override
              public void onValidCredentialsProvided(Authenticator authenticator) {
                  // If needed, do something when valid credentials are provided (like hiding the screen if using the fingerprint authenticator).
              }
          })
          .biometricUserVerifier(new BiometricUserVerifier() {
              @Override
              public void verifyBiometric(UserVerificationContext context, BiometricUserVerificationHandler handler) {
                  // verify user
              }

              @Override
              public void onValidCredentialsProvided(Authenticator authenticator) {
                  // If needed, do something when valid credentials are provided (like hiding the screen if using the fingerprint authenticator).
              }
          })
          .fingerprintUserVerifier(new FingerprintUserVerifier() {
              @Override
              public void verifyFingerprint(UserVerificationContext context, FingerprintUserVerificationHandler handler) {
                  // verify user
              }

              @Override
              public void onValidCredentialsProvided(Authenticator authenticator) {
                  // If needed, do something when valid credentials are provided (like hiding the screen if using the fingerprint authenticator).
              }
          })
          .onError(error -> {
              // handle error
          })
          .onSuccess(result -> {
              // handle success
          })
          .execute();
 }
 
  • Method Details

    • username

      Authentication username(String username)
      Specifies the username that must be used to authenticate.

      Providing the username is required.

      Parameters:
      username - the username
      Returns:
      an Authentication
    • sessionProvider

      Authentication sessionProvider(SessionProvider sessionProvider)
      Specifies the session provider that must be used to authenticate. If no SessionProvider is given, then an SessionProvider.EmptySessionProvider will be used.
      Parameters:
      sessionProvider - the SessionProvider
      Returns:
      an Authentication
    • authenticatorSelector

      Authentication authenticatorSelector(AuthenticatorSelector selector)
      Specifies the object that will take care of the selection of the authenticator to be used.

      Providing the authenticator selector is required.

      Parameters:
      selector - the AuthenticatorSelector
      Returns:
      an Authentication
    • pinUserVerifier

      Authentication pinUserVerifier(PinUserVerifier userVerifier)
      Specifies the object that will take care of the PIN user verification.

      Providing at least one of the BiometricUserVerifier, PinUserVerifier, DevicePasscodeUserVerifier or FingerprintUserVerifier is required.

      Parameters:
      userVerifier - the PinUserVerifier
      Returns:
      an Authentication
    • fingerprintUserVerifier

      Authentication fingerprintUserVerifier(FingerprintUserVerifier userVerifier)
      Specifies the object that will take care of the fingerprint user verification.

      Providing at least one of the BiometricUserVerifier, PinUserVerifier, DevicePasscodeUserVerifier or FingerprintUserVerifier is required.

      Parameters:
      userVerifier - the FingerprintUserVerifier
      Returns:
      an Authentication
    • biometricUserVerifier

      Authentication biometricUserVerifier(BiometricUserVerifier userVerifier)
      Specifies the object that will take care of the biometric user verification.

      Providing at least one of the BiometricUserVerifier, PinUserVerifier, DevicePasscodeUserVerifier or FingerprintUserVerifier is required.

      Parameters:
      userVerifier - the BiometricUserVerifier
      Returns:
      an Authentication
    • devicePasscodeUserVerifier

      Authentication devicePasscodeUserVerifier(DevicePasscodeUserVerifier userVerifier)
      Specifies the object that will take care of the device passcode user verification.

      Providing at least one of the BiometricUserVerifier, PinUserVerifier, DevicePasscodeUserVerifier or FingerprintUserVerifier is required.

      Parameters:
      userVerifier - the DevicePasscodeUserVerifier
      Returns:
      a Authentication
    • retryPolicyObtainingAuthorizationProvider

      Authentication retryPolicyObtainingAuthorizationProvider(RetryPolicy retryPolicy)
      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.

      The policy is also used to retrieve the cookies returned in the AuthenticationError object passed to the object provided in onError(Consumer).

      Parameters:
      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:
      an Authentication
    • onSuccess

      Specifies the object that will be invoked if the authentication was successful. The specified object will receive an AuthorizationProvider. This object will be invoked in the main/UI thread.

      Providing the object handling the AuthorizationProvider is required.

      Parameters:
      onSuccess - the consumer of an AuthorizationProvider
      Returns:
      an Authentication
    • onError

      Authentication onError(Consumer<AuthenticationError> errorConsumer)
      Specifies the object that will be invoked if the authentication failed. The specified object will receive an AuthenticationError. This object will be invoked in the main/UI thread.

      Providing the object handling the error is required.

      Parameters:
      errorConsumer - the consumer of an FidoUafError
      Returns:
      an Authentication