net core 3.1 Authorize
2021-02-03 14:16
标签:认证 await domain scheme code div dex log lis net core 3.1 Authorize 标签:认证 await domain scheme code div dex log lis 原文地址:https://www.cnblogs.com/LiuFengH/p/13156803.htmlnet core 3.1 Authorize
1
//配置authorrize
services.AddAuthentication(b =>
{
b.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
b.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
b.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
}).
AddCookie(b =>
{
//登陆地址
b.LoginPath = "/login";
//sid
b.Cookie.Name = "My_SessionId";
// b.Cookie.Domain = "shenniu.core.com";
b.Cookie.Path = "/";
b.Cookie.HttpOnly = true;
//b.Cookie.Expiration = new TimeSpan(0, 0, 30);
b.ExpireTimeSpan = new TimeSpan(0, 0, 30);
});
2.
Configure
//启用身份认证,启用后可以在Controller中使用User API
app.UseAuthentication();
3.
string name = "罗分明";
//登陆授权
var claims = new List
上一篇:一个图标网站的兴衰
下一篇:css_selector定位总结
文章标题:net core 3.1 Authorize
文章链接:http://soscw.com/index.php/essay/50458.html