新增AuthenticationHelper认证助手,登录之后记录登录信息可用ClaimsPrincipal当事人(持证者)方式。登录注销均可异步

This commit is contained in:
xxred
2018-07-16 01:47:27 +08:00
parent 7fcb6d9450
commit 696959d7d4
7 changed files with 225 additions and 17 deletions
+5
View File
@@ -23,6 +23,7 @@ using Senparc.CO2NET.RegisterServices;
using Senparc.Weixin;
using Senparc.CO2NET.Cache;
using System.Configuration;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.Extensions.Options;
using Senparc.Weixin.RegisterServices;
@@ -77,6 +78,9 @@ namespace COMCMS.Web
});
services.AddSenparcGlobalServices(Configuration)//Senparc.CO2NET 全局注册
.AddSenparcWeixinServices(Configuration);//Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
//注册Cookie认证服务
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -108,6 +112,7 @@ namespace COMCMS.Web
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseAuthentication();
app.UseStaticHttpContext();
app.UseMvc(routes =>