diff --git a/BTCPayServer.Abstractions/Constants/AuthenticationSchemes.cs b/BTCPayApp.CommonServer/AuthenticationSchemes.cs
similarity index 90%
rename from BTCPayServer.Abstractions/Constants/AuthenticationSchemes.cs
rename to BTCPayApp.CommonServer/AuthenticationSchemes.cs
index 884dd82c1..fde740eb7 100644
--- a/BTCPayServer.Abstractions/Constants/AuthenticationSchemes.cs
+++ b/BTCPayApp.CommonServer/AuthenticationSchemes.cs
@@ -1,4 +1,4 @@
-namespace BTCPayServer.Abstractions.Constants
+namespace BTCPayApp.CommonServer
{
public class AuthenticationSchemes
{
diff --git a/BTCPayApp.CommonServer/BTCPayApp.CommonServer.csproj b/BTCPayApp.CommonServer/BTCPayApp.CommonServer.csproj
index 6480f809c..fa3b4ed28 100644
--- a/BTCPayApp.CommonServer/BTCPayApp.CommonServer.csproj
+++ b/BTCPayApp.CommonServer/BTCPayApp.CommonServer.csproj
@@ -10,4 +10,7 @@
+
+
+
diff --git a/BTCPayServer.Abstractions/Security/PolicyRequirement.cs b/BTCPayApp.CommonServer/PolicyRequirement.cs
similarity index 90%
rename from BTCPayServer.Abstractions/Security/PolicyRequirement.cs
rename to BTCPayApp.CommonServer/PolicyRequirement.cs
index a2bdbc735..c542816fc 100644
--- a/BTCPayServer.Abstractions/Security/PolicyRequirement.cs
+++ b/BTCPayApp.CommonServer/PolicyRequirement.cs
@@ -1,7 +1,7 @@
using System;
using Microsoft.AspNetCore.Authorization;
-namespace BTCPayServer.Security
+namespace BTCPayApp.CommonServer
{
public class PolicyRequirement : IAuthorizationRequirement
{
diff --git a/BTCPayServer.Abstractions/Converters/PosDataParser.cs b/BTCPayApp.CommonServer/PosDataParser.cs
similarity index 95%
rename from BTCPayServer.Abstractions/Converters/PosDataParser.cs
rename to BTCPayApp.CommonServer/PosDataParser.cs
index f3a7dffe1..d6138888d 100644
--- a/BTCPayServer.Abstractions/Converters/PosDataParser.cs
+++ b/BTCPayApp.CommonServer/PosDataParser.cs
@@ -1,9 +1,8 @@
-#nullable enable
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json.Linq;
-namespace BTCPayServer.Abstractions.Converters;
+namespace BTCPayApp.CommonServer;
public static class PosDataParser
{
diff --git a/BTCPayApp.CommonServer/Roles.cs b/BTCPayApp.CommonServer/Roles.cs
new file mode 100644
index 000000000..b541c60e2
--- /dev/null
+++ b/BTCPayApp.CommonServer/Roles.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace BTCPayApp.CommonServer;
+
+public class Roles
+{
+ public const string ServerAdmin = "ServerAdmin";
+ public static bool HasServerAdmin(IList roles)
+ {
+ return roles.Contains(Roles.ServerAdmin, StringComparer.Ordinal);
+ }
+}
diff --git a/BTCPayServer/Security/ServerPolicies.cs b/BTCPayApp.CommonServer/ServerPolicies.cs
similarity index 96%
rename from BTCPayServer/Security/ServerPolicies.cs
rename to BTCPayApp.CommonServer/ServerPolicies.cs
index 671887422..03dc4b8cf 100644
--- a/BTCPayServer/Security/ServerPolicies.cs
+++ b/BTCPayApp.CommonServer/ServerPolicies.cs
@@ -1,7 +1,7 @@
using BTCPayServer.Client;
using Microsoft.AspNetCore.Authorization;
-namespace BTCPayServer.Security
+namespace BTCPayApp.CommonServer
{
public static class ServerPolicies
{
diff --git a/BTCPayServer.Abstractions/BTCPayServer.Abstractions.csproj b/BTCPayServer.Abstractions/BTCPayServer.Abstractions.csproj
index e1ecd781e..99008cc48 100644
--- a/BTCPayServer.Abstractions/BTCPayServer.Abstractions.csproj
+++ b/BTCPayServer.Abstractions/BTCPayServer.Abstractions.csproj
@@ -36,6 +36,7 @@
+
diff --git a/BTCPayServer.Abstractions/Security/AuthorizationFilterHandle.cs b/BTCPayServer.Abstractions/Security/AuthorizationFilterHandle.cs
index ef7d297c4..687e0f49e 100644
--- a/BTCPayServer.Abstractions/Security/AuthorizationFilterHandle.cs
+++ b/BTCPayServer.Abstractions/Security/AuthorizationFilterHandle.cs
@@ -1,3 +1,4 @@
+using BTCPayApp.CommonServer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
diff --git a/BTCPayServer/App/API/AppApiController.Account.cs b/BTCPayServer/App/API/AppApiController.Account.cs
index a8baf0807..24813d9a7 100644
--- a/BTCPayServer/App/API/AppApiController.Account.cs
+++ b/BTCPayServer/App/API/AppApiController.Account.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayApp.CommonServer.Models;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/App/API/AppApiController.cs b/BTCPayServer/App/API/AppApiController.cs
index 77806c114..8ffbe2bc6 100644
--- a/BTCPayServer/App/API/AppApiController.cs
+++ b/BTCPayServer/App/API/AppApiController.cs
@@ -1,6 +1,7 @@
#nullable enable
using System;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayApp.CommonServer.Models;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
diff --git a/BTCPayServer/App/API/VSSController.cs b/BTCPayServer/App/API/VSSController.cs
index 9f1fea2ef..244c58ca6 100644
--- a/BTCPayServer/App/API/VSSController.cs
+++ b/BTCPayServer/App/API/VSSController.cs
@@ -4,6 +4,7 @@ using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayApp.VSS;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.App.BackupStorage;
diff --git a/BTCPayServer/Components/MainNav/Default.cshtml b/BTCPayServer/Components/MainNav/Default.cshtml
index 838fdea49..b71da05f0 100644
--- a/BTCPayServer/Components/MainNav/Default.cshtml
+++ b/BTCPayServer/Components/MainNav/Default.cshtml
@@ -1,3 +1,4 @@
+@using BTCPayApp.CommonServer
@using BTCPayServer.Views.Server
@using BTCPayServer.Views.Stores
@using BTCPayServer.Views.Invoice
diff --git a/BTCPayServer/Components/StoreLightningBalance/StoreLightningBalance.cs b/BTCPayServer/Components/StoreLightningBalance/StoreLightningBalance.cs
index 434578cf8..e0a878fff 100644
--- a/BTCPayServer/Components/StoreLightningBalance/StoreLightningBalance.cs
+++ b/BTCPayServer/Components/StoreLightningBalance/StoreLightningBalance.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
using BTCPayServer.Configuration;
diff --git a/BTCPayServer/Components/StoreLightningServices/StoreLightningServices.cs b/BTCPayServer/Components/StoreLightningServices/StoreLightningServices.cs
index 613079a2e..2fb8efec5 100644
--- a/BTCPayServer/Components/StoreLightningServices/StoreLightningServices.cs
+++ b/BTCPayServer/Components/StoreLightningServices/StoreLightningServices.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Configuration;
using BTCPayServer.Data;
diff --git a/BTCPayServer/Controllers/BitpayAccessTokenController.cs b/BTCPayServer/Controllers/BitpayAccessTokenController.cs
index 205cffb13..812cfda53 100644
--- a/BTCPayServer/Controllers/BitpayAccessTokenController.cs
+++ b/BTCPayServer/Controllers/BitpayAccessTokenController.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Filters;
using BTCPayServer.Models;
diff --git a/BTCPayServer/Controllers/BitpayInvoiceController.cs b/BTCPayServer/Controllers/BitpayInvoiceController.cs
index cc653e8f5..f93276989 100644
--- a/BTCPayServer/Controllers/BitpayInvoiceController.cs
+++ b/BTCPayServer/Controllers/BitpayInvoiceController.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/BitpayRateController.cs b/BTCPayServer/Controllers/BitpayRateController.cs
index 0b5ffb871..0bb7f7827 100644
--- a/BTCPayServer/Controllers/BitpayRateController.cs
+++ b/BTCPayServer/Controllers/BitpayRateController.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Data;
using BTCPayServer.Filters;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldApiKeysController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldApiKeysController.cs
index c6e2f80be..617c99272 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldApiKeysController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldApiKeysController.cs
@@ -1,5 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldAppsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldAppsController.cs
index 308a7d027..cf823d637 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldAppsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldAppsController.cs
@@ -2,6 +2,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldFilesController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldFilesController.cs
index c14463532..3cb58bd24 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldFilesController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldFilesController.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldInvoiceController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldInvoiceController.cs
index b66631592..516a5ca1a 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldInvoiceController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldInvoiceController.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs
index f206a52d8..62b59c424 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Store.cs b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Store.cs
index 57813a8fe..c36d3fe4e 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Store.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Store.cs
@@ -1,6 +1,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs
index 8ad29eec5..eb63f72f4 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs
@@ -2,6 +2,7 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
using BTCPayServer.Client.Models;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldNotificationsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldNotificationsController.cs
index 4e3a7c559..98c3ebc99 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldNotificationsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldNotificationsController.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldPaymentRequestsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldPaymentRequestsController.cs
index 2c649ce9b..39c392209 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldPaymentRequestsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldPaymentRequestsController.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Reflection.Metadata;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldPayoutProcessorsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldPayoutProcessorsController.cs
index 7d7a185de..d7a3f11cc 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldPayoutProcessorsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldPayoutProcessorsController.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Client.Models;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs
index 3734250a7..142542b32 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldPullPaymentController.cs
@@ -8,6 +8,7 @@ using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldReportsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldReportsController.cs
index 38fd4d14c..2473545b9 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldReportsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldReportsController.cs
@@ -14,6 +14,7 @@ using BTCPayServer.Client.Models;
using BTCPayServer.Services;
using System.Linq;
using System.Threading;
+using BTCPayApp.CommonServer;
namespace BTCPayServer.Controllers.GreenField;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldServerInfoController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldServerInfoController.cs
index 1e3bb8391..82eb120a6 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldServerInfoController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldServerInfoController.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Client.Models;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldServerRolesController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldServerRolesController.cs
index 3db6c1dfa..4dd2c419f 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldServerRolesController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldServerRolesController.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedLightningPayoutProcessorsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedLightningPayoutProcessorsController.cs
index 2370ee047..192d2429c 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedLightningPayoutProcessorsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedLightningPayoutProcessorsController.cs
@@ -1,6 +1,7 @@
#nullable enable
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedOnChainPayoutProcessorsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedOnChainPayoutProcessorsController.cs
index ca11eb2e1..717de4f6a 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedOnChainPayoutProcessorsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreAutomatedOnChainPayoutProcessorsController.cs
@@ -2,6 +2,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreEmailController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreEmailController.cs
index 666a2130a..de6445250 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreEmailController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreEmailController.cs
@@ -1,5 +1,6 @@
#nullable enable
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningAddressesController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningAddressesController.cs
index 409ab9eae..af0debdd4 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningAddressesController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreLightningAddressesController.cs
@@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using AuthenticationSchemes = BTCPayServer.Abstractions.Constants.AuthenticationSchemes;
+using AuthenticationSchemes = BTCPayApp.CommonServer.AuthenticationSchemes;
using LightningAddressData = BTCPayServer.Client.Models.LightningAddressData;
namespace BTCPayServer.Controllers.Greenfield
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs
index f694b8b47..1d853e1be 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.cs
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs
index 6a853c966..4e8bd8a61 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainPaymentMethodsController.cs
@@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs
index dd5de05e2..ef5c5e526 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs
@@ -6,6 +6,7 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.BIP78.Sender;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs
index 41cf051d0..7fce2e36c 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStorePaymentMethodsController.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Client.Models;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStorePayoutProcessorsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStorePayoutProcessorsController.cs
index 4e1c5c963..a6feee1de 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStorePayoutProcessorsController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStorePayoutProcessorsController.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Client.Models;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesConfigurationController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesConfigurationController.cs
index eb1b32011..182476e28 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesConfigurationController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesConfigurationController.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesController.cs
index 707c855d6..51bb49046 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreRatesController.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Client.Models;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreRolesController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreRolesController.cs
index 5c6919866..4487e2345 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreRolesController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreRolesController.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreUsersController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreUsersController.cs
index 1839d7071..01128ada2 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreUsersController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreUsersController.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreWebhooksController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreWebhooksController.cs
index 3d9387dd7..2cefd989a 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreWebhooksController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreWebhooksController.cs
@@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Amazon.Runtime;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs
index ec710f18e..367acfbcf 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs
index d75429cd4..86859bd61 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldTestApiKeyController.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Data;
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs
index f6b124467..138057845 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs b/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs
index 6925789df..ca4b84c42 100644
--- a/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs
+++ b/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs
@@ -7,6 +7,7 @@ using System.Reflection;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Client;
using BTCPayServer.Client.Models;
diff --git a/BTCPayServer/Controllers/UIAccountController.cs b/BTCPayServer/Controllers/UIAccountController.cs
index 7b2dcb83c..7e5115952 100644
--- a/BTCPayServer/Controllers/UIAccountController.cs
+++ b/BTCPayServer/Controllers/UIAccountController.cs
@@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Controllers/UIAppsController.Dashboard.cs b/BTCPayServer/Controllers/UIAppsController.Dashboard.cs
index 3f3d5d9a4..948c22863 100644
--- a/BTCPayServer/Controllers/UIAppsController.Dashboard.cs
+++ b/BTCPayServer/Controllers/UIAppsController.Dashboard.cs
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Components.AppSales;
diff --git a/BTCPayServer/Controllers/UIAppsController.cs b/BTCPayServer/Controllers/UIAppsController.cs
index f44d0acbd..6ce2aeecd 100644
--- a/BTCPayServer/Controllers/UIAppsController.cs
+++ b/BTCPayServer/Controllers/UIAppsController.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/UIHomeController.cs b/BTCPayServer/Controllers/UIHomeController.cs
index 3b06cecab..0ca3245ed 100644
--- a/BTCPayServer/Controllers/UIHomeController.cs
+++ b/BTCPayServer/Controllers/UIHomeController.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/UIInvoiceController.UI.cs b/BTCPayServer/Controllers/UIInvoiceController.UI.cs
index 7f0679355..9392d2c55 100644
--- a/BTCPayServer/Controllers/UIInvoiceController.UI.cs
+++ b/BTCPayServer/Controllers/UIInvoiceController.UI.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Net.WebSockets;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Converters;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/UILNURLAuthController.cs b/BTCPayServer/Controllers/UILNURLAuthController.cs
index a50a1cedb..322223b8d 100644
--- a/BTCPayServer/Controllers/UILNURLAuthController.cs
+++ b/BTCPayServer/Controllers/UILNURLAuthController.cs
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Controllers/UILNURLController.cs b/BTCPayServer/Controllers/UILNURLController.cs
index fbb557771..be7f6bab2 100644
--- a/BTCPayServer/Controllers/UILNURLController.cs
+++ b/BTCPayServer/Controllers/UILNURLController.cs
@@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/UIManageController.cs b/BTCPayServer/Controllers/UIManageController.cs
index 418fc6632..7321d2bec 100644
--- a/BTCPayServer/Controllers/UIManageController.cs
+++ b/BTCPayServer/Controllers/UIManageController.cs
@@ -1,6 +1,7 @@
using System;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Extensions;
diff --git a/BTCPayServer/Controllers/UINotificationsController.cs b/BTCPayServer/Controllers/UINotificationsController.cs
index 339e2ef82..2783b9929 100644
--- a/BTCPayServer/Controllers/UINotificationsController.cs
+++ b/BTCPayServer/Controllers/UINotificationsController.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Data;
diff --git a/BTCPayServer/Controllers/UIPaymentRequestController.cs b/BTCPayServer/Controllers/UIPaymentRequestController.cs
index 89551f4b2..572fba6a4 100644
--- a/BTCPayServer/Controllers/UIPaymentRequestController.cs
+++ b/BTCPayServer/Controllers/UIPaymentRequestController.cs
@@ -2,6 +2,7 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Form;
diff --git a/BTCPayServer/Controllers/UIPullPaymentController.cs b/BTCPayServer/Controllers/UIPullPaymentController.cs
index ecc4bcc1f..ae32eb123 100644
--- a/BTCPayServer/Controllers/UIPullPaymentController.cs
+++ b/BTCPayServer/Controllers/UIPullPaymentController.cs
@@ -6,6 +6,7 @@ using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Amazon.S3.Model;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Controllers/UIReportsController.cs b/BTCPayServer/Controllers/UIReportsController.cs
index a5a2ffac6..9951c3572 100644
--- a/BTCPayServer/Controllers/UIReportsController.cs
+++ b/BTCPayServer/Controllers/UIReportsController.cs
@@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using System.Threading;
+using BTCPayApp.CommonServer;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Controllers;
diff --git a/BTCPayServer/Controllers/UIServerController.Users.cs b/BTCPayServer/Controllers/UIServerController.Users.cs
index 5e0fea2d5..4ab4388d1 100644
--- a/BTCPayServer/Controllers/UIServerController.Users.cs
+++ b/BTCPayServer/Controllers/UIServerController.Users.cs
@@ -2,6 +2,7 @@ using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Controllers/UIServerController.cs b/BTCPayServer/Controllers/UIServerController.cs
index 3d90a4ec5..232ba5fb8 100644
--- a/BTCPayServer/Controllers/UIServerController.cs
+++ b/BTCPayServer/Controllers/UIServerController.cs
@@ -39,7 +39,7 @@ using MimeKit;
using NBitcoin;
using NBitcoin.DataEncoders;
using Renci.SshNet;
-using AuthenticationSchemes = BTCPayServer.Abstractions.Constants.AuthenticationSchemes;
+using AuthenticationSchemes = BTCPayApp.CommonServer.AuthenticationSchemes;
namespace BTCPayServer.Controllers
{
diff --git a/BTCPayServer/Controllers/UIStorePullPaymentsController.PullPayments.cs b/BTCPayServer/Controllers/UIStorePullPaymentsController.PullPayments.cs
index f3a34dcbb..63c82cab2 100644
--- a/BTCPayServer/Controllers/UIStorePullPaymentsController.PullPayments.cs
+++ b/BTCPayServer/Controllers/UIStorePullPaymentsController.PullPayments.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Controllers/UIStoresController.Dashboard.cs b/BTCPayServer/Controllers/UIStoresController.Dashboard.cs
index bb1d5b8f4..9d2b6ae01 100644
--- a/BTCPayServer/Controllers/UIStoresController.Dashboard.cs
+++ b/BTCPayServer/Controllers/UIStoresController.Dashboard.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Components.StoreLightningBalance;
diff --git a/BTCPayServer/Controllers/UIStoresController.Email.cs b/BTCPayServer/Controllers/UIStoresController.Email.cs
index eaeaa9b4c..fbb778741 100644
--- a/BTCPayServer/Controllers/UIStoresController.Email.cs
+++ b/BTCPayServer/Controllers/UIStoresController.Email.cs
@@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Controllers/UIStoresController.Integrations.cs b/BTCPayServer/Controllers/UIStoresController.Integrations.cs
index ec6bd3e43..132ff58de 100644
--- a/BTCPayServer/Controllers/UIStoresController.Integrations.cs
+++ b/BTCPayServer/Controllers/UIStoresController.Integrations.cs
@@ -2,6 +2,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Models;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/UIStoresController.LightningLike.cs b/BTCPayServer/Controllers/UIStoresController.LightningLike.cs
index a74902919..a59d6986a 100644
--- a/BTCPayServer/Controllers/UIStoresController.LightningLike.cs
+++ b/BTCPayServer/Controllers/UIStoresController.LightningLike.cs
@@ -3,6 +3,7 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/UIStoresController.Onchain.cs b/BTCPayServer/Controllers/UIStoresController.Onchain.cs
index 3a2a8cdfa..0debb1e69 100644
--- a/BTCPayServer/Controllers/UIStoresController.Onchain.cs
+++ b/BTCPayServer/Controllers/UIStoresController.Onchain.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Controllers/UIStoresController.Rates.cs b/BTCPayServer/Controllers/UIStoresController.Rates.cs
index 6305a27e7..9c7ed53c2 100644
--- a/BTCPayServer/Controllers/UIStoresController.Rates.cs
+++ b/BTCPayServer/Controllers/UIStoresController.Rates.cs
@@ -5,6 +5,7 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Models;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/UIStoresController.Roles.cs b/BTCPayServer/Controllers/UIStoresController.Roles.cs
index b5bc9c34a..6c9bb2a58 100644
--- a/BTCPayServer/Controllers/UIStoresController.Roles.cs
+++ b/BTCPayServer/Controllers/UIStoresController.Roles.cs
@@ -1,5 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Controllers/UIStoresController.Settings.cs b/BTCPayServer/Controllers/UIStoresController.Settings.cs
index 65801a689..a1eb1a8ed 100644
--- a/BTCPayServer/Controllers/UIStoresController.Settings.cs
+++ b/BTCPayServer/Controllers/UIStoresController.Settings.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Controllers/UIStoresController.Tokens.cs b/BTCPayServer/Controllers/UIStoresController.Tokens.cs
index dfc69d380..63cc46a48 100644
--- a/BTCPayServer/Controllers/UIStoresController.Tokens.cs
+++ b/BTCPayServer/Controllers/UIStoresController.Tokens.cs
@@ -1,6 +1,7 @@
#nullable enable
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Models;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/UIStoresController.Users.cs b/BTCPayServer/Controllers/UIStoresController.Users.cs
index 784009c5b..282f0c153 100644
--- a/BTCPayServer/Controllers/UIStoresController.Users.cs
+++ b/BTCPayServer/Controllers/UIStoresController.Users.cs
@@ -2,6 +2,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Controllers/UIStoresController.cs b/BTCPayServer/Controllers/UIStoresController.cs
index 2e7c439a8..66bc417f4 100644
--- a/BTCPayServer/Controllers/UIStoresController.cs
+++ b/BTCPayServer/Controllers/UIStoresController.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/UIUserStoresController.cs b/BTCPayServer/Controllers/UIUserStoresController.cs
index 49eea105a..3489a6d7a 100644
--- a/BTCPayServer/Controllers/UIUserStoresController.cs
+++ b/BTCPayServer/Controllers/UIUserStoresController.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Models;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Controllers/UIVaultController.cs b/BTCPayServer/Controllers/UIVaultController.cs
index a39839a69..2c0e56cf1 100644
--- a/BTCPayServer/Controllers/UIVaultController.cs
+++ b/BTCPayServer/Controllers/UIVaultController.cs
@@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Data;
diff --git a/BTCPayServer/Controllers/UIWalletsController.cs b/BTCPayServer/Controllers/UIWalletsController.cs
index 51b774e78..8d25685b8 100644
--- a/BTCPayServer/Controllers/UIWalletsController.cs
+++ b/BTCPayServer/Controllers/UIWalletsController.cs
@@ -6,6 +6,7 @@ using System.Linq;
using System.Net.Mime;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Data/Payouts/LightningLike/UILightningLikePayoutController.cs b/BTCPayServer/Data/Payouts/LightningLike/UILightningLikePayoutController.cs
index bf0f1580a..0be5bfd42 100644
--- a/BTCPayServer/Data/Payouts/LightningLike/UILightningLikePayoutController.cs
+++ b/BTCPayServer/Data/Payouts/LightningLike/UILightningLikePayoutController.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Client.Models;
diff --git a/BTCPayServer/Extensions/AuthorizationExtensions.cs b/BTCPayServer/Extensions/AuthorizationExtensions.cs
index da1bc4f7b..7e0bc7037 100644
--- a/BTCPayServer/Extensions/AuthorizationExtensions.cs
+++ b/BTCPayServer/Extensions/AuthorizationExtensions.cs
@@ -1,5 +1,6 @@
using System.Security.Claims;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using BTCPayServer.Security.Bitpay;
diff --git a/BTCPayServer/Extensions/StoreExtensions.cs b/BTCPayServer/Extensions/StoreExtensions.cs
index e191c21ce..4ece38876 100644
--- a/BTCPayServer/Extensions/StoreExtensions.cs
+++ b/BTCPayServer/Extensions/StoreExtensions.cs
@@ -1,9 +1,7 @@
#nullable enable
-using System.Collections.Generic;
using System.Linq;
using BTCPayServer.Client;
using BTCPayServer.Data;
-using BTCPayServer.Payments;
using BTCPayServer.Services.Invoices;
namespace BTCPayServer
diff --git a/BTCPayServer/Fido2/UIFido2Controller.cs b/BTCPayServer/Fido2/UIFido2Controller.cs
index 273e387a4..f2e4df446 100644
--- a/BTCPayServer/Fido2/UIFido2Controller.cs
+++ b/BTCPayServer/Fido2/UIFido2Controller.cs
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Forms/UIFormsController.cs b/BTCPayServer/Forms/UIFormsController.cs
index 9f7251fb3..906cad709 100644
--- a/BTCPayServer/Forms/UIFormsController.cs
+++ b/BTCPayServer/Forms/UIFormsController.cs
@@ -3,6 +3,7 @@ using System;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Form;
diff --git a/BTCPayServer/HostedServices/UserEventHostedService.cs b/BTCPayServer/HostedServices/UserEventHostedService.cs
index f2d65936e..caa5b53a0 100644
--- a/BTCPayServer/HostedServices/UserEventHostedService.cs
+++ b/BTCPayServer/HostedServices/UserEventHostedService.cs
@@ -1,6 +1,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Data;
using BTCPayServer.Events;
using BTCPayServer.Logging;
diff --git a/BTCPayServer/Hosting/BTCPayServerServices.cs b/BTCPayServer/Hosting/BTCPayServerServices.cs
index b61d2fc5e..73724e779 100644
--- a/BTCPayServer/Hosting/BTCPayServerServices.cs
+++ b/BTCPayServer/Hosting/BTCPayServerServices.cs
@@ -69,6 +69,7 @@ using BTCPayServer.Services.Reporting;
using BTCPayServer.Services.WalletFileParsing;
using BTCPayServer.Payments.LNURLPay;
using System.Collections.Generic;
+using BTCPayApp.CommonServer;
using BTCPayServer.Payouts;
using ExchangeSharp;
using Laraue.EfCoreTriggers.PostgreSql.Extensions;
diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs
index 6b68fd0b6..40ffbbf3d 100644
--- a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs
+++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs
@@ -3,6 +3,7 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Client;
using BTCPayServer.Client.Models;
using BTCPayServer.Configuration;
diff --git a/BTCPayServer/PayoutProcessors/Lightning/UILightningAutomatedPayoutProcessorsController.cs b/BTCPayServer/PayoutProcessors/Lightning/UILightningAutomatedPayoutProcessorsController.cs
index f2ff31f46..365f3aa53 100644
--- a/BTCPayServer/PayoutProcessors/Lightning/UILightningAutomatedPayoutProcessorsController.cs
+++ b/BTCPayServer/PayoutProcessors/Lightning/UILightningAutomatedPayoutProcessorsController.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/PayoutProcessors/OnChain/UIOnChainAutomatedPayoutProcessorsController.cs b/BTCPayServer/PayoutProcessors/OnChain/UIOnChainAutomatedPayoutProcessorsController.cs
index 9d12bef12..0dd3aeab5 100644
--- a/BTCPayServer/PayoutProcessors/OnChain/UIOnChainAutomatedPayoutProcessorsController.cs
+++ b/BTCPayServer/PayoutProcessors/OnChain/UIOnChainAutomatedPayoutProcessorsController.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/PayoutProcessors/UIPayoutProcessorsController.cs b/BTCPayServer/PayoutProcessors/UIPayoutProcessorsController.cs
index 046494872..c28ed7717 100644
--- a/BTCPayServer/PayoutProcessors/UIPayoutProcessorsController.cs
+++ b/BTCPayServer/PayoutProcessors/UIPayoutProcessorsController.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
diff --git a/BTCPayServer/Plugins/Crowdfund/Controllers/UICrowdfundController.cs b/BTCPayServer/Plugins/Crowdfund/Controllers/UICrowdfundController.cs
index a1edaa088..ca954becb 100644
--- a/BTCPayServer/Plugins/Crowdfund/Controllers/UICrowdfundController.cs
+++ b/BTCPayServer/Plugins/Crowdfund/Controllers/UICrowdfundController.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Form;
diff --git a/BTCPayServer/Plugins/PayButton/Controllers/UIPayButtonController.cs b/BTCPayServer/Plugins/PayButton/Controllers/UIPayButtonController.cs
index 079ffecbb..d3bf33689 100644
--- a/BTCPayServer/Plugins/PayButton/Controllers/UIPayButtonController.cs
+++ b/BTCPayServer/Plugins/PayButton/Controllers/UIPayButtonController.cs
@@ -1,5 +1,6 @@
#nullable enable
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs b/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs
index 2904c6f41..87e2ac877 100644
--- a/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs
+++ b/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs
@@ -7,6 +7,7 @@ using System.Text.Encodings.Web;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Form;
diff --git a/BTCPayServer/Plugins/Shopify/UIShopifyController.cs b/BTCPayServer/Plugins/Shopify/UIShopifyController.cs
index 2a56dbe5c..8f1a94718 100644
--- a/BTCPayServer/Plugins/Shopify/UIShopifyController.cs
+++ b/BTCPayServer/Plugins/Shopify/UIShopifyController.cs
@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Roles.cs b/BTCPayServer/Roles.cs
deleted file mode 100644
index f76bf18ee..000000000
--- a/BTCPayServer/Roles.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace BTCPayServer
-{
- public class Roles
- {
- public const string ServerAdmin = "ServerAdmin";
- public static bool HasServerAdmin(IList roles)
- {
- return roles.Contains(Roles.ServerAdmin, StringComparer.Ordinal);
- }
- }
-}
diff --git a/BTCPayServer/Security/AuthenticationExtensions.cs b/BTCPayServer/Security/AuthenticationExtensions.cs
index b536d8c8f..b0215e75c 100644
--- a/BTCPayServer/Security/AuthenticationExtensions.cs
+++ b/BTCPayServer/Security/AuthenticationExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Security.Bitpay;
using Microsoft.AspNetCore.Authentication;
diff --git a/BTCPayServer/Security/Bitpay/BitpayAuthorizationHandler.cs b/BTCPayServer/Security/Bitpay/BitpayAuthorizationHandler.cs
index 112348483..0b84f846b 100644
--- a/BTCPayServer/Security/Bitpay/BitpayAuthorizationHandler.cs
+++ b/BTCPayServer/Security/Bitpay/BitpayAuthorizationHandler.cs
@@ -1,5 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Client;
using BTCPayServer.Data;
using BTCPayServer.Services.Stores;
diff --git a/BTCPayServer/Security/CookieAuthorizationHandler.cs b/BTCPayServer/Security/CookieAuthorizationHandler.cs
index 8f6ce4edd..83cf3a5df 100644
--- a/BTCPayServer/Security/CookieAuthorizationHandler.cs
+++ b/BTCPayServer/Security/CookieAuthorizationHandler.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Client;
diff --git a/BTCPayServer/Security/GreenField/APIKeyExtensions.cs b/BTCPayServer/Security/GreenField/APIKeyExtensions.cs
index c6be705b8..795d423d7 100644
--- a/BTCPayServer/Security/GreenField/APIKeyExtensions.cs
+++ b/BTCPayServer/Security/GreenField/APIKeyExtensions.cs
@@ -1,5 +1,6 @@
using System;
using System.Linq;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Client;
using Microsoft.AspNetCore.Authentication;
diff --git a/BTCPayServer/Security/GreenField/BearerAuthorizationHandler.cs b/BTCPayServer/Security/GreenField/BearerAuthorizationHandler.cs
deleted file mode 100644
index c20b8e6dd..000000000
--- a/BTCPayServer/Security/GreenField/BearerAuthorizationHandler.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-#nullable enable
-using System.Linq;
-using System.Threading.Tasks;
-using BTCPayServer.Client;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Identity;
-using Microsoft.Extensions.Options;
-using AuthenticationSchemes = BTCPayServer.Abstractions.Constants.AuthenticationSchemes;
-using StoreData = BTCPayServer.Client.Models.StoreData;
-
-namespace BTCPayServer.Security.GreenField;
-
-public class BearerAuthorizationHandler(IOptionsMonitor identityOptions)
- : AuthorizationHandler
-{
- //TODO: In the future, we will add these store permissions to actual aspnet roles, and remove this class.
- private static readonly PermissionSet _serverAdminRolePermissions = new([Permission.Create(Policies.CanViewStoreSettings)]);
-
- protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, PolicyRequirement requirement)
- {
- if (context.User.Identity?.AuthenticationType != AuthenticationSchemes.GreenfieldBearer)
- return;
-
- var userId = context.User.Claims.FirstOrDefault(c => c.Type == identityOptions.CurrentValue.ClaimsIdentity.UserIdClaimType)?.Value;
- if (string.IsNullOrEmpty(userId))
- return;
-
- var permissionSet = new PermissionSet();
- var success = false;
- var isAdmin = context.User.IsInRole(Roles.ServerAdmin);
- var storeId = context.Resource as string;
- var policy = requirement.Policy;
- var requiredUnscoped = false;
- if (policy.EndsWith(':'))
- {
- policy = policy[..^1];
- requiredUnscoped = true;
- storeId = null;
- }
-
- if (!string.IsNullOrEmpty(storeId))
- {
- var permissions = context.User.Claims.FirstOrDefault(c => c.Type == storeId)?.Value;
- if (!string.IsNullOrEmpty(permissions))
- {
- permissionSet = new PermissionSet(permissions.Split(',')
- .Select(s => Permission.TryCreatePermission(s, storeId, out var permission) ? permission : null)
- .Where(s => s != null).ToArray());
- }
- }
-
- if (Policies.IsServerPolicy(policy) && isAdmin)
- {
- success = true;
- }
- else if (Policies.IsUserPolicy(policy) && !string.IsNullOrEmpty(userId))
- {
- success = true;
- }
- else if (Policies.IsStorePolicy(policy) && !string.IsNullOrEmpty(storeId))
- {
- if (isAdmin && !string.IsNullOrEmpty(storeId))
- {
- success = _serverAdminRolePermissions.HasPermission(policy, storeId);
- }
-
- if (!success && permissionSet.HasPermission(policy, storeId))
- {
- success = true;
- }
-
- if (!success && requiredUnscoped && string.IsNullOrEmpty(storeId))
- {
- success = true;
- }
- }
- if (success)
- {
- context.Succeed(requirement);
- }
- }
-}
diff --git a/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs b/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs
index 7d01574b6..e87002fe0 100644
--- a/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs
+++ b/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Client;
using BTCPayServer.Data;
diff --git a/BTCPayServer/Services/Notifications/NotificationSender.cs b/BTCPayServer/Services/Notifications/NotificationSender.cs
index c02019206..c46cdb0e1 100644
--- a/BTCPayServer/Services/Notifications/NotificationSender.cs
+++ b/BTCPayServer/Services/Notifications/NotificationSender.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Data;
using Microsoft.AspNetCore.Identity;
diff --git a/BTCPayServer/Services/UserService.cs b/BTCPayServer/Services/UserService.cs
index 9b8bffb0d..d9f46c1f7 100644
--- a/BTCPayServer/Services/UserService.cs
+++ b/BTCPayServer/Services/UserService.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
+using BTCPayApp.CommonServer;
using BTCPayServer.Client.Models;
using BTCPayServer.Data;
using BTCPayServer.Events;
diff --git a/BTCPayServer/Views/UIStores/WalletSettings.cshtml b/BTCPayServer/Views/UIStores/WalletSettings.cshtml
index 23f272332..b6c726e5e 100644
--- a/BTCPayServer/Views/UIStores/WalletSettings.cshtml
+++ b/BTCPayServer/Views/UIStores/WalletSettings.cshtml
@@ -1,6 +1,7 @@
@using NBitcoin.DataEncoders
@using Newtonsoft.Json
@using System.Text
+@using BTCPayApp.CommonServer
@using BTCPayServer.Abstractions.Models
@inject BTCPayServer.Security.ContentSecurityPolicies Csp
@model WalletSettingsViewModel
diff --git a/BTCPayServer/Views/UIStores/_GenerateWalletForm.cshtml b/BTCPayServer/Views/UIStores/_GenerateWalletForm.cshtml
index 160318ad5..8429f7d3b 100644
--- a/BTCPayServer/Views/UIStores/_GenerateWalletForm.cshtml
+++ b/BTCPayServer/Views/UIStores/_GenerateWalletForm.cshtml
@@ -1,3 +1,4 @@
+@using BTCPayApp.CommonServer
@using NBitcoin
@model WalletSetupRequest