Interface Authentication
- All Superinterfaces:
HttpOperation<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(PinUserVerificationContext context, PinUserVerificationHandler handler) { // verify user } @Override public void onValidCredentialsProvided() { // 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(BiometricUserVerificationContext context, BiometricUserVerificationHandler handler) { // verify user } @Override public void onValidCredentialsProvided() { // 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(FingerprintUserVerificationContext context, FingerprintUserVerificationHandler handler) { // verify user } @Override public void onValidCredentialsProvided() { // 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 Summary
Modifier and TypeMethodDescriptionauthenticatorSelector
(AuthenticatorSelector selector) Specifies the object that will take care of the selection of the authenticator to be used.biometricUserVerifier
(BiometricUserVerifier userVerifier) Specifies the object that will take care of the biometric user verification.devicePasscodeUserVerifier
(DevicePasscodeUserVerifier userVerifier) Specifies the object that will take care of the device passcode user verification.fingerprintUserVerifier
(FingerprintUserVerifier userVerifier) Specifies the object that will take care of the fingerprint user verification.onError
(Consumer<AuthenticationError> errorConsumer) Specifies the object that will be invoked if the authentication failed.onSuccess
(Consumer<AuthorizationProvider> onSuccess) Specifies the object that will be invoked if the authentication was successful.passwordUserVerifier
(PasswordUserVerifier userVerifier) Specifies the object that will take care of the password user verification.pinUserVerifier
(PinUserVerifier userVerifier) Specifies the object that will take care of the PIN user verification.retryPolicyObtainingAuthorizationProvider
(RetryPolicy retryPolicy) The retry policy to be used to obtain anAuthorizationProvider
after the user authenticates successfully.sessionProvider
(SessionProvider sessionProvider) Specifies the session provider that must be used to authenticate.Specifies the username that must be used to authenticate.Methods inherited from interface ch.nevis.mobile.sdk.api.operation.HttpOperation
requestHeaders
-
Method Details
-
username
Specifies the username that must be used to authenticate.Providing the username is required.
- Parameters:
username
- the username- Returns:
- an
Authentication
-
sessionProvider
Specifies the session provider that must be used to authenticate. If noSessionProvider
is given, then anSessionProvider.EmptySessionProvider
will be used.- Parameters:
sessionProvider
- theSessionProvider
- Returns:
- an
Authentication
-
authenticatorSelector
Specifies the object that will take care of the selection of the authenticator to be used.Providing the authenticator selector is required.
- Parameters:
selector
- theAuthenticatorSelector
- Returns:
- an
Authentication
-
pinUserVerifier
Specifies the object that will take care of the PIN user verification.Providing at least one of the
BiometricUserVerifier
,PinUserVerifier
,PasswordUserVerifier
,DevicePasscodeUserVerifier
orFingerprintUserVerifier
is required.- Parameters:
userVerifier
- thePinUserVerifier
- Returns:
- an
Authentication
-
passwordUserVerifier
Specifies the object that will take care of the password user verification.Providing at least one of the
BiometricUserVerifier
,PinUserVerifier
,PasswordUserVerifier
,DevicePasscodeUserVerifier
orFingerprintUserVerifier
is required.- Parameters:
userVerifier
- thePasswordUserVerifier
- Returns:
- an
Authentication
-
fingerprintUserVerifier
Specifies the object that will take care of the fingerprint user verification.Providing at least one of the
BiometricUserVerifier
,PinUserVerifier
,PasswordUserVerifier
,DevicePasscodeUserVerifier
orFingerprintUserVerifier
is required.- Parameters:
userVerifier
- theFingerprintUserVerifier
- Returns:
- an
Authentication
-
biometricUserVerifier
Specifies the object that will take care of the biometric user verification.Providing at least one of the
BiometricUserVerifier
,PinUserVerifier
,PasswordUserVerifier
,DevicePasscodeUserVerifier
orFingerprintUserVerifier
is required.- Parameters:
userVerifier
- theBiometricUserVerifier
- Returns:
- an
Authentication
-
devicePasscodeUserVerifier
Specifies the object that will take care of the device passcode user verification.Providing at least one of the
BiometricUserVerifier
,PinUserVerifier
,PasswordUserVerifier
,DevicePasscodeUserVerifier
orFingerprintUserVerifier
is required.- Parameters:
userVerifier
- theDevicePasscodeUserVerifier
- Returns:
- a
Authentication
-
retryPolicyObtainingAuthorizationProvider
The retry policy to be used to obtain anAuthorizationProvider
after the user authenticates successfully. If obtaining anAuthorizationProvider
fails on the first try, the SDK will retry according to the providedRetryPolicy
. 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 inonError(Consumer)
.- Parameters:
retryPolicy
- the retry policy to be used when retrieving theAuthorizationProvider
. 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 anAuthorizationProvider
. This object will be invoked in the main/UI thread.Providing the object handling the
AuthorizationProvider
is required.- Parameters:
onSuccess
- the consumer of anAuthorizationProvider
- Returns:
- an
Authentication
-
onError
Specifies the object that will be invoked if the authentication failed. The specified object will receive anAuthenticationError
. This object will be invoked in the main/UI thread.Providing the object handling the error is required.
- Parameters:
errorConsumer
- the consumer of anAuthenticationError
- Returns:
- an
Authentication
-