AuthProvider

Trait AuthProvider 

Source
pub trait AuthProvider: Send + Sync {
    // Required methods
    fn extract_context<'life0, 'life1, 'async_trait, B>(
        &'life0 self,
        req: &'life1 Request<B>,
    ) -> Pin<Box<dyn Future<Output = Result<AuthContext>> + Send + 'async_trait>>
       where B: 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_owner<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        user_id: &'life1 Uuid,
        resource_id: &'life2 Uuid,
        resource_type: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn has_role<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 Uuid,
        role: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for auth providers

Required Methods§

Source

fn extract_context<'life0, 'life1, 'async_trait, B>( &'life0 self, req: &'life1 Request<B>, ) -> Pin<Box<dyn Future<Output = Result<AuthContext>> + Send + 'async_trait>>
where B: 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Extract auth context from HTTP request

Source

fn is_owner<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: &'life1 Uuid, resource_id: &'life2 Uuid, resource_type: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Check if user is owner of a resource

Source

fn has_role<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 Uuid, role: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check if user has a role

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§