Getting Group Membership

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default 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
    Raterus Guest

  2. Similar Questions and Discussions

    1. ASP.NET - Basic/SSL - Changes in user group membership delayed
      Background: An ASP.NET application, using Basic/SSL authentication with users residing in an Active Directory in the same domain as the web server,...
    2. Membership site
      I have just started to do dynamic Sites. I have completed a tutorial for a Record Store that taught me how to use templates to create a PHP site for...
    3. Checking group membership
      In ASP.Net I'm trying to check for some users membership of a group. The user is not nessicerily the user requesting the page, and I do not have...
    4. LDAP group membership query
      I am trying to query an NDS tree using the Win32::OLE and Win32::OLE::Enum modules. I was able to traverse the tree and gather all the group...
    5. Membership of group
      Hi All, I know that exist "innetgr" function in C, to test the membership of an user to a netgroup. I would like to know if a similar...
  3. #2

    Default 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.
    [url]http://weblogs.asp.net/hernandl[/url]


    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


    Hernan de Lahitte Guest

  4. #3

    Default 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.
    > [url]http://weblogs.asp.net/hernandl[/url]
    >
    >
    > 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 Guest

  5. #4

    Default Getting Group Membership

    you have to query roles in the DOMAIN\GroupName format...



    ---
    Dominick Baier - DevelopMentor
    [url]http://www.leastprivilege.com[/url]

    nntp://news.microsoft.com/microsoft.public.dotnet.framework.aspnet.security/<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

    [microsoft.public.dotnet.framework.aspnet.security]
    Dominick Baier Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139