Skip to content

Instantly share code, notes, and snippets.

@shammelburg
Created August 30, 2019 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shammelburg/320fe029a9dda07f6f167e3e174d38ac to your computer and use it in GitHub Desktop.
Save shammelburg/320fe029a9dda07f6f167e3e174d38ac to your computer and use it in GitHub Desktop.
WebAPI AzureAD Authorization snippets
[Authorize(Policy = "GroupOfUsers")]
public ActionResult Get()
{
return Ok();
}
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