NMAOutOfBandAuthentication
@objc
public protocol NMAOutOfBandAuthentication : NMAHttpOperation
The operation handling an out-of-band authentication.
This is the object returned by the SDK, when an NMAOutOfBandPayload
was processed and the NMAOutOfBandPayload
corresponds to an authentication operation.
Usage example:
@interface NMAAccountSelectorImpl: NSObject <NMAAccountSelector>
@end
@implementation NMAAccountSelectorImpl
- (void)selectAccountWithContext:(id<NMAAccountSelectionContext> _Nonnull)context handler:(id<NMAAccountSelectionHandler> _Nonnull)handler {
[handler username:username];
}
@end
@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
@interface NMAPasswordUserVerifierImpl : NSObject<NMAPasswordUserVerifier>
@end
@implementation NMAPasswordUserVerifierImpl
- (void)verifyPasswordWithContext:(id<NMAPasswordUserVerificationContext> _Nonnull)context handler:(id<NMAPasswordUserVerificationHandler> _Nonnull)handler {
[handler verify:password];
}
@end
id<NMAOutOfBandOperation> oobOperation = [[client operations] outOfBandOperation];
[oobOperation payload:payload];
[oobOperation onRegistration:^(id<NMAOutOfBandRegistration> _Nonnull registration) {...}];
[oobOperation onAuthentication:^(id<NMAOutOfBandAuthentication> _Nonnull authentication) {
[authentication accountSelector:[[NMAAccountSelectorImpl alloc] init]];
[authentication authenticatorSelector:[[NMAAuthenticatorSelectorImpl alloc] init]];
[authentication pinUserVerifier:[[NMAPinUserVerifierImpl alloc] init]];
[authentication biometricUserVerifier:[[NMABiometricUserVerifierImpl alloc] init]];
[authentication devicePasscodeUserVerifier:[[NMADevicePasscodeUserVerifierImpl alloc] init]];
[authentication passwordUserVerifier:[[NMAPasswordUserVerifierImpl alloc] init]];
[authentication onSuccess:^(id<NMAAuthorizationProvider> _Nullable authorizationProvider) {...}];
[authentication onError:^(NMAOperationError * _Nonnull error) {...}];
[authentication execute];
}];
[oobOperation onError:^(NMAOutOfBandOperationError * _Nonnull error) {...}];
[oobOperation execute];
-
Specifies the
NMAAccountSelector
to be used during the out-of-band authentication.Note
Specifying this is only required when username-less authentication and multiple accounts must be supported.Declaration
Swift
@discardableResult func accountSelector(_ accountSelector: NMAAccountSelector) -> NMAOutOfBandAuthentication
Parameters
accountSelector
the
NMAAccountSelector
.Return Value
the
NMAOutOfBandAuthentication
builder. -
Specifies the object that will take care of the selection of the authenticator to be used.
Important
Providing the authenticator selector is required.Declaration
Swift
@discardableResult func authenticatorSelector(_ authenticatorSelector: NMAAuthenticatorSelector) -> NMAOutOfBandAuthentication
Parameters
authenticatorSelector
Return Value
the
NMAOutOfBandAuthentication
builder. -
Specifies the object that will take care of the biometric user verification.
Important
Providing at least one of theNMABiometricUserVerifier
,NMADevicePasscodeUserVerifier
,NMAPinUserVerifier
orNMAPasswordUserVerifier
is required.Declaration
Swift
@discardableResult func biometricUserVerifier(_ biometricUserVerifier: NMABiometricUserVerifier) -> NMAOutOfBandAuthentication
Parameters
biometricUserVerifier
Return Value
the
NMAOutOfBandAuthentication
builder. -
Specifies the object that will take care of the device passcode user verification.
Important
Providing at least one of theNMABiometricUserVerifier
,NMADevicePasscodeUserVerifier
,NMAPinUserVerifier
orNMAPasswordUserVerifier
is required.Declaration
Swift
@discardableResult func devicePasscodeUserVerifier(_ devicePasscodeUserVerifier: NMADevicePasscodeUserVerifier) -> NMAOutOfBandAuthentication
Parameters
devicePasscodeUserVerifier
Return Value
the
NMAOutOfBandAuthentication
builder. -
Specifies the object that will take care of the PIN user verification.
Important
Providing at least one of theNMABiometricUserVerifier
,NMADevicePasscodeUserVerifier
,NMAPinUserVerifier
orNMAPasswordUserVerifier
is required.Declaration
Swift
@discardableResult func pinUserVerifier(_ pinUserVerifier: NMAPinUserVerifier) -> NMAOutOfBandAuthentication
Parameters
pinUserVerifier
the
NMAPinUserVerifier
.Return Value
the
NMAOutOfBandAuthentication
builder. -
Specifies the object that will take care of the password user verification.
Important
Providing at least one of theNMABiometricUserVerifier
,NMADevicePasscodeUserVerifier
,NMAPinUserVerifier
orNMAPasswordUserVerifier
is required.Declaration
Swift
@discardableResult func passwordUserVerifier(_ passwordUserVerifier: NMAPasswordUserVerifier) -> NMAOutOfBandAuthentication
Parameters
passwordUserVerifier
Return Value
the
NMAOutOfBandAuthentication
builder. -
Specifies the block to execute if the authentication was successful.
Important
Providing theonSuccess
block is required.Declaration
Swift
@discardableResult func onSuccess(_ onSuccess: @escaping (NMAAuthorizationProvider?) -> ()) -> NMAOutOfBandAuthentication
Parameters
onSuccess
the block to execute on successful authentication, receives an optional
NMAAuthorizationProvider
.Return Value
the
NMAOutOfBandAuthentication
builder. -
Specifies the block to execute if the authentication failed.
Important
Providing theonError
block is required.Declaration
Swift
@discardableResult func onError(_ onError: @escaping (NMAOperationError) -> ()) -> NMAOutOfBandAuthentication
Parameters
onError
the block to execute on failed authentication, receives an
NMAOperationError
.Return Value
the
NMAOutOfBandAuthentication
builder.