Skip to main content

AuthMethod

Trait AuthMethod 

Source
pub trait AuthMethod: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn authenticate<'life0, 'async_trait>(
        &'life0 self,
        input: AuthInput,
    ) -> Pin<Box<dyn Future<Output = Result<Identity, AuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn has_enrolled<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _user_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, AuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn is_mfa_equivalent(&self) -> bool { ... }
}
Expand description

A mechanism used to authenticate a user.

Required Methods§

Source

fn name(&self) -> &str

Returns the name of the authentication method.

Source

fn authenticate<'life0, 'async_trait>( &'life0 self, input: AuthInput, ) -> Pin<Box<dyn Future<Output = Result<Identity, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Authenticate a user with the given input.

Provided Methods§

Source

fn has_enrolled<'life0, 'life1, 'async_trait>( &'life0 self, _user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a given user has enrolled in this authentication method. Default implementation returns false.

Source

fn is_mfa_equivalent(&self) -> bool

Indicates whether this method provides multi-factor-equivalent security. If true, users logging in with this method will not be prompted for an additional MFA step. Default implementation returns false.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§