【发布时间】:2020-01-30 20:53:50
【问题描述】:
看起来声明是使用 ASP.NET Core (3.1) 授权的方式,但我的问题是我们如何才能拥有整数值而不仅仅是字符串?我想在声明中存储一些 ID:
var userid = 123; // try "123"
var claimsIdentity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme);
claimsIdentity.AddClaim(new Claim(ClaimTypes.NameIdentifier, userid, ClaimValueTypes.Integer32));
或者有什么更好的方法吗? TIA
【问题讨论】:
标签: c# asp.net-core authorization