pub trait RequestContextExt {
// Required methods
fn with_enhanced_client_id(self, client_id: ClientId) -> Self;
fn extract_client_id(
self,
extractor: &ClientIdExtractor,
headers: Option<&HashMap<String, String>>,
query_params: Option<&HashMap<String, String>>,
) -> Self;
fn get_enhanced_client_id(&self) -> Option<ClientId>;
}Expand description
Extension trait providing structured client-id handling.
The MCP transports capture a raw client_id string, but protocol-aware
code often wants the richer super::client::ClientId enum (which tracks
how the identity was proven — bearer token, session cookie, anonymous, etc.).
This trait bridges the two.
Required Methods§
Sourcefn with_enhanced_client_id(self, client_id: ClientId) -> Self
fn with_enhanced_client_id(self, client_id: ClientId) -> Self
Set client_id from a structured super::client::ClientId and record
the authentication method + authenticated flag in metadata.
Sourcefn extract_client_id(
self,
extractor: &ClientIdExtractor,
headers: Option<&HashMap<String, String>>,
query_params: Option<&HashMap<String, String>>,
) -> Self
fn extract_client_id( self, extractor: &ClientIdExtractor, headers: Option<&HashMap<String, String>>, query_params: Option<&HashMap<String, String>>, ) -> Self
Extract a client ID from headers/query params and apply it via
Self::with_enhanced_client_id.
Sourcefn get_enhanced_client_id(&self) -> Option<ClientId>
fn get_enhanced_client_id(&self) -> Option<ClientId>
Rehydrate the structured super::client::ClientId from the context.
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.