refactor: 设置网站Cookie Domain设置逻辑变更

#Comment
如果没有配置Domain,程序不设置Cookie Domain
This commit is contained in:
Argo Zhang 2019-05-11 08:42:02 +08:00
parent 49ab346d37
commit 3800ffc98a
2 changed files with 2 additions and 2 deletions

View File

@ -83,7 +83,7 @@ namespace Bootstrap.Admin
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options =>
{ {
options.Cookie.Path = "/"; options.Cookie.Path = "/";
options.Cookie.Domain = Configuration["Domain"]; if (!string.IsNullOrEmpty(Configuration["Domain"])) options.Cookie.Domain = Configuration["Domain"];
}); });
services.AddApiVersioning(option => services.AddApiVersioning(option =>
{ {

View File

@ -60,7 +60,7 @@ namespace Bootstrap.Client
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options =>
{ {
options.Cookie.Path = "/"; options.Cookie.Path = "/";
options.Cookie.Domain = Configuration["Domain"]; if (!string.IsNullOrEmpty(Configuration["Domain"])) options.Cookie.Domain = Configuration["Domain"];
options.RebuildRedirectUri(Configuration["AuthHost"]); options.RebuildRedirectUri(Configuration["AuthHost"]);
}); });
} }