Created
February 19, 2018 11:08
-
-
Save shammelburg/eb3a7481f3a2309f4ecb8f9edff60385 to your computer and use it in GitHub Desktop.
Azure AD | ASP.NET Core | Check if user is in Policy Group
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
private IAuthorizationService _AuthorizationService; | |
public HomeController(IAuthorizationService AuthorizationService) | |
{ | |
this._AuthorizationService = AuthorizationService; | |
} | |
[Authorize(Policy = "SecurityGroup")] | |
public async Task<IActionResult> About() | |
{ | |
if((await _AuthorizationService.AuthorizeAsync(User, "SecurityGroup")).Succeeded) | |
{ | |
// | |
} | |
return View(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment