看起来在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