Skip to main content

Auth

Trait Auth 

Source
pub trait Auth: Send + Sync {
    // Required method
    fn identify<'life0, 'life1, 'async_trait>(
        &'life0 self,
        headers: &'life1 HeaderMap,
    ) -> Pin<Box<dyn Future<Output = Result<Caller, AuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Turns a request’s headers into the caller they speak for.

Headers rather than an extractor so the port is object-safe and can be exercised without an HTTP stack; the extractor is built on top.

Required Methods§

Source

fn identify<'life0, 'life1, 'async_trait>( &'life0 self, headers: &'life1 HeaderMap, ) -> Pin<Box<dyn Future<Output = Result<Caller, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Identifies the caller.

§Errors

AuthError::NotVerified when a credential was presented and did not verify, and AuthError::Unavailable when the verifier could not answer. A request with no credential is Ok(Caller::Anonymous), never an error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: Auth + ?Sized> Auth for Arc<T>

Source§

fn identify<'life0, 'life1, 'async_trait>( &'life0 self, headers: &'life1 HeaderMap, ) -> Pin<Box<dyn Future<Output = Result<Caller, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§