Last active
September 23, 2016 03:34
-
-
Save scottcate/52d0c09fdf23587b4cb3b789b99c1f5b to your computer and use it in GitHub Desktop.
This file contains 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
using Newtonsoft.Json; | |
using definition; | |
public override async Task ProcessRequestAsync(HttpContext context) | |
{ | |
///... | |
///... | |
var auth = profile.AppMetadata["authorization"]; | |
if (auth !=null) | |
{ | |
//{{ "authorization": { "groups": [ "Administrator" ] }}} | |
AuthorizationGroup authorization = JsonConvert.DeserializeObject<AuthorizationGroup>(auth.ToString()); | |
foreach (var role in authorization.Groups) | |
{ | |
user.Add(new KeyValuePair<string, object>(ClaimTypes.Role, role)); | |
} | |
} | |
///... | |
///... | |
} |
This file contains 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
@if (User.IsInRole("Administrator")) | |
{ | |
<h1>Administrator.FTW</h1> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment