Skip to main content

HttpAuthProvider

Trait HttpAuthProvider 

Source
pub trait HttpAuthProvider:
    Send
    + Sync
    + 'static {
    // Required method
    fn apply<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        headers: &'life1 mut HeaderMap,
        query: &'life2 mut HashMap<String, String>,
        inbound_token: Option<&'life3 str>,
    ) -> Pin<Box<dyn Future<Output = Result<(), HttpConnectorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Outbound HTTP authentication provider (OAPI-03).

DISTINCT from the inbound [crate::auth::AuthProvider] (Pitfall 1): this MUTATES the outgoing request. apply accepts an OPTIONAL inbound_token — the per-request MCP client token captured via the AuthContext bridge (H1). Static providers ignore it; the passthrough provider forwards it.

Required Methods§

Source

fn apply<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, headers: &'life1 mut HeaderMap, query: &'life2 mut HashMap<String, String>, inbound_token: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<(), HttpConnectorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Apply credentials to the outgoing request’s headers and query.

inbound_token is the per-request MCP client token (when present). Static providers MUST ignore it; OAuthPassthroughAuth forwards it.

§Errors

Returns HttpConnectorError::Auth when a required credential is absent, or HttpConnectorError::InvalidHeader when a header name/value cannot be constructed. No error message echoes the token or credential value.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§