Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Security (http://www.velocityreviews.com/forums/f62-asp-net-security.html)
-   -   Getting Group Membership (http://www.velocityreviews.com/forums/t766548-getting-group-membership.html)

Raterus 09-09-2004 03:23 PM

Getting Group Membership
 
Hi,

I'm trying to do something that I think should be pretty easy, take the user who is authenticated with the application (intranet application/ integrated windows authentication), and determine if they are in "this group".

Before, I had queried active directory, got the list of groups for the user and compared, but then I realized that the IsInRole Function may actually work in this case. I tried it and it doesn't seem to be working correctly. Here is what I've tried so far.

I'm impersonating in my application, so I tried this....didn't work
Dim blah As WindowsPrincipal = New WindowsPrincipal(System.Security.Principal.Windows Identity.GetCurrent())
If blah.IsInRole("Domain Admins") = True Then
'is a domain admin
End If

Then I tried this:
If HttpContext.Current.User.IsInRole("Domain Admins") = True Then
'is a domain admin
End If

Still didn't return true (I am a member of this group too!) Am I missing something here, or so I just go back to querying active directory myself for group membership?

Thanks for any help!
--Michael

Hernan de Lahitte 09-09-2004 07:01 PM

Re: Getting Group Membership
 
Try to add the domain before the group name (i.e. "domain\\Domain Admins" )

--
Hernan de Lahitte
Lagash Systems S.A.
http://weblogs.asp.net/hernandl


This posting is provided "AS IS" with no warranties, and confers no rights.

"Raterus" <moc.liamtoh@suretar.reverse> wrote in message
news:e9sUFEolEHA.3968@TK2MSFTNGP11.phx.gbl...
Hi,

I'm trying to do something that I think should be pretty easy, take the user
who is authenticated with the application (intranet application/ integrated
windows authentication), and determine if they are in "this group".

Before, I had queried active directory, got the list of groups for the user
and compared, but then I realized that the IsInRole Function may actually
work in this case. I tried it and it doesn't seem to be working correctly.
Here is what I've tried so far.

I'm impersonating in my application, so I tried this....didn't work
Dim blah As WindowsPrincipal = New
WindowsPrincipal(System.Security.Principal.Windows Identity.GetCurrent())
If blah.IsInRole("Domain Admins") = True Then
'is a domain admin
End If

Then I tried this:
If HttpContext.Current.User.IsInRole("Domain Admins") = True Then
'is a domain admin
End If

Still didn't return true (I am a member of this group too!) Am I missing
something here, or so I just go back to querying active directory myself for
group membership?

Thanks for any help!
--Michael



Raterus 09-10-2004 12:37 PM

Re: Getting Group Membership
 
That did it!, thanks

"Hernan de Lahitte" <hernan@lagash.com> wrote in message news:eriBf6plEHA.3016@tk2msftngp13.phx.gbl...
> Try to add the domain before the group name (i.e. "domain\\Domain Admins" )
>
> --
> Hernan de Lahitte
> Lagash Systems S.A.
> http://weblogs.asp.net/hernandl
>
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Raterus" <moc.liamtoh@suretar.reverse> wrote in message
> news:e9sUFEolEHA.3968@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> I'm trying to do something that I think should be pretty easy, take the user
> who is authenticated with the application (intranet application/ integrated
> windows authentication), and determine if they are in "this group".
>
> Before, I had queried active directory, got the list of groups for the user
> and compared, but then I realized that the IsInRole Function may actually
> work in this case. I tried it and it doesn't seem to be working correctly.
> Here is what I've tried so far.
>
> I'm impersonating in my application, so I tried this....didn't work
> Dim blah As WindowsPrincipal = New
> WindowsPrincipal(System.Security.Principal.Windows Identity.GetCurrent())
> If blah.IsInRole("Domain Admins") = True Then
> 'is a domain admin
> End If
>
> Then I tried this:
> If HttpContext.Current.User.IsInRole("Domain Admins") = True Then
> 'is a domain admin
> End If
>
> Still didn't return true (I am a member of this group too!) Am I missing
> something here, or so I just go back to querying active directory myself for
> group membership?
>
> Thanks for any help!
> --Michael
>
>



All times are GMT. The time now is 12:36 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57