isinrole reverts to windowsprincipal?

Discussion in 'ASP .Net Security' started by Vic, Nov 26, 2004.

  1. Vic

    Vic Guest

    I'm trying to assign all roles (AD and custom pulled from SQL Table)
    to users when they login to the app using Windows Authentication. The
    code works fine for local users but fails for AD users if the IIS
    server is a member server of the domain. It does seem to work however
    if the IIS server is a domain controller (not an option,
    unfortunately).

    In the global.asax under the WindowsAuthentication_OnAuthenticate
    event I grab all the WindowsPrincipal roles using reflection
    (...GetMethod("GetRoles"...), grab all the custom roles from the db,
    create a GenericPrincipal and assign them. I then assign the
    GenericPrincipal to the HttpContext.Current.User.

    On my first default.aspx page, I use reflection again to parse out the
    roles of my HttpContext.User (...GetField("m_roles"...) and it returns
    successfully all the roles I have assigned in the global.asax. The
    HttpContext.Current.User.IsInRole("...") however consistently returns
    false when checking for any of the SQL roles added, yet works for the
    rest.

    It seems that in the cases where it fails (windows authentication
    against AD using AD account on an IIS member server), the IsInRole
    seems to query exclusively against the ORIGINAL WindowsPrincipal,
    regardless of what I attempt in my code. I have tried creating my own
    custom principal class, played with impersonate options, tried using
    Thread instead of HttpContext, etc... to no avail.

    Anyone able to shed some light on why this is happening? And
    hopefully provide me with a solution?

    Victor
     
    Vic, Nov 26, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. plaztik via DotNetMonster.com

    ASP.Net Site Reverts to old version

    plaztik via DotNetMonster.com, May 4, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    429
    plaztik via DotNetMonster.com
    May 4, 2005
  2. DaBrain
    Replies:
    0
    Views:
    530
    DaBrain
    Nov 2, 2006
  3. naijacoder naijacoder

    WindowsPrincipal.IsInRole() problem with non-builtin roles

    naijacoder naijacoder, Aug 30, 2004, in forum: ASP .Net Security
    Replies:
    4
    Views:
    278
    Joe Kaplan \(MVP - ADSI\)
    Sep 2, 2004
  4. David Jessee

    WindowsPrincipal.IsInRole() is Being Flaky. Help!!

    David Jessee, Mar 10, 2005, in forum: ASP .Net Security
    Replies:
    3
    Views:
    271
    Joe Kaplan \(MVP - ADSI\)
    Mar 11, 2005
  5. Warren Sarle
    Replies:
    1
    Views:
    120
    web.dev
    Jun 1, 2006
Loading...

Share This Page