From 3800ffc98ae60a5b951a879d4cb2e0f82813190a Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 11 May 2019 08:42:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=AE=BE=E7=BD=AE=E7=BD=91?= =?UTF-8?q?=E7=AB=99Cookie=20Domain=E8=AE=BE=E7=BD=AE=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Comment 如果没有配置Domain,程序不设置Cookie Domain --- Bootstrap.Admin/Startup.cs | 2 +- Bootstrap.Client/Startup.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bootstrap.Admin/Startup.cs b/Bootstrap.Admin/Startup.cs index 2ee0d6bf..de5d3eb1 100644 --- a/Bootstrap.Admin/Startup.cs +++ b/Bootstrap.Admin/Startup.cs @@ -83,7 +83,7 @@ namespace Bootstrap.Admin services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => { options.Cookie.Path = "/"; - options.Cookie.Domain = Configuration["Domain"]; + if (!string.IsNullOrEmpty(Configuration["Domain"])) options.Cookie.Domain = Configuration["Domain"]; }); services.AddApiVersioning(option => { diff --git a/Bootstrap.Client/Startup.cs b/Bootstrap.Client/Startup.cs index 99734319..97c435ac 100644 --- a/Bootstrap.Client/Startup.cs +++ b/Bootstrap.Client/Startup.cs @@ -60,7 +60,7 @@ namespace Bootstrap.Client services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => { options.Cookie.Path = "/"; - options.Cookie.Domain = Configuration["Domain"]; + if (!string.IsNullOrEmpty(Configuration["Domain"])) options.Cookie.Domain = Configuration["Domain"]; options.RebuildRedirectUri(Configuration["AuthHost"]); }); }