From e00136de93625a9f7fa42b5256ffb03cc7380804 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sun, 26 Jan 2020 15:02:40 +0900 Subject: [PATCH] Fix spurious DefaultAntiforgery errors --- BTCPayServer/Hosting/Startup.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs index 3aac9ae7e..541f5cb3f 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.DataProtection; using Microsoft.Extensions.Hosting; using OpenIddict.Validation.AspNetCore; using OpenIddict.Abstractions; @@ -49,6 +50,9 @@ namespace BTCPayServer.Hosting Logs.Configure(LoggerFactory); services.ConfigureBTCPayServer(Configuration); services.AddMemoryCache(); + services.AddDataProtection() + .SetApplicationName("BTCPay Server") + .PersistKeysToFileSystem(GetDataDir()); services.AddIdentity() .AddEntityFrameworkStores() .AddDefaultTokenProviders(); @@ -140,6 +144,11 @@ namespace BTCPayServer.Hosting } } + private DirectoryInfo GetDataDir() + { + return new DirectoryInfo(Configuration.GetDataDir(DefaultConfiguration.GetNetworkType(Configuration))); + } + private void ConfigureOpenIddict(IServiceCollection services) { // Register the OpenIddict services.