Override Windows auth using global.asax?

Discussion in '.NET' started by gbrowins, Jun 28, 2010.

  1. gbrowins

    gbrowins

    Joined:
    Jun 28, 2010
    Messages:
    1
    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:
    Code:
       <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:
    Code:
       WindowsIdentity winid = new WindowsIdentity("newuser@acme.com");
       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
     
    gbrowins, Jun 28, 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:
    760
    =?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:
    914
    =?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,211
    Mark Rae
    May 23, 2006
  4. Ed Staffin
    Replies:
    1
    Views:
    400
    Ken Schaefer
    Apr 17, 2006
  5. gbrowins@gmail.com

    Override Windows auth using global.asax?

    gbrowins@gmail.com, Jun 29, 2010, in forum: ASP .Net Security
    Replies:
    0
    Views:
    1,579
    gbrowins@gmail.com
    Jun 29, 2010
Loading...

Share This Page