diff --git a/VirtoCommerce.Storefront/Startup.cs b/VirtoCommerce.Storefront/Startup.cs index 064b6a7ff..047f68e9a 100644 --- a/VirtoCommerce.Storefront/Startup.cs +++ b/VirtoCommerce.Storefront/Startup.cs @@ -199,7 +199,7 @@ public void ConfigureServices(IServiceCollection services) //and it can lead to platform access denied for them. (TODO: Need to remove after platform migration to .NET Core) services.Configure(option => option.CompatibilityMode = PasswordHasherCompatibilityMode.IdentityV2); services.Configure(Configuration.GetSection("IdentityOptions")); - services.Configure(Configuration.GetSection("CookieAuthenticationOptions")); + services.Configure(IdentityConstants.ApplicationScheme, Configuration.GetSection("CookieAuthenticationOptions")); services.AddIdentity(options => { }).AddDefaultTokenProviders(); services.Configure(options => @@ -208,6 +208,12 @@ public void ConfigureServices(IServiceCollection services) options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); + // The Tempdata provider cookie is not essential. Make it essential + // so Tempdata is functional when tracking is disabled. + services.Configure(options => + { + options.Cookie.IsEssential = true; + }); //Add Liquid view engine services.AddLiquidViewEngine(options => @@ -218,6 +224,11 @@ public void ConfigureServices(IServiceCollection services) var snapshotProvider = services.BuildServiceProvider(); services.AddMvc(options => { + //Workaround to avoid 'Null effective policy causing exception' (on logout) + //https://github.com/aspnet/Mvc/issues/7809 + //TODO: Try to remove in ASP.NET Core 2.2 + options.AllowCombiningAuthorizeFilters = false; + options.CacheProfiles.Add("Default", new CacheProfile() { Duration = (int)TimeSpan.FromHours(1).TotalSeconds,