AuthExt

Trait AuthExt 

Source
pub trait AuthExt {
    // Required method
    fn auth_context<C: Clone + Send + Sync + 'static>(
        &self,
    ) -> Option<&AuthContext<C>>;

    // Provided method
    fn claims<C: Clone + Send + Sync + 'static>(&self) -> Option<&C> { ... }
}
Available on crate features auth and auth-axum only.
Expand description

Extension trait for extracting auth context from request extensions.

Required Methods§

Source

fn auth_context<C: Clone + Send + Sync + 'static>( &self, ) -> Option<&AuthContext<C>>

Get the auth context if present.

Provided Methods§

Source

fn claims<C: Clone + Send + Sync + 'static>(&self) -> Option<&C>

Get the claims if authenticated.

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.

Implementations on Foreign Types§

Source§

impl<B> AuthExt for Request<B>

Source§

fn auth_context<C: Clone + Send + Sync + 'static>( &self, ) -> Option<&AuthContext<C>>

Available on crate feature auth-axum only.

Implementors§