Dependency Injection on Authorization Policy
问题 I want to create a claim based authorization for my ASP.NET Core app: public void ConfigureServices(IServiceCollection services) { services.AddAuthorization(options => { options.AddPolicy("Founders", policy => policy.RequireClaim("EmployeeNumber", "1", "2", "3", "4", "5")); }); } The problem is that I have a non trivial method to resolve the employee numbers (1 to 5) and I want to use a DI service: public interface IEmployeeProvider { string[] GetAuthorizedEmployeeIds(); } I would like to