如何添加多个 cookie 方案aspnet core 2.0
?
我已按照此处Auth 2.0 迁移公告 和此处将身份验证和身份迁移到 ASP.NET Core 2.0 的说明进行操作, 但我无法添加多个方案。
例如:
services.AddAuthentication("myscheme1").AddCookie(o =>{
o.ExpireTimeSpan = TimeSpan.FromHours(1);
o.LoginPath = new PathString("/forUser");
o.Cookie.Name = "token1";
o.SlidingExpiration = true;
});
services.AddAuthentication("myscheme2").AddCookie(o =>{
o.ExpireTimeSpan = TimeSpan.FromHours(1);
o.LoginPath = new PathString("/forAdmin");
o.Cookie.Name = "token2";
o.SlidingExpiration = true;
});