我遵循了本指南https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-v2-aspnet-core-webapp
接下来,我在下面添加了一项保单声明。并用:[Authorize(Policy =“ CanAccessUsersGroup”)]装饰我的家庭控制器
但是我得到一个错误:https://localhost:44321/Account/AccessDenied?ReturnUrl=%2F 我想念什么? 谢谢彼得
services.AddAuthorization(options =>
{
options.AddPolicy(
"CanAccessUsersGroup",
policyBuilder => policyBuilder.RequireClaim("groups", "c50bc813-f8a7-442f-83ab-eeb406474c08"));
});