|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;
namespace WtfService
{
public class WtfPrincipal : IPrincipal
{
IIdentity _identity;
string[] _roles;
public WtfPrincipal(IIdentity identity)
{
_identity = identity;
LoadUsersRoles();
}
/// <summary>
/// we should load up the user's roles from the database here based on username
/// </summary>
private void LoadUsersRoles()
{
//run query using on db using _identity.Name
//then put into _role
_roles = new string[] { "WtfUser" };
}
public IIdentity Identity
{
get { return _identity; }
}
public bool IsInRole(string role)
{
if (_roles.Contains(role))
return true;
else
return false;
}
public string[] Roles
{
get { return _roles; }
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Has a background in Finance and Software development.
Has worked as a RAD developer for the likes of Credit-Suisse and Westpac Banking corporation.
Currently self-employed working on some personal projects.