pub trait AuthConfirmationHandler: Sized {
// Required method
fn handle_confirmation(
self,
allowed_confirmations: &[ConfirmationMethod],
) -> impl Future<Output = Option<ConfirmationAction>> + Send;
// Provided method
fn or<Right: AuthConfirmationHandler>(
self,
other: Right,
) -> EitherConfirmationHandler<Self, Right> { ... }
}Expand description
A trait for handling login confirmations
The library comes with handlers for:
- Asking for a code from the terminal:
ConsoleAuthConfirmationHandler. - Generating a code from the pre-shared secret:
SharedSecretAuthConfirmationHandler. - Waiting for the user to confirm the login from the mobile app:
DeviceConfirmationHandler.
Additionally, apps can implement the trait to integrate the confirmation flow into the app.
Required Methods§
Sourcefn handle_confirmation(
self,
allowed_confirmations: &[ConfirmationMethod],
) -> impl Future<Output = Option<ConfirmationAction>> + Send
fn handle_confirmation( self, allowed_confirmations: &[ConfirmationMethod], ) -> impl Future<Output = Option<ConfirmationAction>> + Send
Perform the confirmation action given a list of allowed confirmations for the login
If the confirmation handler supports any of the allowed confirmations,
it returns a ConfirmationAction with the required action.
If the confirmation handler does not support any of the allowed confirmations it returns None.
If no confirmation handler supports the allowed confirmations the login will fail.
Provided Methods§
Sourcefn or<Right: AuthConfirmationHandler>(
self,
other: Right,
) -> EitherConfirmationHandler<Self, Right>
fn or<Right: AuthConfirmationHandler>( self, other: Right, ) -> EitherConfirmationHandler<Self, Right>
Return a new confirmation handler that combines the current one with a new one.
The resulting confirmation handler will handle both handler in parallel.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.