Skip to main content

authenticate

Function authenticate 

Source
pub async fn authenticate(
    endpoint: Data<McpEndpoint>,
    req: ServiceRequest,
    next: Next<impl MessageBody>,
) -> Result<ServiceResponse<EitherBody<impl MessageBody>>, Error>
Expand description

Middleware for the MCP route scope, through actix_web::middleware::from_fn: validates the Bearer token for the MCP audience and puts the McpPrincipal and its TokenSubject in the request extensions, or answers 401 with the challenge that starts the client’s OAuth flow.