pub async fn api_key_auth_middleware(
config: ApiKeyConfig,
headers: HeaderMap,
request: Request<Body>,
next: Next,
) -> Result<Response, Response>Expand description
API Key authentication middleware
Validates API keys from a custom header (default: X-API-Key) or query parameter. Checks header first, then query parameter as fallback. On success, the request proceeds to the next handler. On failure, returns 401 Unauthorized with RFC 9457 Problem Details.
Coverage: Tested via integration tests (auth_integration.rs)
ยงErrors
Returns an error response when the API key is missing or invalid.