📜  生成 jwt 令牌授权(角色 = 管理员)不工作 .net 核心 403 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:59.655000             🧑  作者: Mango

代码示例2
var claims = new List
            {
                new Claim(JwtRegisteredClaimNames.Sub, user.UserName),
                new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
                new Claim(ClaimTypes.NameIdentifier, user.Id),
                new Claim(ClaimTypes.Role,"The Role Of the logged in user, you can get from your DB")
            };