Skip to content

Instantly share code, notes, and snippets.

@wellingtonjhn
Created May 29, 2018 20:18
Show Gist options
  • Save wellingtonjhn/818144a4625bcad602d110c5e3dfb351 to your computer and use it in GitHub Desktop.
Save wellingtonjhn/818144a4625bcad602d110c5e3dfb351 to your computer and use it in GitHub Desktop.
Configure Policy Requirement Handler
public void ConfigureServices(IServiceCollection services)
{
// ... restante do códito omitido
services.AddAuthorization(options =>
{
options.AddPolicy("DeleteUserPolicy", policy =>
policy.Requirements.Add(new DeleteUserRequirement("CanDeleteUser")));
});
services.AddSingleton<IAuthorizationHandler, DeleteUserRequirementHandler>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment