Override Windows auth using global.asax?

Discussion in 'ASP .Net Security' started by gbrowins@gmail.com, Jun 29, 2010.

  1. Guest

    Here's my environment
    Win2003 Standard SP2, IIS 6.0, MOSS 2007, .NET 2.0.50727

    IIS website uses MOSS 2007 "Team Site" template and has only IWA
    enabled. Web.config has Windows auth w/ Impersonation:
    <authentication mode="Windows" />
    <identity impersonate="true" />

    IE HTTP headers shows that NTLM authentication occurs for workstation
    user. In global.asax, I've defined
    WindowsAuthentication_OnAuthenticate() and can see incoming the
    Principal/Identity values as:
    WindowsAuthenticationEventArgs.Identity.Name = ACME\testuser
    WindowsAuthenticationEventArgs.Identity.AuthenticationType =
    Negotiate
    HttpContext.User.Identity = null
    Thread.CurrentPrincipal.Identity = <blank>

    I'm using the KerbS4U extension to create a new WindowsIdentity which
    is then used to create a WindowsPrincipal for the new/overriding user:
    WindowsIdentity winid = new WindowsIdentity("");
    WindowsPrincipal princ = new WindowsPrincipal(winid);

    These succeed and I set the new principal to HttpContext.Current.User
    & Thread.CurrentPrincipal without errors. I've defined both
    Application_AuthenticateRequest() and
    Application_PostAuthenticateRequest() functions in global.asax. These
    show the "new" Identity in the HttpContext.Current.User &
    Thread.CurrentPrincipal, but the "Welcome <DOMAIN\username>" in the
    upper-right menu of the default.aspx homepage itself still shows the
    name from the initial IWA!

    Does anyone have any ideas about where this is breaking down?

    -Gregg
    , Jun 29, 2010
    #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. =?Utf-8?B?Q2hyaXMgTW9oYW4=?=

    Configuring Windows Auth & Forms Auth in Asp.Net

    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=, Apr 28, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    686
    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=
    Apr 28, 2004
  2. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    821
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  3. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,152
    Mark Rae
    May 23, 2006
  4. gbrowins
    Replies:
    0
    Views:
    1,107
    gbrowins
    Jun 28, 2010
  5. Ed Staffin
    Replies:
    1
    Views:
    331
    Ken Schaefer
    Apr 17, 2006
Loading...

Share This Page