pub struct MfaManager<S: MfaStorage> { /* private fields */ }
Expand description
MFA manager for handling multi-factor authentication
Implementations§
Source§impl<S: MfaStorage> MfaManager<S>
impl<S: MfaStorage> MfaManager<S>
Sourcepub fn with_sms_provider(self, provider: Box<dyn SmsProvider>) -> Self
pub fn with_sms_provider(self, provider: Box<dyn SmsProvider>) -> Self
Set SMS provider
Sourcepub fn with_email_provider(self, provider: Box<dyn EmailProvider>) -> Self
pub fn with_email_provider(self, provider: Box<dyn EmailProvider>) -> Self
Set email provider
Sourcepub async fn setup_totp(
&self,
user_id: &str,
user_identifier: &str,
) -> Result<UserMfaMethod>
pub async fn setup_totp( &self, user_id: &str, user_identifier: &str, ) -> Result<UserMfaMethod>
Setup TOTP for a user
Sourcepub async fn setup_sms(
&self,
user_id: &str,
phone_number: &str,
) -> Result<UserMfaMethod>
pub async fn setup_sms( &self, user_id: &str, phone_number: &str, ) -> Result<UserMfaMethod>
Setup SMS MFA for a user
Sourcepub async fn generate_backup_codes(
&self,
user_id: &str,
) -> Result<(UserMfaMethod, Vec<String>)>
pub async fn generate_backup_codes( &self, user_id: &str, ) -> Result<(UserMfaMethod, Vec<String>)>
Generate backup codes for a user
Sourcepub async fn create_challenge(
&self,
user_id: &str,
method_type: MfaMethodType,
) -> Result<MfaChallenge>
pub async fn create_challenge( &self, user_id: &str, method_type: MfaMethodType, ) -> Result<MfaChallenge>
Create MFA challenge for user
Sourcepub async fn verify_challenge(
&self,
challenge_id: &str,
response: &str,
) -> Result<MfaVerificationResult>
pub async fn verify_challenge( &self, challenge_id: &str, response: &str, ) -> Result<MfaVerificationResult>
Verify MFA challenge
Sourcepub async fn has_mfa_enabled(&self, user_id: &str) -> Result<bool>
pub async fn has_mfa_enabled(&self, user_id: &str) -> Result<bool>
Check if user has MFA enabled
Sourcepub async fn get_enabled_methods(
&self,
user_id: &str,
) -> Result<Vec<MfaMethodType>>
pub async fn get_enabled_methods( &self, user_id: &str, ) -> Result<Vec<MfaMethodType>>
Get user’s enabled MFA methods
Auto Trait Implementations§
impl<S> Freeze for MfaManager<S>where
S: Freeze,
impl<S> !RefUnwindSafe for MfaManager<S>
impl<S> Send for MfaManager<S>
impl<S> Sync for MfaManager<S>
impl<S> Unpin for MfaManager<S>where
S: Unpin,
impl<S> !UnwindSafe for MfaManager<S>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more