📅  最后修改于: 2022-03-11 14:56:38.192000             🧑  作者: Mango
using App.Client.Services;
using App.Shared;
...
namespace App.Client
{
public class Program
{
public static async Task Main(string[] args)
{
...
builder.Services.AddAuthorizationCore(options => options.AddAppPolicies());
// 2 calls to AddApiAuthorization are necessary in 3.2-preview3
// should be fixed in 3.2-preview4
// https://github.com/dotnet/aspnetcore/issues/19854
// https://github.com/dotnet/AspNetCore.Docs/issues/17649#issuecomment-612442543
builder.Services.AddApiAuthorization();
builder.Services.AddApiAuthorization(options =>
{
options.UserOptions.RoleClaim = "role";
});
...
}
}
}