Skip to main content

AuthContextProvider

Trait AuthContextProvider 

Source
pub trait AuthContextProvider: Send + Sync {
    // Required method
    fn current<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Option<AuthContext>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Extracts or provides the current caller’s AuthContext.

Implement this in your HTTP middleware or request-scope container so that ServicePermissionGuard can retrieve the auth context without being coupled to Axum or any other framework.

Required Methods§

Source

fn current<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<AuthContext>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§