Created
June 16, 2017 21:52
-
-
Save trailmax/8dd0064e7a1a178a2060c1709e77fb64 to your computer and use it in GitHub Desktop.
AspNetPrincipalProxy
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
// Defers the use of runtime data after object graph construction | |
// see: https://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=99 | |
public sealed class AspNetPrincipalProxy : IPrincipal | |
{ | |
public IIdentity Identity => User.Identity; | |
public bool IsInRole(string role) => User.IsInRole(role); | |
private IPrincipal User => HttpContext.Current.User; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment