From 1fc114fec7dc1c2b0036046ad7d1edbd39f82364 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Tue, 23 Mar 2021 17:42:49 +0900 Subject: [PATCH] Check the authentication cookie every 5 min rather than 30min --- BTCPayServer/Hosting/BTCPayServerServices.cs | 1 - BTCPayServer/Hosting/Startup.cs | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/Hosting/BTCPayServerServices.cs b/BTCPayServer/Hosting/BTCPayServerServices.cs index e15a88ce6..668105e89 100644 --- a/BTCPayServer/Hosting/BTCPayServerServices.cs +++ b/BTCPayServer/Hosting/BTCPayServerServices.cs @@ -448,7 +448,6 @@ namespace BTCPayServer.Hosting private static void AddBtcPayServerAuthenticationSchemes(this IServiceCollection services) { services.AddAuthentication() - .AddCookie() .AddBitpayAuthentication() .AddAPIKeyAuthentication(); } diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs index e3c572532..9181aad6b 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -10,6 +10,7 @@ using BTCPayServer.Plugins; using BTCPayServer.Security; using BTCPayServer.Services.Apps; using BTCPayServer.Storage; +using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Hosting; @@ -53,6 +54,19 @@ namespace BTCPayServer.Hosting services.AddIdentity() .AddEntityFrameworkStores() .AddDefaultTokenProviders(); + services.Configure(opts => + { + opts.DefaultAuthenticateScheme = null; + opts.DefaultChallengeScheme = null; + opts.DefaultForbidScheme = null; + opts.DefaultScheme = IdentityConstants.ApplicationScheme; + opts.DefaultSignInScheme = null; + opts.DefaultSignOutScheme = null; + }); + services.Configure(opts => + { + opts.ValidationInterval = TimeSpan.FromMinutes(5.0); + }); services.AddBTCPayServer(Configuration); services.AddProviderStorage();