仅使用 Claim Type
要满足此策略,必须存在“Edit Role”声明
services.AddAuthorization(options =>
{
options.AddPolicy("EditRolePolicy", policy => policy.RequireClaim("Edit Role"));
});
ClaimType 与 ClaimValue
要满足此策略,“Edit Role”声明必须具有 true 值
services.AddAuthorization(options =>
{
options.AddPolicy("EditRolePolicy", policy => policy.RequireClaim("Edit Role", "true"));
});