diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldPayoutProcessorsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldPayoutProcessorsController.cs index d33be55d7..b92d90502 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldPayoutProcessorsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldPayoutProcessorsController.cs @@ -9,6 +9,7 @@ using BTCPayServer.Data; using BTCPayServer.PayoutProcessors; using BTCPayServer.Security; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using StoreData = BTCPayServer.Data.StoreData; using PayoutProcessorData = BTCPayServer.Client.Models.PayoutProcessorData; @@ -17,6 +18,7 @@ namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldPayoutProcessorsController : ControllerBase { private readonly IEnumerable _factories; diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedLightningPayoutProcessorsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedLightningPayoutProcessorsController.cs index 31f78fb0f..940c05779 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedLightningPayoutProcessorsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedLightningPayoutProcessorsController.cs @@ -10,6 +10,7 @@ using BTCPayServer.PayoutProcessors; using BTCPayServer.PayoutProcessors.Lightning; using BTCPayServer.Services.Invoices; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using PayoutProcessorData = BTCPayServer.Data.PayoutProcessorData; @@ -17,6 +18,7 @@ namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldStoreAutomatedLightningPayoutProcessorsController : ControllerBase { private readonly PayoutProcessorService _payoutProcessorService; diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedOnChainPayoutProcessorsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedOnChainPayoutProcessorsController.cs index 6705727e9..ff5571e21 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedOnChainPayoutProcessorsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedOnChainPayoutProcessorsController.cs @@ -10,6 +10,7 @@ using BTCPayServer.PayoutProcessors; using BTCPayServer.PayoutProcessors.OnChain; using BTCPayServer.Services.Invoices; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using PayoutProcessorData = BTCPayServer.Data.PayoutProcessorData; @@ -17,6 +18,7 @@ namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldStoreAutomatedOnChainPayoutProcessorsController : ControllerBase { private readonly PayoutProcessorService _payoutProcessorService; diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLNURLPayPaymentMethodsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLNURLPayPaymentMethodsController.cs index 528bc4ee0..3f8283ae4 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLNURLPayPaymentMethodsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLNURLPayPaymentMethodsController.cs @@ -17,6 +17,7 @@ using BTCPayServer.Payments.Lightning; using BTCPayServer.Security; using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using StoreData = BTCPayServer.Data.StoreData; @@ -25,24 +26,19 @@ namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldStoreLNURLPayPaymentMethodsController : ControllerBase { private StoreData Store => HttpContext.GetStoreData(); private readonly StoreRepository _storeRepository; private readonly BTCPayNetworkProvider _btcPayNetworkProvider; - private readonly IAuthorizationService _authorizationService; - private readonly ISettingsRepository _settingsRepository; public GreenfieldStoreLNURLPayPaymentMethodsController( StoreRepository storeRepository, - BTCPayNetworkProvider btcPayNetworkProvider, - IAuthorizationService authorizationService, - ISettingsRepository settingsRepository) + BTCPayNetworkProvider btcPayNetworkProvider) { _storeRepository = storeRepository; _btcPayNetworkProvider = btcPayNetworkProvider; - _authorizationService = authorizationService; - _settingsRepository = settingsRepository; } public static IEnumerable GetLNURLPayPaymentMethods(StoreData store, diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningAddressesController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningAddressesController.cs index bfc08acbe..2f569da4b 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningAddressesController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningAddressesController.cs @@ -6,6 +6,7 @@ using BTCPayServer.Abstractions.Extensions; using BTCPayServer.Client; using BTCPayServer.Data; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using AuthenticationSchemes = BTCPayServer.Abstractions.Constants.AuthenticationSchemes; using LightningAddressData = BTCPayServer.Client.Models.LightningAddressData; @@ -14,6 +15,7 @@ namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldStoreLightningAddressesController : ControllerBase { private readonly LightningAddressService _lightningAddressService; diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningNetworkPaymentMethodsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningNetworkPaymentMethodsController.cs index 172931cb3..c1e13c9bc 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningNetworkPaymentMethodsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningNetworkPaymentMethodsController.cs @@ -18,6 +18,7 @@ using BTCPayServer.Security; using BTCPayServer.Services; using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using StoreData = BTCPayServer.Data.StoreData; @@ -26,6 +27,7 @@ namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldStoreLightningNetworkPaymentMethodsController : ControllerBase { private StoreData Store => HttpContext.GetStoreData(); diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs index ae1e31750..b19010384 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs @@ -8,6 +8,7 @@ using BTCPayServer.Data; using BTCPayServer.Events; using BTCPayServer.Payments; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using NBXplorer.Models; @@ -17,6 +18,7 @@ namespace BTCPayServer.Controllers.Greenfield { [Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Greenfield)] [HttpPost("~/api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/generate")] + [EnableCors(CorsPolicies.All)] public async Task GenerateOnChainWallet(string storeId, string cryptoCode, GenerateWalletRequest request) { diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs index 03e7528f8..955935ab6 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs @@ -14,6 +14,7 @@ using BTCPayServer.Services; using BTCPayServer.Services.Stores; using BTCPayServer.Services.Wallets; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using NBitcoin; using NBXplorer.DerivationStrategy; @@ -24,6 +25,7 @@ namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public partial class GreenfieldStoreOnChainPaymentMethodsController : ControllerBase { private StoreData Store => HttpContext.GetStoreData(); diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs index d7913fcb6..16c430321 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs @@ -8,6 +8,7 @@ using BTCPayServer.Client.Models; using BTCPayServer.Data; using BTCPayServer.Security; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using StoreData = BTCPayServer.Data.StoreData; @@ -15,6 +16,7 @@ namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldStorePaymentMethodsController : ControllerBase { private StoreData Store => HttpContext.GetStoreData(); diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStorePayoutProcessorsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStorePayoutProcessorsController.cs index dad9a0958..f8183f1f6 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStorePayoutProcessorsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStorePayoutProcessorsController.cs @@ -7,12 +7,14 @@ using BTCPayServer.Client; using BTCPayServer.Client.Models; using BTCPayServer.PayoutProcessors; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldStorePayoutProcessorsController : ControllerBase { private readonly PayoutProcessorService _payoutProcessorService; diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesConfigurationController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesConfigurationController.cs index bb006fff9..7e9cc44ae 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesConfigurationController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesConfigurationController.cs @@ -13,6 +13,7 @@ using BTCPayServer.Rating; using BTCPayServer.Services.Rates; using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using RateSource = BTCPayServer.Client.Models.RateSource; @@ -21,6 +22,7 @@ namespace BTCPayServer.Controllers.GreenField [ApiController] [Route("api/v1/stores/{storeId}/rates/configuration")] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldStoreRateConfigurationController : ControllerBase { private readonly RateFetcher _rateProviderFactory; diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesController.cs index 00c781de8..946356f02 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesController.cs @@ -11,6 +11,7 @@ using BTCPayServer.Data; using BTCPayServer.Rating; using BTCPayServer.Services.Rates; 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] [Route("api/v1/stores/{storeId}/rates")] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldStoreRatesController : ControllerBase { private readonly RateFetcher _rateProviderFactory; diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs index 946b96505..6b49ab860 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs @@ -6,6 +6,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; @@ -17,6 +18,7 @@ namespace BTCPayServer.Controllers.Greenfield [Route("api/test/apikey")] [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] + [EnableCors(CorsPolicies.All)] public class GreenfieldTestApiKeyController : ControllerBase { private readonly UserManager _userManager;