Created
May 24, 2013 14:02
-
-
Save daanl/5643746 to your computer and use it in GitHub Desktop.
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 class User : IPrincipal | |
{ | |
public User(string username, IEnumerable<string> roles) | |
{ | |
Username = username; | |
Roles = roles; | |
} | |
public string Username { get; private set; } | |
public IEnumerable<string> Roles { get; private set; } | |
public bool IsInRole(string role) | |
{ | |
return Roles.Any(x => x.Equals(role, StringComparison.InvariantCultureIgnoreCase)); | |
} | |
public IIdentity Identity | |
{ | |
get { return new GenericIdentity(Username);} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment