NMAAuthentication

@objc
public protocol NMAAuthentication : NMAHttpOperation

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

Usage example:

@interface NMAAuthenticatorSelectorImpl : NSObject <NMAAuthenticatorSelector>

@end

@implementation NMAAuthenticatorSelectorImpl

- (void)selectAuthenticatorWithContext:(id<NMAAuthenticatorSelectionContext> _Nonnull)context handler:(id<NMAAuthenticatorSelectionHandler> _Nonnull)handler {
    [handler aaid:aaid];
}

@end

@interface NMABiometricUserVerifierImpl : NSObject <NMABiometricUserVerifier>

@end

@implementation NMABiometricUserVerifierImpl

- (void)verifyBiometricWithContext:(id<NMABiometricUserVerificationContext> _Nonnull)context handler:(id<NMABiometricUserVerificationHandler> _Nonnull)handler {
    [handler verify];
}

@end

@interface NMADevicePasscodeUserVerifierImpl : NSObject <NMADevicePasscodeUserVerifier>

@end

@implementation NMADevicePasscodeUserVerifierImpl

- (void)verifyDevicePasscodeWithContext:(id<NMADevicePasscodeUserVerificationContext> _Nonnull)context handler:(id<NMADevicePasscodeUserVerificationHandler> _Nonnull)handler {
    [handler verify];
}

@end

@interface NMAPinUserVerifierImpl : NSObject<NMAPinUserVerifier>

@end

@implementation NMAPinUserVerifierImpl

- (void)verifyPinWithContext:(id<NMAPinUserVerificationContext> _Nonnull)context handler:(id<NMAPinUserVerificationHandler> _Nonnull)handler {
    [handler verify:pin];
}

@end

id<NMAAuthentication> authentication = [[client operations] authentication];

[authentication username:username];
[authentication authenticatorSelector:[[NMAAuthenticatorSelectorImpl alloc] init]];
[authentication biometricUserVerifier:[[NMABiometricUserVerifierImpl alloc] init]];
[authentication devicePasscodeUserVerifier:[[NMADevicePasscodeUserVerifierImpl alloc] init]];
[authentication pinUserVerifier:[[NMAPinUserVerifierImpl alloc] init]];
[authentication onSuccess:^(id<NMAAuthorizationProvider> _Nullable authorizationProvider) {...}];
[authentication onError:^(NMAOperationError * _Nonnull error) {...}];
[authentication execute];