Created
August 30, 2019 14:20
-
-
Save shammelburg/320fe029a9dda07f6f167e3e174d38ac to your computer and use it in GitHub Desktop.
WebAPI AzureAD Authorization snippets
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
[Authorize(Policy = "GroupOfUsers")] | |
public ActionResult Get() | |
{ | |
return Ok(); | |
} |
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) | |
{ | |
services.AddAuthorization(o => | |
{ | |
o.AddPolicy("GroupOfUsers", policy => policy.RequireClaim("groups", "3916f0cf-d728-48c4-b18b-e3a29e852c12", "5169a59e-a4c6-44c2-b6ec-dff6910fb2f4")); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment