I need some help, I am making a role based menu. I'm using LDAP Active Directory to log In.
I can log in but I cannot get the roles from the groups of AD.
I try to use a role provider but cant get it to work. I get the groups using:
private ArrayList setRoles()
{
ArrayList rolesList = new ArrayList();
DirectoryEntry de = new DirectoryEntry("LDAP://**********");
DirectorySearcher ds = new DirectorySearcher(de);
ds.PropertiesToLoad.Add("memberOf");
ds.SearchScope = SearchScope.Subtree;
ds.Filter = "(sAMAccountName=test)"; // your username
SearchResult result = ds.FindOne();
foreach (string g in result.Properties["memberOf"])
rolesList.Add(g);
return rolesList;
}
Now, I need to "set" the roles somewhere in order to use
User.IsInRole("Admin")
and
[Authorize role...]
public bla bla bla()
Any ideas, links, etc?
PD: IM USING FORMS AUTH.