fix(#I12T0Y): 支持QQ浏览器兼容模式

#Comment
comment #I12T0Y

#Issue
link https://gitee.com/LongbowEnterprise/dashboard/issues?id=I12T0Y
This commit is contained in:
Argo Zhang 2019-09-28 00:49:19 +08:00
parent 456363d952
commit 8b3ffcee03
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,7 @@
using Bootstrap.DataAccess;
using Longbow.Web;
using Longbow.Web.SignalR;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@ -60,7 +61,8 @@ namespace Bootstrap.Admin
services.AddSignalR().AddJsonProtocalDefault();
services.AddSignalRExceptionFilterHandler<SignalRHub>((client, ex) => client.SendMessageBody(ex).ConfigureAwait(false));
services.AddResponseCompression();
services.AddBootstrapAdminAuthentication().AddGitee(OAuthHelper.Configure).AddGitHub(OAuthHelper.Configure);
// 兼容 QQ 浏览器兼容模式
services.AddBootstrapAdminAuthentication(configureCookies: ConfigureCookie).AddGitee(OAuthHelper.Configure).AddGitHub(OAuthHelper.Configure);
services.AddSwagger();
services.AddButtonAuthorization(MenuHelper.AuthorizateButtons);
services.AddBootstrapAdminBackgroundTask();
@ -122,5 +124,11 @@ namespace Bootstrap.Admin
app.UseSwagger(Configuration["SwaggerPathBase"].TrimEnd('/'));
app.UseMvcWithDefaultRoute();
}
private void ConfigureCookie(CookieAuthenticationOptions options)
{
var supportQQ = Configuration.GetValue("SupportQQBrowser", false);
if (supportQQ) options.Cookie.SameSite = SameSiteMode.None;
}
}
}

View File

@ -15,6 +15,7 @@
"ConnectionStrings": {
"ba": "Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa"
},
"SupportQQBrowser": false,
"DB": [
{
"Enabled": false,