Skip to main content

Authenticator

Trait Authenticator 

Source
pub trait Authenticator {
    // Required method
    fn authenticate(
        &mut self,
    ) -> impl Future<Output = AuthResult<UserProfile>> + Send;

    // Provided methods
    fn verify(
        &self,
        token: &str,
    ) -> impl Future<Output = AuthResult<UserProfile>> + Send { ... }
    fn logout(&self, token: &str) -> impl Future<Output = AuthResult<()>> + Send { ... }
}
Expand description

Core authentication trait implemented by every provider.

Required Methods§

Source

fn authenticate( &mut self, ) -> impl Future<Output = AuthResult<UserProfile>> + Send

Authenticate a user and return their profile.

Provided Methods§

Source

fn verify( &self, token: &str, ) -> impl Future<Output = AuthResult<UserProfile>> + Send

Verify if a token is still valid.

Source

fn logout(&self, token: &str) -> impl Future<Output = AuthResult<()>> + Send

Logout and invalidate the token.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§