Enable CORS on all endpoints
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user