diff --git a/src/Nager.FirewallManagement/Middlewares/ApiKeyMiddleware.cs b/src/Nager.FirewallManagement/Middlewares/ApiKeyMiddleware.cs index 374eae4..06af3b5 100644 --- a/src/Nager.FirewallManagement/Middlewares/ApiKeyMiddleware.cs +++ b/src/Nager.FirewallManagement/Middlewares/ApiKeyMiddleware.cs @@ -33,16 +33,16 @@ public async Task InvokeAsync(HttpContext context) return; } - if (!context.Request.Headers.TryGetValue(ApiKeyHeaderName, out var potentialApiKey)) + if (!context.Request.Headers.TryGetValue(ApiKeyHeaderName, out var receivedApiKey)) { context.Response.StatusCode = StatusCodes.Status401Unauthorized; return; } var configuration = context.RequestServices.GetRequiredService(); - var apiKey = configuration.GetValue("ApiKey"); + var expectedApiKey = configuration.GetValue("ApiKey"); - if (!apiKey.Equals(potentialApiKey)) + if (!expectedApiKey.Equals(receivedApiKey)) { var remoteIpAddress = context.Connection.RemoteIpAddress; if (remoteIpAddress != null)