From 23a96c07aee4709a05370db7b0565758392afeba Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 14 Jan 2022 13:05:23 +0900 Subject: [PATCH] Rename GreenField -> Greenfield --- BTCPayServer.Client/BTCPayServerClient.cs | 6 +++--- BTCPayServer.Client/GreenFieldAPIException.cs | 4 ++-- .../GreenFieldValidationException.cs | 4 ++-- BTCPayServer.Tests/ApiKeysTests.cs | 2 +- BTCPayServer.Tests/GreenfieldAPITests.cs | 18 +++++++++--------- .../Controllers/GreenField/GreenFieldUtils.cs | 4 ++-- .../GreenField/GreenfieldApiKeysController.cs | 4 ++-- .../GreenField/GreenfieldHealthController.cs | 2 +- .../GreenField/GreenfieldInvoiceController.cs | 2 +- ...fieldLightningNodeApiController.Internal.cs | 2 +- ...eenfieldLightningNodeApiController.Store.cs | 2 +- .../GreenfieldLightningNodeApiController.cs | 2 +- .../GreenfieldNotificationsController.cs | 2 +- .../GreenfieldPaymentRequestsController.cs | 2 +- .../GreenfieldPullPaymentController.cs | 2 +- .../GreenfieldServerInfoController.cs | 2 +- ...eldStoreLNURLPayPaymentMethodsController.cs | 2 +- ...LightningNetworkPaymentMethodsController.cs | 2 +- ...aymentMethodsController.WalletGeneration.cs | 2 +- ...ieldStoreOnChainPaymentMethodsController.cs | 2 +- .../GreenfieldStoreOnChainWalletsController.cs | 4 ++-- .../GreenfieldStorePaymentMethodsController.cs | 2 +- .../GreenfieldStoreWebhooksController.cs | 2 +- .../GreenField/GreenfieldStoresController.cs | 2 +- .../GreenfieldTestApiKeyController.cs | 2 +- .../GreenField/GreenfieldUsersController.cs | 6 +++--- .../GreenField/LocalBTCPayServerClient.cs | 16 ++++++++-------- .../Controllers/UIManageController.APIKeys.cs | 2 +- BTCPayServer/Controllers/UIManageController.cs | 2 +- .../Extensions/AuthorizationExtensions.cs | 4 ++-- BTCPayServer/HostedServices/WebhookSender.cs | 2 +- BTCPayServer/Hosting/BTCPayServerServices.cs | 4 ++-- BTCPayServer/Hosting/GreenfieldMiddleware.cs | 4 ++-- BTCPayServer/Hosting/Startup.cs | 2 +- .../Payments/LNURLPay/PaymentTypes.LNURL.cs | 2 +- .../Payments/PaymentTypes.Lightning.cs | 2 +- .../Security/GreenField/APIKeyExtensions.cs | 14 +++++++------- .../Security/GreenField/APIKeyRepository.cs | 2 +- .../GreenField/APIKeysAuthenticationHandler.cs | 12 ++++++------ .../GreenField/BasicAuthenticationHandler.cs | 12 ++++++------ .../GreenFieldAuthenticationOptions.cs | 4 ++-- .../GreenFieldAuthorizationHandler.cs | 12 ++++++------ .../Security/GreenField/GreenFieldConstants.cs | 6 +++--- BTCPayServer/Views/UIManage/AddApiKey.cshtml | 2 +- .../Views/UIManage/AuthorizeAPIKey.cshtml | 2 +- 45 files changed, 96 insertions(+), 96 deletions(-) diff --git a/BTCPayServer.Client/BTCPayServerClient.cs b/BTCPayServer.Client/BTCPayServerClient.cs index eaab2612f..20457a4d0 100644 --- a/BTCPayServer.Client/BTCPayServerClient.cs +++ b/BTCPayServer.Client/BTCPayServerClient.cs @@ -52,18 +52,18 @@ namespace BTCPayServer.Client if (message.StatusCode == System.Net.HttpStatusCode.UnprocessableEntity) { var err = JsonConvert.DeserializeObject(await message.Content.ReadAsStringAsync()); - throw new GreenFieldValidationException(err); + throw new GreenfieldValidationException(err); } if (message.StatusCode == System.Net.HttpStatusCode.Forbidden) { var err = JsonConvert.DeserializeObject(await message.Content.ReadAsStringAsync()); - throw new GreenFieldAPIException((int)message.StatusCode, err); + throw new GreenfieldAPIException((int)message.StatusCode, err); } else { var err = JsonConvert.DeserializeObject(await message.Content.ReadAsStringAsync()); if (err.Code != null) - throw new GreenFieldAPIException((int)message.StatusCode, err); + throw new GreenfieldAPIException((int)message.StatusCode, err); } } message.EnsureSuccessStatusCode(); diff --git a/BTCPayServer.Client/GreenFieldAPIException.cs b/BTCPayServer.Client/GreenFieldAPIException.cs index 63b4b73dd..25e739e5d 100644 --- a/BTCPayServer.Client/GreenFieldAPIException.cs +++ b/BTCPayServer.Client/GreenFieldAPIException.cs @@ -2,9 +2,9 @@ using System; namespace BTCPayServer.Client { - public class GreenFieldAPIException : Exception + public class GreenfieldAPIException : Exception { - public GreenFieldAPIException(int httpCode, Models.GreenfieldAPIError error) : base(error.Message) + public GreenfieldAPIException(int httpCode, Models.GreenfieldAPIError error) : base(error.Message) { if (error == null) throw new ArgumentNullException(nameof(error)); diff --git a/BTCPayServer.Client/GreenFieldValidationException.cs b/BTCPayServer.Client/GreenFieldValidationException.cs index 6c0a67664..7f0799536 100644 --- a/BTCPayServer.Client/GreenFieldValidationException.cs +++ b/BTCPayServer.Client/GreenFieldValidationException.cs @@ -4,9 +4,9 @@ using BTCPayServer.Client.Models; namespace BTCPayServer.Client { - public class GreenFieldValidationException : Exception + public class GreenfieldValidationException : Exception { - public GreenFieldValidationException(Models.GreenfieldValidationError[] errors) : base(BuildMessage(errors)) + public GreenfieldValidationException(Models.GreenfieldValidationError[] errors) : base(BuildMessage(errors)) { ValidationErrors = errors; } diff --git a/BTCPayServer.Tests/ApiKeysTests.cs b/BTCPayServer.Tests/ApiKeysTests.cs index ff96e653c..5c52c2e12 100644 --- a/BTCPayServer.Tests/ApiKeysTests.cs +++ b/BTCPayServer.Tests/ApiKeysTests.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using BTCPayServer.Client; using BTCPayServer.Client.Models; using BTCPayServer.Data; -using BTCPayServer.Security.GreenField; +using BTCPayServer.Security.Greenfield; using BTCPayServer.Tests.Logging; using BTCPayServer.Views.Manage; using Newtonsoft.Json; diff --git a/BTCPayServer.Tests/GreenfieldAPITests.cs b/BTCPayServer.Tests/GreenfieldAPITests.cs index 386e18295..a56381fbb 100644 --- a/BTCPayServer.Tests/GreenfieldAPITests.cs +++ b/BTCPayServer.Tests/GreenfieldAPITests.cs @@ -602,15 +602,15 @@ namespace BTCPayServer.Tests return new DateTimeOffset(dateTimeOffset.Year, dateTimeOffset.Month, dateTimeOffset.Day, dateTimeOffset.Hour, dateTimeOffset.Minute, dateTimeOffset.Second, dateTimeOffset.Offset); } - private async Task AssertAPIError(string expectedError, Func act) + private async Task AssertAPIError(string expectedError, Func act) { - var err = await Assert.ThrowsAsync(async () => await act()); + var err = await Assert.ThrowsAsync(async () => await act()); Assert.Equal(expectedError, err.APIError.Code); return err; } - private async Task AssertPermissionError(string expectedPermission, Func act) + private async Task AssertPermissionError(string expectedPermission, Func act) { - var err = await Assert.ThrowsAsync(async () => await act()); + var err = await Assert.ThrowsAsync(async () => await act()); var err2 = Assert.IsType(err.APIError); Assert.Equal(expectedPermission, err2.MissingPermission); return err; @@ -675,10 +675,10 @@ namespace BTCPayServer.Tests } } - private async Task AssertValidationError(string[] fields, Func act) + private async Task AssertValidationError(string[] fields, Func act) { var remainingFields = fields.ToHashSet(); - var ex = await Assert.ThrowsAsync(act); + var ex = await Assert.ThrowsAsync(act); foreach (var field in fields) { Assert.Contains(field, ex.ValidationErrors.Select(e => e.Path).ToArray()); @@ -690,7 +690,7 @@ namespace BTCPayServer.Tests private async Task AssertHttpError(int code, Func act) { - var ex = await Assert.ThrowsAsync(act); + var ex = await Assert.ThrowsAsync(act); Assert.Equal(code, ex.HttpCode); } @@ -1496,12 +1496,12 @@ namespace BTCPayServer.Tests { BOLT11 = merchantInvoice.BOLT11 }); - await Assert.ThrowsAsync(async () => await client.PayLightningInvoice(user.StoreId, "BTC", new PayLightningInvoiceRequest() + await Assert.ThrowsAsync(async () => await client.PayLightningInvoice(user.StoreId, "BTC", new PayLightningInvoiceRequest() { BOLT11 = "lol" })); - var validationErr = await Assert.ThrowsAsync(async () => await client.CreateLightningInvoice(user.StoreId, "BTC", new CreateLightningInvoiceRequest() + var validationErr = await Assert.ThrowsAsync(async () => await client.CreateLightningInvoice(user.StoreId, "BTC", new CreateLightningInvoiceRequest() { Amount = -1, Expiry = TimeSpan.FromSeconds(-1), diff --git a/BTCPayServer/Controllers/GreenField/GreenFieldUtils.cs b/BTCPayServer/Controllers/GreenField/GreenFieldUtils.cs index 9500c8fee..59e484b4f 100644 --- a/BTCPayServer/Controllers/GreenField/GreenFieldUtils.cs +++ b/BTCPayServer/Controllers/GreenField/GreenFieldUtils.cs @@ -3,9 +3,9 @@ using BTCPayServer.Client.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ModelBinding; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { - public static class GreenFieldUtils + public static class GreenfieldUtils { public static IActionResult CreateValidationError(this ControllerBase controller, ModelStateDictionary modelState) { diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldApiKeysController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldApiKeysController.cs index be8fee266..aa3095ed7 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldApiKeysController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldApiKeysController.cs @@ -5,7 +5,7 @@ using BTCPayServer.Client; using BTCPayServer.Client.Models; using BTCPayServer.Data; using BTCPayServer.Security; -using BTCPayServer.Security.GreenField; +using BTCPayServer.Security.Greenfield; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Identity; @@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Mvc; using NBitcoin; using NBitcoin.DataEncoders; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.GreenfieldAPIKeys)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldHealthController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldHealthController.cs index 6d19a3494..49f527b81 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldHealthController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldHealthController.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [Controller] [EnableCors(CorsPolicies.All)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldInvoiceController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldInvoiceController.cs index 9ae511319..15477cac1 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldInvoiceController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldInvoiceController.cs @@ -17,7 +17,7 @@ using NBitcoin; using CreateInvoiceRequest = BTCPayServer.Client.Models.CreateInvoiceRequest; using InvoiceData = BTCPayServer.Client.Models.InvoiceData; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs index 6019f1c72..d6b73e14e 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs @@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Store.cs b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Store.cs index 747e1f2b3..7062cae35 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Store.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Store.cs @@ -17,7 +17,7 @@ using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs index a1450b27e..7e48925eb 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs @@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using Newtonsoft.Json.Linq; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { public class LightningUnavailableExceptionFilter : Attribute, IExceptionFilter { diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldNotificationsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldNotificationsController.cs index bf97d1110..bb59caa31 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldNotificationsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldNotificationsController.cs @@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using NotificationData = BTCPayServer.Client.Models.NotificationData; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldPaymentRequestsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldPaymentRequestsController.cs index 524f97ac0..181e2a392 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldPaymentRequestsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldPaymentRequestsController.cs @@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using PaymentRequestData = BTCPayServer.Data.PaymentRequestData; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs index 4aef72365..f504229e6 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs @@ -18,7 +18,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using Microsoft.EntityFrameworkCore; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldServerInfoController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldServerInfoController.cs index 58466b50e..6b7aa06e5 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldServerInfoController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldServerInfoController.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [EnableCors(CorsPolicies.All)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLNURLPayPaymentMethodsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLNURLPayPaymentMethodsController.cs index 9ce37657c..8b159fcbb 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLNURLPayPaymentMethodsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLNURLPayPaymentMethodsController.cs @@ -20,7 +20,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using StoreData = BTCPayServer.Data.StoreData; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningNetworkPaymentMethodsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningNetworkPaymentMethodsController.cs index 216378d52..b06d0b2b5 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningNetworkPaymentMethodsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningNetworkPaymentMethodsController.cs @@ -20,7 +20,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using StoreData = BTCPayServer.Data.StoreData; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs index d4dcd5d4a..5390b14e2 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs @@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using NBXplorer.Models; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { public partial class GreenfieldStoreOnChainPaymentMethodsController { diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs index 476a4498c..883338935 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs @@ -17,7 +17,7 @@ using NBXplorer.DerivationStrategy; using NBXplorer.Models; using StoreData = BTCPayServer.Data.StoreData; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs index 751837ef6..0170459ba 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs @@ -28,7 +28,7 @@ using NBXplorer.Models; using Newtonsoft.Json.Linq; using StoreData = BTCPayServer.Data.StoreData; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] @@ -353,7 +353,7 @@ namespace BTCPayServer.Controllers.GreenField request.AddModelError(transactionRequest => transactionRequest.Destinations[index], "Amount must be specified or destination must be a BIP21 payment link, and greater than 0", this); } - if (request.ProceedWithPayjoin && bip21?.UnknowParameters?.ContainsKey(PayjoinClient.BIP21EndpointKey) is true) + if (request.ProceedWithPayjoin && bip21?.UnknownParameters?.ContainsKey(PayjoinClient.BIP21EndpointKey) is true) { payjoinOutputIndex = index; } diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs index 3a35b9ee0..d7913fcb6 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using StoreData = BTCPayServer.Data.StoreData; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreWebhooksController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreWebhooksController.cs index 129b1ba2f..4fc91739d 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreWebhooksController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreWebhooksController.cs @@ -18,7 +18,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Linq; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield, diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs index d953e8629..f25202b73 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs @@ -15,7 +15,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using StoreData = BTCPayServer.Data.StoreData; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs index dbdd702c8..fdc60ce79 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs @@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { /// /// this controller serves as a testing endpoint for our api key unit tests diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs index 6869b54f5..630d405e9 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs @@ -12,7 +12,7 @@ using BTCPayServer.Events; using BTCPayServer.HostedServices; using BTCPayServer.Logging; using BTCPayServer.Security; -using BTCPayServer.Security.GreenField; +using BTCPayServer.Security.Greenfield; using BTCPayServer.Services; using BTCPayServer.Services.Stores; using BTCPayServer.Storage.Services; @@ -22,7 +22,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using NicolasDorier.RateLimits; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Greenfield)] @@ -99,7 +99,7 @@ namespace BTCPayServer.Controllers.GreenField throw new JsonHttpException(this.StatusCode(401)); var anyAdmin = (await _userManager.GetUsersInRoleAsync(Roles.ServerAdmin)).Any(); var policies = await _settingsRepository.GetSettingAsync() ?? new PoliciesSettings(); - var isAuth = User.Identity.AuthenticationType == GreenFieldConstants.AuthenticationType; + var isAuth = User.Identity.AuthenticationType == GreenfieldConstants.AuthenticationType; // If registration are locked and that an admin exists, don't accept unauthenticated connection if (anyAdmin && policies.LockSubscription && !isAuth) diff --git a/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs b/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs index 2b02a157c..295f83967 100644 --- a/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs +++ b/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs @@ -9,7 +9,7 @@ using BTCPayServer.Abstractions.Contracts; using BTCPayServer.Client; using BTCPayServer.Client.Models; using BTCPayServer.Data; -using BTCPayServer.Security.GreenField; +using BTCPayServer.Security.Greenfield; using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; @@ -27,7 +27,7 @@ using StoreData = BTCPayServer.Client.Models.StoreData; using StoreWebhookData = BTCPayServer.Client.Models.StoreWebhookData; using WebhookDeliveryData = BTCPayServer.Client.Models.WebhookDeliveryData; -namespace BTCPayServer.Controllers.GreenField +namespace BTCPayServer.Controllers.Greenfield { public class BTCPayServerClientFactory : IBTCPayServerClientFactory { @@ -107,18 +107,18 @@ namespace BTCPayServer.Controllers.GreenField List claims = new List { new Claim(_identityOptions.CurrentValue.ClaimsIdentity.UserIdClaimType, userId), - new Claim(GreenFieldConstants.ClaimTypes.Permission, + new Claim(GreenfieldConstants.ClaimTypes.Permission, Permission.Create(Policies.Unrestricted).ToString()) }; claims.AddRange((await _userManager.GetRolesAsync(user)).Select(s => new Claim(_identityOptions.CurrentValue.ClaimsIdentity.RoleClaimType, s))); context.User = - new ClaimsPrincipal(new ClaimsIdentity(claims, GreenFieldConstants.AuthenticationType)); + new ClaimsPrincipal(new ClaimsIdentity(claims, GreenfieldConstants.AuthenticationType)); } else { context.User = - new ClaimsPrincipal(new ClaimsIdentity(new List(), $"Local{GreenFieldConstants.AuthenticationType}")); + new ClaimsPrincipal(new ClaimsIdentity(new List(), $"Local{GreenfieldConstants.AuthenticationType}")); } if (storeIds?.Any() is true) @@ -484,11 +484,11 @@ namespace BTCPayServer.Controllers.GreenField switch (result) { case UnprocessableEntityObjectResult { Value: List validationErrors }: - throw new GreenFieldValidationException(validationErrors.ToArray()); + throw new GreenfieldValidationException(validationErrors.ToArray()); case BadRequestObjectResult { Value: GreenfieldAPIError error }: - throw new GreenFieldAPIException(400, error); + throw new GreenfieldAPIException(400, error); case NotFoundResult _: - throw new GreenFieldAPIException(404, new GreenfieldAPIError("not-found", "")); + throw new GreenfieldAPIException(404, new GreenfieldAPIError("not-found", "")); default: return; } diff --git a/BTCPayServer/Controllers/UIManageController.APIKeys.cs b/BTCPayServer/Controllers/UIManageController.APIKeys.cs index 0d4471156..b86ef4a48 100644 --- a/BTCPayServer/Controllers/UIManageController.APIKeys.cs +++ b/BTCPayServer/Controllers/UIManageController.APIKeys.cs @@ -8,7 +8,7 @@ using BTCPayServer.Abstractions.Models; using BTCPayServer.Client; using BTCPayServer.Data; using BTCPayServer.Models; -using BTCPayServer.Security.GreenField; +using BTCPayServer.Security.Greenfield; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using NBitcoin; diff --git a/BTCPayServer/Controllers/UIManageController.cs b/BTCPayServer/Controllers/UIManageController.cs index aa76fd2a9..44940d199 100644 --- a/BTCPayServer/Controllers/UIManageController.cs +++ b/BTCPayServer/Controllers/UIManageController.cs @@ -7,7 +7,7 @@ using BTCPayServer.Data; using BTCPayServer.Fido2; using BTCPayServer.Models; using BTCPayServer.Models.ManageViewModels; -using BTCPayServer.Security.GreenField; +using BTCPayServer.Security.Greenfield; using BTCPayServer.Services; using BTCPayServer.Services.Mails; using BTCPayServer.Services.Stores; diff --git a/BTCPayServer/Extensions/AuthorizationExtensions.cs b/BTCPayServer/Extensions/AuthorizationExtensions.cs index 821bf6994..da1bc4f7b 100644 --- a/BTCPayServer/Extensions/AuthorizationExtensions.cs +++ b/BTCPayServer/Extensions/AuthorizationExtensions.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using BTCPayServer.Abstractions.Constants; using BTCPayServer.Client; using BTCPayServer.Security.Bitpay; -using BTCPayServer.Security.GreenField; +using BTCPayServer.Security.Greenfield; using BTCPayServer.Services; using CsvHelper.Configuration.Attributes; using Microsoft.AspNetCore.Authorization; @@ -26,7 +26,7 @@ namespace BTCPayServer bool isAdmin = false; if (claimUser.AuthenticationType == AuthenticationSchemes.Cookie) isAdmin = user.IsInRole(Roles.ServerAdmin); - else if (claimUser.AuthenticationType == GreenFieldConstants.AuthenticationType) + else if (claimUser.AuthenticationType == GreenfieldConstants.AuthenticationType) isAdmin = (await authorizationService.AuthorizeAsync(user, Policies.CanModifyServerSettings)).Succeeded; return isAdmin ? (true, true) : (policiesSettings?.AllowHotWalletForAll is true, policiesSettings?.AllowHotWalletRPCImportForAll is true); diff --git a/BTCPayServer/HostedServices/WebhookSender.cs b/BTCPayServer/HostedServices/WebhookSender.cs index edeaeaa89..2cde208cd 100644 --- a/BTCPayServer/HostedServices/WebhookSender.cs +++ b/BTCPayServer/HostedServices/WebhookSender.cs @@ -9,7 +9,7 @@ using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; using BTCPayServer.Client.Models; -using BTCPayServer.Controllers.GreenField; +using BTCPayServer.Controllers.Greenfield; using BTCPayServer.Data; using BTCPayServer.Events; using BTCPayServer.Logging; diff --git a/BTCPayServer/Hosting/BTCPayServerServices.cs b/BTCPayServer/Hosting/BTCPayServerServices.cs index d8f082132..25b9fb6d9 100644 --- a/BTCPayServer/Hosting/BTCPayServerServices.cs +++ b/BTCPayServer/Hosting/BTCPayServerServices.cs @@ -10,7 +10,7 @@ using BTCPayServer.Client; using BTCPayServer.Common; using BTCPayServer.Configuration; using BTCPayServer.Controllers; -using BTCPayServer.Controllers.GreenField; +using BTCPayServer.Controllers.Greenfield; using BTCPayServer.Data; using BTCPayServer.Data.Payouts.LightningLike; using BTCPayServer.HostedServices; @@ -24,7 +24,7 @@ using BTCPayServer.Payments.PayJoin; using BTCPayServer.Plugins; using BTCPayServer.Security; using BTCPayServer.Security.Bitpay; -using BTCPayServer.Security.GreenField; +using BTCPayServer.Security.Greenfield; using BTCPayServer.Services; using BTCPayServer.Services.Apps; using BTCPayServer.Services.Fees; diff --git a/BTCPayServer/Hosting/GreenfieldMiddleware.cs b/BTCPayServer/Hosting/GreenfieldMiddleware.cs index 45f5dde72..fde8dd7a5 100644 --- a/BTCPayServer/Hosting/GreenfieldMiddleware.cs +++ b/BTCPayServer/Hosting/GreenfieldMiddleware.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using BTCPayServer.Client.Models; -using BTCPayServer.Security.GreenField; +using BTCPayServer.Security.Greenfield; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Infrastructure; @@ -35,7 +35,7 @@ namespace BTCPayServer.Hosting (httpContext.Response.StatusCode == 401 || httpContext.Response.StatusCode == 403)) { if (httpContext.Response.StatusCode == 403 && - httpContext.Items.TryGetValue(GreenFieldAuthorizationHandler.RequestedPermissionKey, out var p) && + httpContext.Items.TryGetValue(GreenfieldAuthorizationHandler.RequestedPermissionKey, out var p) && p is string policy) { var outputObj = new GreenfieldPermissionAPIError(policy); diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs index d1f42f969..44219eb2d 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -4,7 +4,7 @@ using System.IO; using System.Linq; using System.Net; using BTCPayServer.Configuration; -using BTCPayServer.Controllers.GreenField; +using BTCPayServer.Controllers.Greenfield; using BTCPayServer.Data; using BTCPayServer.Fido2; using BTCPayServer.Filters; diff --git a/BTCPayServer/Payments/LNURLPay/PaymentTypes.LNURL.cs b/BTCPayServer/Payments/LNURLPay/PaymentTypes.LNURL.cs index 870be34fb..25c398ddb 100644 --- a/BTCPayServer/Payments/LNURLPay/PaymentTypes.LNURL.cs +++ b/BTCPayServer/Payments/LNURLPay/PaymentTypes.LNURL.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using BTCPayServer.Client.Models; -using BTCPayServer.Controllers.GreenField; +using BTCPayServer.Controllers.Greenfield; using BTCPayServer.Payments.Lightning; using BTCPayServer.Services.Invoices; using NBitcoin; diff --git a/BTCPayServer/Payments/PaymentTypes.Lightning.cs b/BTCPayServer/Payments/PaymentTypes.Lightning.cs index be82ba7f7..73374fe8a 100644 --- a/BTCPayServer/Payments/PaymentTypes.Lightning.cs +++ b/BTCPayServer/Payments/PaymentTypes.Lightning.cs @@ -1,6 +1,6 @@ using System; using BTCPayServer.Client.Models; -using BTCPayServer.Controllers.GreenField; +using BTCPayServer.Controllers.Greenfield; using BTCPayServer.Payments.Lightning; using BTCPayServer.Services.Invoices; using NBitcoin; diff --git a/BTCPayServer/Security/GreenField/APIKeyExtensions.cs b/BTCPayServer/Security/GreenField/APIKeyExtensions.cs index dc7040f79..ee5815756 100644 --- a/BTCPayServer/Security/GreenField/APIKeyExtensions.cs +++ b/BTCPayServer/Security/GreenField/APIKeyExtensions.cs @@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Primitives; -namespace BTCPayServer.Security.GreenField +namespace BTCPayServer.Security.Greenfield { public static class APIKeyExtensions { @@ -26,9 +26,9 @@ namespace BTCPayServer.Security.GreenField public static AuthenticationBuilder AddAPIKeyAuthentication(this AuthenticationBuilder builder) { - builder.AddScheme(AuthenticationSchemes.GreenfieldAPIKeys, + builder.AddScheme(AuthenticationSchemes.GreenfieldAPIKeys, o => { }); - builder.AddScheme(AuthenticationSchemes.GreenfieldBasic, + builder.AddScheme(AuthenticationSchemes.GreenfieldBasic, o => { }); return builder; } @@ -36,15 +36,15 @@ namespace BTCPayServer.Security.GreenField public static IServiceCollection AddAPIKeyAuthentication(this IServiceCollection serviceCollection) { serviceCollection.AddSingleton(); - serviceCollection.AddScoped(); - serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); return serviceCollection; } public static string[] GetPermissions(this AuthorizationHandlerContext context) { return context.User.Claims.Where(c => - c.Type.Equals(GreenFieldConstants.ClaimTypes.Permission, StringComparison.InvariantCultureIgnoreCase)) + c.Type.Equals(GreenfieldConstants.ClaimTypes.Permission, StringComparison.InvariantCultureIgnoreCase)) .Select(claim => claim.Value).ToArray(); } public static bool HasPermission(this AuthorizationHandlerContext context, Permission permission) @@ -54,7 +54,7 @@ namespace BTCPayServer.Security.GreenField public static bool HasPermission(this AuthorizationHandlerContext context, Permission permission, bool requireUnscoped) { foreach (var claim in context.User.Claims.Where(c => - c.Type.Equals(GreenFieldConstants.ClaimTypes.Permission, StringComparison.InvariantCultureIgnoreCase))) + c.Type.Equals(GreenfieldConstants.ClaimTypes.Permission, StringComparison.InvariantCultureIgnoreCase))) { if (Permission.TryParse(claim.Value, out var claimPermission)) { diff --git a/BTCPayServer/Security/GreenField/APIKeyRepository.cs b/BTCPayServer/Security/GreenField/APIKeyRepository.cs index 278c09fa3..c278c4ae9 100644 --- a/BTCPayServer/Security/GreenField/APIKeyRepository.cs +++ b/BTCPayServer/Security/GreenField/APIKeyRepository.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore; -namespace BTCPayServer.Security.GreenField +namespace BTCPayServer.Security.Greenfield { public class APIKeyRepository { diff --git a/BTCPayServer/Security/GreenField/APIKeysAuthenticationHandler.cs b/BTCPayServer/Security/GreenField/APIKeysAuthenticationHandler.cs index 14989736b..be7f4b40c 100644 --- a/BTCPayServer/Security/GreenField/APIKeysAuthenticationHandler.cs +++ b/BTCPayServer/Security/GreenField/APIKeysAuthenticationHandler.cs @@ -10,9 +10,9 @@ using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -namespace BTCPayServer.Security.GreenField +namespace BTCPayServer.Security.Greenfield { - public class APIKeysAuthenticationHandler : AuthenticationHandler + public class APIKeysAuthenticationHandler : AuthenticationHandler { private readonly APIKeyRepository _apiKeyRepository; private readonly IOptionsMonitor _identityOptions; @@ -21,7 +21,7 @@ namespace BTCPayServer.Security.GreenField public APIKeysAuthenticationHandler( APIKeyRepository apiKeyRepository, IOptionsMonitor identityOptions, - IOptionsMonitor options, + IOptionsMonitor options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, @@ -48,10 +48,10 @@ namespace BTCPayServer.Security.GreenField claims.AddRange((await _userManager.GetRolesAsync(key.User)).Select(s => new Claim(_identityOptions.CurrentValue.ClaimsIdentity.RoleClaimType, s))); claims.AddRange(Permission.ToPermissions(key.GetBlob().Permissions).Select(permission => - new Claim(GreenFieldConstants.ClaimTypes.Permission, permission.ToString()))); + new Claim(GreenfieldConstants.ClaimTypes.Permission, permission.ToString()))); return AuthenticateResult.Success(new AuthenticationTicket( - new ClaimsPrincipal(new ClaimsIdentity(claims, GreenFieldConstants.AuthenticationType)), - GreenFieldConstants.AuthenticationType)); + new ClaimsPrincipal(new ClaimsIdentity(claims, GreenfieldConstants.AuthenticationType)), + GreenfieldConstants.AuthenticationType)); } } } diff --git a/BTCPayServer/Security/GreenField/BasicAuthenticationHandler.cs b/BTCPayServer/Security/GreenField/BasicAuthenticationHandler.cs index b3e6ece17..e49f59ee0 100644 --- a/BTCPayServer/Security/GreenField/BasicAuthenticationHandler.cs +++ b/BTCPayServer/Security/GreenField/BasicAuthenticationHandler.cs @@ -13,9 +13,9 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -namespace BTCPayServer.Security.GreenField +namespace BTCPayServer.Security.Greenfield { - public class BasicAuthenticationHandler : AuthenticationHandler + public class BasicAuthenticationHandler : AuthenticationHandler { private readonly IOptionsMonitor _identityOptions; private readonly SignInManager _signInManager; @@ -23,7 +23,7 @@ namespace BTCPayServer.Security.GreenField public BasicAuthenticationHandler( IOptionsMonitor identityOptions, - IOptionsMonitor options, + IOptionsMonitor options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, @@ -74,14 +74,14 @@ namespace BTCPayServer.Security.GreenField var claims = new List() { new Claim(_identityOptions.CurrentValue.ClaimsIdentity.UserIdClaimType, user.Id), - new Claim(GreenFieldConstants.ClaimTypes.Permission, + new Claim(GreenfieldConstants.ClaimTypes.Permission, Permission.Create(Policies.Unrestricted).ToString()) }; claims.AddRange((await _userManager.GetRolesAsync(user)).Select(s => new Claim(_identityOptions.CurrentValue.ClaimsIdentity.RoleClaimType, s))); return AuthenticateResult.Success(new AuthenticationTicket( - new ClaimsPrincipal(new ClaimsIdentity(claims, GreenFieldConstants.AuthenticationType)), - GreenFieldConstants.AuthenticationType)); + new ClaimsPrincipal(new ClaimsIdentity(claims, GreenfieldConstants.AuthenticationType)), + GreenfieldConstants.AuthenticationType)); } } } diff --git a/BTCPayServer/Security/GreenField/GreenFieldAuthenticationOptions.cs b/BTCPayServer/Security/GreenField/GreenFieldAuthenticationOptions.cs index ad4aab7bb..e43b1027e 100644 --- a/BTCPayServer/Security/GreenField/GreenFieldAuthenticationOptions.cs +++ b/BTCPayServer/Security/GreenField/GreenFieldAuthenticationOptions.cs @@ -1,8 +1,8 @@ using Microsoft.AspNetCore.Authentication; -namespace BTCPayServer.Security.GreenField +namespace BTCPayServer.Security.Greenfield { - public class GreenFieldAuthenticationOptions : AuthenticationSchemeOptions + public class GreenfieldAuthenticationOptions : AuthenticationSchemeOptions { } } diff --git a/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs b/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs index a074953ad..03ce67719 100644 --- a/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs +++ b/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs @@ -13,13 +13,13 @@ using Microsoft.AspNetCore.Identity; using Newtonsoft.Json; using StoreData = BTCPayServer.Data.StoreData; -namespace BTCPayServer.Security.GreenField +namespace BTCPayServer.Security.Greenfield { - public class LocalGreenFieldAuthorizationHandler : AuthorizationHandler + public class LocalGreenfieldAuthorizationHandler : AuthorizationHandler { protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, PolicyRequirement requirement) { - var succeed = context.User.Identity.AuthenticationType == $"Local{GreenFieldConstants.AuthenticationType}"; + var succeed = context.User.Identity.AuthenticationType == $"Local{GreenfieldConstants.AuthenticationType}"; if (succeed) { @@ -29,14 +29,14 @@ namespace BTCPayServer.Security.GreenField } } - public class GreenFieldAuthorizationHandler : AuthorizationHandler + public class GreenfieldAuthorizationHandler : AuthorizationHandler { private readonly HttpContext _HttpContext; private readonly UserManager _userManager; private readonly StoreRepository _storeRepository; - public GreenFieldAuthorizationHandler(IHttpContextAccessor httpContextAccessor, + public GreenfieldAuthorizationHandler(IHttpContextAccessor httpContextAccessor, UserManager userManager, StoreRepository storeRepository) { @@ -48,7 +48,7 @@ namespace BTCPayServer.Security.GreenField protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, PolicyRequirement requirement) { - if (context.User.Identity.AuthenticationType != GreenFieldConstants.AuthenticationType) + if (context.User.Identity.AuthenticationType != GreenfieldConstants.AuthenticationType) return; var userid = _userManager.GetUserId(context.User); bool success = false; diff --git a/BTCPayServer/Security/GreenField/GreenFieldConstants.cs b/BTCPayServer/Security/GreenField/GreenFieldConstants.cs index 8556b43ac..b1935ab2e 100644 --- a/BTCPayServer/Security/GreenField/GreenFieldConstants.cs +++ b/BTCPayServer/Security/GreenField/GreenFieldConstants.cs @@ -1,8 +1,8 @@ -namespace BTCPayServer.Security.GreenField +namespace BTCPayServer.Security.Greenfield { - public static class GreenFieldConstants + public static class GreenfieldConstants { - public const string AuthenticationType = "GreenField"; + public const string AuthenticationType = "Greenfield"; public static class ClaimTypes { diff --git a/BTCPayServer/Views/UIManage/AddApiKey.cshtml b/BTCPayServer/Views/UIManage/AddApiKey.cshtml index bb5a71e65..c0bbc2b88 100644 --- a/BTCPayServer/Views/UIManage/AddApiKey.cshtml +++ b/BTCPayServer/Views/UIManage/AddApiKey.cshtml @@ -1,6 +1,6 @@ @using BTCPayServer.Client @using BTCPayServer.Controllers -@using BTCPayServer.Security.GreenField +@using BTCPayServer.Security.Greenfield @model UIManageController.AddApiKeyViewModel @{ diff --git a/BTCPayServer/Views/UIManage/AuthorizeAPIKey.cshtml b/BTCPayServer/Views/UIManage/AuthorizeAPIKey.cshtml index 78032b06f..486460a02 100644 --- a/BTCPayServer/Views/UIManage/AuthorizeAPIKey.cshtml +++ b/BTCPayServer/Views/UIManage/AuthorizeAPIKey.cshtml @@ -1,6 +1,6 @@ @using BTCPayServer.Client @using BTCPayServer.Controllers -@using BTCPayServer.Security.GreenField +@using BTCPayServer.Security.Greenfield @model BTCPayServer.Controllers.UIManageController.AuthorizeApiKeysViewModel @{