Skip to main content

AuthStrategy

Trait AuthStrategy 

Source
pub trait AuthStrategy:
    Send
    + Sync
    + 'static {
    type Payload: Send + Sync + 'static;

    // Required method
    fn validate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        parts: &'life1 Parts,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Payload, AuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Auth strategy contract similar to Nest’s Passport strategy adapters.

A guard can delegate token/header parsing + claim validation to a strategy and map failures to GuardError::Unauthorized.

Required Associated Types§

Source

type Payload: Send + Sync + 'static

Required Methods§

Source

fn validate<'life0, 'life1, 'async_trait>( &'life0 self, parts: &'life1 Parts, ) -> Pin<Box<dyn Future<Output = Result<Self::Payload, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§