Skip to main content

AuthProvider

Trait AuthProvider 

Source
pub trait AuthProvider: Send + Sync {
    // Required method
    fn authenticate(
        &self,
        ctx: &McpContext,
        request: AuthRequest<'_>,
    ) -> McpResult<AuthContext>;
}
Expand description

Authentication provider interface.

Implementations decide whether a request is allowed and may return an AuthContext describing the authenticated subject.

Required Methods§

Source

fn authenticate( &self, ctx: &McpContext, request: AuthRequest<'_>, ) -> McpResult<AuthContext>

Authenticate an incoming request.

Return Ok(AuthContext) to allow, or an Err(McpError) to deny.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§