S
SpaceMarine
hello,
im having a little problem w/ role-based security and ActiveDirectory
(AD), hoping someone can help. im trying to restrict access to my app
to only users within a particular AD group. details:
- ASP.NET 3.5 intranet app; Visual Studio 2008
- deployed to a Windows Server 2008 (IIS7) machine
- uses Windows authentication
- all desired domain users reside in a custom AD group, "FOO_BAR".
- requesting the User.Identity.Name yields: "OURDOMAIN\SomeUserName"
- requesting all group membership yields:
Everyone
OURDOMAIN\Domain Users
OURDOMAIN\FOO_BAR
....all looks good. so the problem? when i request:
User.IsInRole(@"OURDOMAIN\FOO_BAR") or
User.IsInRole("FOO_BAR") or
....i get False.
this is problematic because in my web.config im trying to restrict
access to the group-only:
<authorization>
<!-- Allow only group users -->
<allow roles="FOO_BAR"/>
<deny users="*"/>
<deny users="?"/>
</authorization>
any idea whats up? i read that ASP.NET's role-based security model
should be able to pick up a Windows-authenticated AD user's groups as
roles. is this not the case?
thanks!
sm
ps - here is how i get a loop of a user's group memberships...useful:
//convert user's groups to readable NT thang
IdentityReferenceCollection usersGroups = WindowsIdentity.GetCurrent
().Groups.Translate(System.Type.GetType
("System.Security.Principal.NTAccount"));
StringBuilder sb = new StringBuilder(200);
foreach (IdentityReference group in usersGroups)
sb.Append(group.Value + "<br/>");
im having a little problem w/ role-based security and ActiveDirectory
(AD), hoping someone can help. im trying to restrict access to my app
to only users within a particular AD group. details:
- ASP.NET 3.5 intranet app; Visual Studio 2008
- deployed to a Windows Server 2008 (IIS7) machine
- uses Windows authentication
- all desired domain users reside in a custom AD group, "FOO_BAR".
- requesting the User.Identity.Name yields: "OURDOMAIN\SomeUserName"
- requesting all group membership yields:
Everyone
OURDOMAIN\Domain Users
OURDOMAIN\FOO_BAR
....all looks good. so the problem? when i request:
User.IsInRole(@"OURDOMAIN\FOO_BAR") or
User.IsInRole("FOO_BAR") or
....i get False.
this is problematic because in my web.config im trying to restrict
access to the group-only:
<authorization>
<!-- Allow only group users -->
<allow roles="FOO_BAR"/>
<deny users="*"/>
<deny users="?"/>
</authorization>
any idea whats up? i read that ASP.NET's role-based security model
should be able to pick up a Windows-authenticated AD user's groups as
roles. is this not the case?
thanks!
sm
ps - here is how i get a loop of a user's group memberships...useful:
//convert user's groups to readable NT thang
IdentityReferenceCollection usersGroups = WindowsIdentity.GetCurrent
().Groups.Translate(System.Type.GetType
("System.Security.Principal.NTAccount"));
StringBuilder sb = new StringBuilder(200);
foreach (IdentityReference group in usersGroups)
sb.Append(group.Value + "<br/>");