diff --git a/BTCPayServer/Controllers/GreenField/ApiKeysController.cs b/BTCPayServer/Controllers/GreenField/ApiKeysController.cs index a853c6349..b739ae3f0 100644 --- a/BTCPayServer/Controllers/GreenField/ApiKeysController.cs +++ b/BTCPayServer/Controllers/GreenField/ApiKeysController.cs @@ -6,6 +6,7 @@ using BTCPayServer.Data; using BTCPayServer.Security; using BTCPayServer.Security.GreenField; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using NBitcoin; @@ -15,6 +16,7 @@ namespace BTCPayServer.Controllers.GreenField { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.GreenfieldAPIKeys)] + [EnableCors(CorsPolicies.All)] public class ApiKeysController : ControllerBase { private readonly APIKeyRepository _apiKeyRepository; diff --git a/BTCPayServer/Controllers/GreenField/HealthController.cs b/BTCPayServer/Controllers/GreenField/HealthController.cs index b454dcd29..f8756c296 100644 --- a/BTCPayServer/Controllers/GreenField/HealthController.cs +++ b/BTCPayServer/Controllers/GreenField/HealthController.cs @@ -1,11 +1,13 @@ using BTCPayServer.Client.Models; using BTCPayServer.HostedServices; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; namespace BTCPayServer.Controllers.GreenField { [Controller] + [EnableCors(CorsPolicies.All)] public class HealthController : ControllerBase { [AllowAnonymous] diff --git a/BTCPayServer/Controllers/GreenField/LightningNodeApiController.Internal.cs b/BTCPayServer/Controllers/GreenField/LightningNodeApiController.Internal.cs index 6601793a3..ceb006127 100644 --- a/BTCPayServer/Controllers/GreenField/LightningNodeApiController.Internal.cs +++ b/BTCPayServer/Controllers/GreenField/LightningNodeApiController.Internal.cs @@ -7,6 +7,7 @@ using BTCPayServer.Lightning; using BTCPayServer.Security; using BTCPayServer.Services; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; namespace BTCPayServer.Controllers.GreenField @@ -14,6 +15,7 @@ namespace BTCPayServer.Controllers.GreenField [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] [LightningUnavailableExceptionFilter] + [EnableCors(CorsPolicies.All)] public class InternalLightningNodeApiController : LightningNodeApiController { private readonly BTCPayServerOptions _btcPayServerOptions; diff --git a/BTCPayServer/Controllers/GreenField/LightningNodeApiController.Store.cs b/BTCPayServer/Controllers/GreenField/LightningNodeApiController.Store.cs index 342ba0d5a..d36a3ef75 100644 --- a/BTCPayServer/Controllers/GreenField/LightningNodeApiController.Store.cs +++ b/BTCPayServer/Controllers/GreenField/LightningNodeApiController.Store.cs @@ -11,6 +11,7 @@ using BTCPayServer.Payments.Lightning; using BTCPayServer.Security; using BTCPayServer.Services; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; namespace BTCPayServer.Controllers.GreenField @@ -18,6 +19,7 @@ namespace BTCPayServer.Controllers.GreenField [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] [LightningUnavailableExceptionFilter] + [EnableCors(CorsPolicies.All)] public class StoreLightningNodeApiController : LightningNodeApiController { private readonly BTCPayServerOptions _btcPayServerOptions; diff --git a/BTCPayServer/Controllers/GreenField/PaymentRequestsController.cs b/BTCPayServer/Controllers/GreenField/PaymentRequestsController.cs index cd381f2a8..4f25999dc 100644 --- a/BTCPayServer/Controllers/GreenField/PaymentRequestsController.cs +++ b/BTCPayServer/Controllers/GreenField/PaymentRequestsController.cs @@ -9,6 +9,7 @@ using BTCPayServer.Security; using BTCPayServer.Services.PaymentRequests; using BTCPayServer.Services.Rates; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using PaymentRequestData = BTCPayServer.Data.PaymentRequestData; @@ -16,6 +17,7 @@ namespace BTCPayServer.Controllers.GreenField { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenFieldPaymentRequestsController : ControllerBase { private readonly PaymentRequestRepository _paymentRequestRepository; diff --git a/BTCPayServer/Controllers/GreenField/PullPaymentController.cs b/BTCPayServer/Controllers/GreenField/PullPaymentController.cs index 8d60e9d1f..e49bac3f5 100644 --- a/BTCPayServer/Controllers/GreenField/PullPaymentController.cs +++ b/BTCPayServer/Controllers/GreenField/PullPaymentController.cs @@ -12,6 +12,7 @@ using BTCPayServer.Security; using BTCPayServer.Services; using BTCPayServer.Services.Rates; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using Microsoft.EntityFrameworkCore; @@ -20,6 +21,7 @@ namespace BTCPayServer.Controllers.GreenField { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldPullPaymentController : ControllerBase { private readonly PullPaymentHostedService _pullPaymentService; diff --git a/BTCPayServer/Controllers/GreenField/ServerInfoController.cs b/BTCPayServer/Controllers/GreenField/ServerInfoController.cs index 6f93923af..6f965ca78 100644 --- a/BTCPayServer/Controllers/GreenField/ServerInfoController.cs +++ b/BTCPayServer/Controllers/GreenField/ServerInfoController.cs @@ -8,6 +8,7 @@ using BTCPayServer.Services; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using NBXplorer.Models; @@ -15,6 +16,7 @@ using NBXplorer.Models; namespace BTCPayServer.Controllers.GreenField { [ApiController] + [EnableCors(CorsPolicies.All)] public class GreenFieldServerInfoController : Controller { private readonly BTCPayServerEnvironment _env; diff --git a/BTCPayServer/Controllers/GreenField/StoresController.cs b/BTCPayServer/Controllers/GreenField/StoresController.cs index bc4b54e05..8ae2a6199 100644 --- a/BTCPayServer/Controllers/GreenField/StoresController.cs +++ b/BTCPayServer/Controllers/GreenField/StoresController.cs @@ -8,6 +8,7 @@ using BTCPayServer.Data; using BTCPayServer.Security; using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; @@ -15,6 +16,7 @@ namespace BTCPayServer.Controllers.GreenField { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenFieldController : ControllerBase { private readonly StoreRepository _storeRepository; diff --git a/BTCPayServer/Controllers/GreenField/UsersController.cs b/BTCPayServer/Controllers/GreenField/UsersController.cs index 14bc1202a..94adf201f 100644 --- a/BTCPayServer/Controllers/GreenField/UsersController.cs +++ b/BTCPayServer/Controllers/GreenField/UsersController.cs @@ -11,6 +11,7 @@ using BTCPayServer.Security; using BTCPayServer.Security.GreenField; using BTCPayServer.Services; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; @@ -20,6 +21,7 @@ namespace BTCPayServer.Controllers.GreenField { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class UsersController : ControllerBase { private readonly UserManager _userManager; diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.api-keys.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.api-keys.json index 38981d5f9..a8ad382f5 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.api-keys.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.api-keys.json @@ -41,8 +41,14 @@ "description": "View information about the current API key", "responses": { "200": { - "description": "The key has been deleted" - } + "description": "Information about the current api key", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiKeyData" + } + } + } }, "security": [ {