AuthHandler provides a unified authentication layer supporting HTTP Basic Auth,
Bearer tokens, and API keys. It integrates with both FastAPI (as a dependency) and
Flask (as a decorator), and is used internally by the
mcp-gateway and agent
webhook endpoints.
A SecurityConfig
instance that provides the authentication credentials. The handler reads:
get_basic_auth()bearer_token attribute (if set)api_key and api_key_header attributes (if set)Flask decorator for protecting routes with authentication.
Get a summary of configured authentication methods.
Get a FastAPI dependency function for protecting routes.
Verify an API key using constant-time comparison.
Verify HTTP Basic Auth credentials using constant-time comparison.
Verify a Bearer token using constant-time comparison.