Re: Setting Principal for HttpWorkerRequest

From: Mike Moore [MSFT] (michmo@online.microsoft.com)
Date: 03/25/03


From: michmo@online.microsoft.com (Mike Moore [MSFT])
Date: Tue, 25 Mar 2003 00:57:18 GMT


Hi,

With off-line communication, we found this solution for Steve:

1)
        Dim g As New System.Security.Principal.GenericIdentity(...)
        HttpContext.Current.User = g

2)
Place the above in an HTTPModule so that it affects the entire application.
For information on writing modules:
308000 HOW TO: Create an ASP.NET HTTP Module Using Visual Basic .NET
http://support.microsoft.com/?id=308000

Thank you, Mike Moore
Microsoft, ASP.NET

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

--------------------
| >X-Tomcat-ID: 20009685
| >References: <Ojhhd$B5CHA.3024@TK2MSFTNGP10.phx.gbl>
<mVCoQMF6CHA.2496@cpmsftngxa06> <#9yRSRb6CHA.1624@TK2MSFTNGP11.phx.gbl>
| >MIME-Version: 1.0
| >Content-Type: text/plain
| >Content-Transfer-Encoding: 7bit
| >From: michmo@online.microsoft.com ("Mike Moore [MSFT]")
| >Organization: Microsoft
| >Date: Sat, 15 Mar 2003 00:54:23 GMT
| >Subject: Re: Setting Principal for HttpWorkerRequest
| >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
| >Message-ID: <APaZd1o6CHA.1864@cpmsftngxa06>
| >Newsgroups: microsoft.public.dotnet.framework.aspnet.security
| >Lines: 109
| >NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
| >Path: cpmsftngxa08.phx.gbl!cpmsftngxa06
| >Xref: cpmsftngxa08.phx.gbl
microsoft.public.dotnet.framework.aspnet.security:4397
| >
| >Hi Stephen,
| >
| >I'd like to put you in touch with one of my coworkers. Can you contact
me
| >directly? Remove "online." from my no spam alias:
| >michmo@online.microsoft.com.
| >
| >For other readers, we will post the results after we finish our
discussion.
| >
| >Thank you, Mike Moore
| >Microsoft, ASP.NET
| >
| >This posting is provided "AS IS", with no warranties, and confers no
rights.
| >
| >--------------------
| >>From: "Stephen Walch" <swalch@proposion.com>
| >>References: <Ojhhd$B5CHA.3024@TK2MSFTNGP10.phx.gbl>
| ><mVCoQMF6CHA.2496@cpmsftngxa06>
| >>Subject: Re: Setting Principal for HttpWorkerRequest
| >>Date: Thu, 13 Mar 2003 18:00:26 -0500
| >>Lines: 86
| >>X-Priority: 3
| >>X-MSMail-Priority: Normal
| >>X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
| >>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| >>Message-ID: <#9yRSRb6CHA.1624@TK2MSFTNGP11.phx.gbl>
| >>Newsgroups: microsoft.public.dotnet.framework.aspnet.security
| >>NNTP-Posting-Host: 65.205.13.190
| >>Path: cpmsftngxa06!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| >>Xref: cpmsftngxa06
microsoft.public.dotnet.framework.aspnet.security:4343
| >>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
| >>
| >>Thank you, but this thread does not have anything to do with setting the
| >>Identity/Principal for a request. Maybe I should explain what I want a
| >>little better:
| >>
| >>I am implementing my own server that will authenticate users using
| >>out-of-band methods (like IIS does in the case of Windows
authentication).
| >>I am implementing an HttpWorkerRequest and asking HttpRuntime to
process
| >the
| >>request. I expect existing ASP.NET applications to work without
changes,
| >>but if those applications happen to examine
| >>HttpContext.Current.User.Identity or HttpContext.Principal, they should
see
| >>the credentials that my code set in advance.
| >>
| >>Thanks,
| >>
| >>Steve
| >>
| >>""Mike Moore [MSFT]"" <michmo@online.microsoft.com> wrote in message
| >>news:mVCoQMF6CHA.2496@cpmsftngxa06...
| >>> Hi Stephen,
| >>>
| >>> I found some sample code by searching Google on the words:
| >>> HttpWorkerRequest ProcessRequest
| >>>
| >>> It's a thread (conversation) from 7/25/2002 with subject:
| >>ApplicationHost
| >>> gives a NullReferenceException when processing ...
| >>>
| >>> Here's a link to the thread (please pardon the line breaks):
| >>>
| >>> http://groups.google.com/groups?
| >>> q=group:microsoft.public.dotnet.framework+insubject:
| >>> NullReferenceException&hl=en&lr=&ie=UTF-8&oe=
| >>> UTF-8&as_drrb=b&as_mind=12&as_minm=5&as_miny
| >>> =2002&as_maxd=11&as_maxm=3&as_maxy=2003&
| >>> selm=18ab78a0.0207250430.3f2a29ff%40posting.
| >>> google.com&rnum=1
| >>>
| >>> Thank you, Mike Moore
| >>> Microsoft, ASP.NET
| >>>
| >>> This posting is provided "AS IS", with no warranties, and confers no
| >>rights.
| >>>
| >>>
| >>> --------------------
| >>> >From: "Stephen Walch" <swalch@proposion.com>
| >>> >Subject: Setting Principal for HttpWorkerRequest
| >>> >Date: Thu, 6 Mar 2003 15:35:14 -0500
| >>> >Lines: 15
| >>> >X-Priority: 3
| >>> >X-MSMail-Priority: Normal
| >>> >X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
| >>> >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| >>> >Message-ID: <Ojhhd$B5CHA.3024@TK2MSFTNGP10.phx.gbl>
| >>> >Newsgroups: microsoft.public.dotnet.framework.aspnet.security
| >>> >NNTP-Posting-Host: ma-amesbury2b-224.mrrmnh.adelphia.net 24.53.5.224
| >>> >Path:
| >>>
|
>>cpmsftngxa08.phx.gbl!cpmsftngxa06!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gb
l
| >>> >Xref: cpmsftngxa08.phx.gbl
| >>> microsoft.public.dotnet.framework.aspnet.security:4236
| >>> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
| >>> >
| >>> >I am implementing an ASP.NET server (similar to Cassini) and am
trying
| >to
| >>> >think through how I would go about adding my own authentication to
| >(based
| >>> on
| >>> >information I am able to extract from the raw HTTP request). It
looks
| >>like
| >>> >my ultimate goal is to set HTTPContext.Principal with a principal
that
| >>> >contains the appropriate identity, roles, etc.
| >>> >
| >>> >So if I have created an HttpWorkerRequest and am about to call
| >>> >HttpRuntime.ProcessRequest, what else do I need to do? I see that
the
| >>> >HTTPContext takes HttpWorkerRequest in its constructor, so I deduce
that
| >>> the
| >>> >Principal is somehow created from the HttpWorkerRequest, but I can't
| >>figure
| >>> >out how.
| >>> >
| >>> >Any guidelines would be much appreciated. Thanks!
| >>> >
| >>> >
| >>> >
| >>>
| >>
| >>
| >>
| >
| >



Relevant Pages

  • RE: Integrated Authentication Issues with ISA 2004
    ... Microsoft CSS Online Newsgroup Support ... Integrated Authentication Issues with ISA 2004 ... >fulfill the request Access to the Web Proxy service is denied " ...
    (microsoft.public.isa)
  • RE: Integrated Authentication Issues with ISA 2004
    ... Microsoft CSS Online Newsgroup Support ... Integrated Authentication Issues with ISA 2004 ... it will not pass your authentication to the ISA Server. ... >> request can pass ISA Server. ...
    (microsoft.public.isa)
  • Re: Setting Principal for HttpWorkerRequest
    ... Identity/Principal for a request. ... I am implementing an HttpWorkerRequest and asking HttpRuntime to process the ... I expect existing ASP.NET applications to work without changes, ... the credentials that my code set in advance. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Setting Principal for HttpWorkerRequest
    ... I am implementing an ASP.NET server (similar to Cassini) and am trying to ... think through how I would go about adding my own authentication to (based on ... HTTPContext takes HttpWorkerRequest in its constructor, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • ReadEntityBody problem
    ... I'm trying to read files from the request using the ReadEntityBody method on the HttpWorkerRequest. ... Most of the time it works fine to get chunks from the request but sometimes it takes a long time before this function returns and it doesn't read any bytes. ...
    (microsoft.public.dotnet.framework.aspnet)