Enable CORS on all endpoints

This commit is contained in:
2023-11-28 10:02:30 -05:00
parent 3baec7137c
commit 457a2f1724
7 changed files with 31 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ public class ApiKeyCanReadAttribute : ActionFilterAttribute
var apiKey = context.HttpContext.Request.Headers["X-API-KEY"];
// Validate the API key using the IApiKeyValidator service
if (string.IsNullOrEmpty(apiKey) || !apiKeyValidator.CanRead(apiKey))
if (!apiKeyValidator.CanRead(apiKey))
{
// If the API key is invalid, set the response status code to 401 Unauthorized
context.Result = new UnauthorizedResult();

View File

@@ -14,7 +14,7 @@ public class ApiKeyCanWriteAttribute : ActionFilterAttribute
var apiKey = context.HttpContext.Request.Headers["X-API-KEY"];
// Validate the API key using the IApiKeyValidator service
if (string.IsNullOrEmpty(apiKey) || !apiKeyValidator.CanWrite(apiKey))
if (!apiKeyValidator.CanWrite(apiKey))
{
// If the API key is invalid, set the response status code to 401 Unauthorized
context.Result = new UnauthorizedResult();