diff --git a/Bootstrap.Admin/Startup.cs b/Bootstrap.Admin/Startup.cs index c95dd5ba..2ee0d6bf 100644 --- a/Bootstrap.Admin/Startup.cs +++ b/Bootstrap.Admin/Startup.cs @@ -80,7 +80,11 @@ namespace Bootstrap.Admin options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; JsonConvert.DefaultSettings = () => options.SerializerSettings; }).SetCompatibilityVersion(CompatibilityVersion.Version_2_2); - services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => options.Cookie.Path = "/"); + services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => + { + options.Cookie.Path = "/"; + options.Cookie.Domain = Configuration["Domain"]; + }); services.AddApiVersioning(option => { option.DefaultApiVersion = new ApiVersion(1, 0); diff --git a/Bootstrap.Admin/appsettings.Development.json b/Bootstrap.Admin/appsettings.Development.json index f3add900..202ab083 100644 --- a/Bootstrap.Admin/appsettings.Development.json +++ b/Bootstrap.Admin/appsettings.Development.json @@ -17,6 +17,7 @@ }, "SwaggerPathBase": "", "AllowOrigins": "http://localhost:49185", + "Domain": null, "KeyPath": "..\\keys", "DisableAutomaticKeyGeneration": false, "LongbowCache": { diff --git a/Bootstrap.Admin/appsettings.json b/Bootstrap.Admin/appsettings.json index d23cca70..cb71eb2f 100644 --- a/Bootstrap.Admin/appsettings.json +++ b/Bootstrap.Admin/appsettings.json @@ -51,6 +51,7 @@ ], "SwaggerPathBase": "/BA", "AllowOrigins": "http://localhost,http://argo.zylweb.cn", + "Domain": null, "KeyPath": "..\\keys", "ApplicationName": "__bd__", "ApplicationDiscriminator": "BootstrapAdmin", diff --git a/Bootstrap.Client/Startup.cs b/Bootstrap.Client/Startup.cs index c304491d..99734319 100644 --- a/Bootstrap.Client/Startup.cs +++ b/Bootstrap.Client/Startup.cs @@ -60,6 +60,7 @@ namespace Bootstrap.Client services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => { options.Cookie.Path = "/"; + options.Cookie.Domain = Configuration["Domain"]; options.RebuildRedirectUri(Configuration["AuthHost"]); }); } diff --git a/Bootstrap.Client/appsettings.Development.json b/Bootstrap.Client/appsettings.Development.json index 1ea4fc1f..a55f84de 100644 --- a/Bootstrap.Client/appsettings.Development.json +++ b/Bootstrap.Client/appsettings.Development.json @@ -32,5 +32,6 @@ ], "KeyPath": "..\\keys", "AuthHost": "http://localhost:50852", - "AllowOrigins": "http://localhost:50852" + "AllowOrigins": "http://localhost:50852", + "Domain": null } diff --git a/Bootstrap.Client/appsettings.json b/Bootstrap.Client/appsettings.json index de1e128b..6c18a691 100644 --- a/Bootstrap.Client/appsettings.json +++ b/Bootstrap.Client/appsettings.json @@ -30,6 +30,7 @@ ], "AppId": 2, "AuthHost": "http://argo.zylweb.cn/BA", + "Domain": null, "AllowOrigins": "http://localhost,http://argo.zylweb.cn", "KeyPath": "..\\keys", "ApplicationName": "__bd__",