Created
May 29, 2018 20:18
-
-
Save wellingtonjhn/818144a4625bcad602d110c5e3dfb351 to your computer and use it in GitHub Desktop.
Configure Policy Requirement Handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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