Class ApiKeyHttpMiddleware
Enforces x-api-key on the HTTP surface (the hand-written minimal-API
endpoints such as /v1/grpc/call, the OpenAPI/Scalar docs, and
JSON-transcoded gRPC). Native gRPC and gRPC-web calls carry their own
ApiKeyInterceptor and are skipped here so they keep proper
gRPC status codes. Health probes stay open.
Without this, exposing the gRPC port through an ingress would also expose those HTTP endpoints — which bypass the gRPC interceptor entirely — with no authentication. Active only when Enabled.
public sealed class ApiKeyHttpMiddleware
- Inheritance
-
ApiKeyHttpMiddleware
- Inherited Members
Constructors
ApiKeyHttpMiddleware(RequestDelegate, ApiKeyAuthOptions, ILogger<ApiKeyHttpMiddleware>)
public ApiKeyHttpMiddleware(RequestDelegate next, ApiKeyAuthOptions options, ILogger<ApiKeyHttpMiddleware> logger)
Parameters
nextRequestDelegateoptionsApiKeyAuthOptionsloggerILogger<ApiKeyHttpMiddleware>
Methods
InvokeAsync(HttpContext)
public Task InvokeAsync(HttpContext context)
Parameters
contextHttpContext