Just started getting to grips with WCF security. How do I list a user's roles at the service?
E.g.
// Could use declarative security here, i.e. using PrincipalPermission attribute
public string MyService()
{
// Would like some code that does something like:
foreach( Role role in CurrentUser.Roles )
{
}
}
Thanks
When dealing with Windows groups you can use this code:
foreach (IdentityReference idRef in WindowsIdentity.GetCurrent().Groups)
{
Console.WriteLine(idRef.Translate(typeof(NTAccount)).Value);
}