AuthMiddleware

Trait AuthMiddleware 

Source
pub trait AuthMiddleware: Send + Sync {
    // Required methods
    fn extract_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        headers: &'life1 HashMap<String, String>,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn handle_auth_failure<'life0, 'async_trait>(
        &'life0 self,
        error: McpError,
    ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Authentication middleware trait

Required Methods§

Source

fn extract_token<'life0, 'life1, 'async_trait>( &'life0 self, headers: &'life1 HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Extract authentication token from request

Source

fn handle_auth_failure<'life0, 'async_trait>( &'life0 self, error: McpError, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle authentication failure

Implementors§