OutOfBandAuthentication
public protocol OutOfBandAuthentication : HttpOperation
The operation handling an out-of-band authentication.
This is the object returned by the SDK, when an OutOfBandPayload
was processed and the OutOfBandPayload
corresponds to an authentication operation.
Usage example:
class AccountSelectorImpl: AccountSelector {
func selectAccount(context: AccountSelectionContext, handler: AccountSelectionHandler) {
handler.username(username)
}
}
class AuthenticatorSelectorImpl: AuthenticatorSelector {
func selectAuthenticator(context: AuthenticatorSelectionContext, handler: AuthenticatorSelectionHandler) {
handler.aaid(aaid)
}
}
class BiometricUserVerifierImpl: BiometricUserVerifier {
func verifyBiometric(context: BiometricUserVerificationContext, handler: BiometricUserVerificationHandler) {
handler.verify()
}
}
class DevicePasscodeUserVerifierImpl: DevicePasscodeUserVerifier {
func verifyDevicePasscode(context: DevicePasscodeUserVerificationContext, handler: DevicePasscodeUserVerificationHandler) {
handler.verify()
}
}
class PinUserVerifierImpl: PinUserVerifier {
func verifyPin(context: PinUserVerificationContext, handler: PinUserVerificationHandler) {
handler.verify(pin: pin)
}
}
class PasswordUserVerifierImpl: PasswordUserVerifier {
func verifyPassword(context: PasswordUserVerificationContext, handler: PasswordUserVerificationHandler) {
handler.verify(password: password)
}
}
client.operations.outOfBandOperation
.payload(payload)
.onRegistration { oobRegistration in
...
}
.onAuthentication { oobAuthentication in
oobAuthentication
.accountSelector(AccountSelectorImpl(...))
.authenticatorSelector(AuthenticatorSelectorImpl(...))
.biometricUserVerifier(BiometricUserVerifierImpl(...))
.devicePasscodeUserVerifier(DevicePasscodeUserVerifierImpl(...))
.pinUserVerifier(PinUserVerifierImpl(...))
.passwordUserVerifier(PasswordUserVerifierImpl(...))
.onError { error in
...
}
.onSuccess {
...
}
.execute()
}
.onError { error in
...
}
.execute()
-
Specifies the
AccountSelector
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: AccountSelector) -> OutOfBandAuthentication
Parameters
accountSelector
the
AccountSelector
.Return Value
the
OutOfBandAuthentication
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: AuthenticatorSelector) -> Self
Parameters
authenticatorSelector
Return Value
the
OutOfBandAuthentication
builder. -
Specifies the object that will take care of the biometric user verification.
Important
Providing at least one of theBiometricUserVerifier
,DevicePasscodeUserVerifier
,PinUserVerifier
orPasswordUserVerifier
is required.Declaration
Swift
@discardableResult func biometricUserVerifier(_ biometricUserVerifier: BiometricUserVerifier) -> Self
Parameters
biometricUserVerifier
Return Value
the
OutOfBandAuthentication
builder. -
Specifies the object that will take care of the device passcode user verification.
Important
Providing at least one of theBiometricUserVerifier
,DevicePasscodeUserVerifier
,PinUserVerifier
orPasswordUserVerifier
is required.Declaration
Swift
@discardableResult func devicePasscodeUserVerifier(_ devicePasscodeUserVerifier: DevicePasscodeUserVerifier) -> Self
Parameters
devicePasscodeUserVerifier
Return Value
the
OutOfBandAuthentication
builder. -
Specifies the object that will take care of the PIN user verification.
Important
Providing at least one of theBiometricUserVerifier
,DevicePasscodeUserVerifier
,PinUserVerifier
orPasswordUserVerifier
is required.Declaration
Swift
@discardableResult func pinUserVerifier(_ pinUserVerifier: PinUserVerifier) -> OutOfBandAuthentication
Parameters
pinUserVerifier
the
PinUserVerifier
.Return Value
the
OutOfBandAuthentication
builder. -
Specifies the object that will take care of the password user verification.
Important
Providing at least one of theBiometricUserVerifier
,DevicePasscodeUserVerifier
,PinUserVerifier
orPasswordUserVerifier
is required.Declaration
Swift
@discardableResult func passwordUserVerifier(_ passwordUserVerifier: PasswordUserVerifier) -> OutOfBandAuthentication
Parameters
passwordUserVerifier
the
PasswordUserVerifier
.Return Value
the
OutOfBandAuthentication
builder. -
Specifies the block to execute if the authentication was successful. This object will be invoked in the
DispatchQueue.main
thread.Important
Providing theonSuccess
block is required.Declaration
Swift
@discardableResult func onSuccess(_ onSuccess: @escaping (AuthorizationProvider?) -> ()) -> OutOfBandAuthentication
Parameters
onSuccess
the block to execute on successful authentication, receives an optional
AuthorizationProvider
.Return Value
the
OutOfBandAuthentication
builder. -
Specifies the block to execute if the authentication failed. This object will be invoked in the
DispatchQueue.main
thread.Important
Providing theonError
block is required.Declaration
Swift
@discardableResult func onError(_ onError: @escaping (OperationError) -> ()) -> OutOfBandAuthentication
Parameters
onError
the block to execute on failed authentication, receives an
OperationError
.Return Value
the
OutOfBandAuthentication
builder.