Re: Setting Principal for HttpWorkerRequest

From: Mike Moore [MS] (michmo@online.microsoft.com)
Date: 04/19/03


From: michmo@online.microsoft.com ("Mike Moore [MS]")
Date: Fri, 18 Apr 2003 22:10:21 GMT


Hi Frank,

I apologize for the delay in answering you. I've been on vacation and will
investigate this further on Monday.

Thank you, Mike Moore
Microsoft, ASP.NET

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

--------------------
| >From: "Frank" <msdndev@bourier.de>
| >References: <Ojhhd$B5CHA.3024@TK2MSFTNGP10.phx.gbl>
<mVCoQMF6CHA.2496@cpmsftngxa06> <#9yRSRb6CHA.1624@TK2MSFTNGP11.phx.gbl>
<APaZd1o6CHA.1864@cpmsftngxa06> <f6wLllm8CHA.1864@cpmsftngxa06>
| >Subject: Re: Setting Principal for HttpWorkerRequest
| >Date: Fri, 11 Apr 2003 09:16:19 +0200
| >Lines: 208
| >X-Priority: 3
| >X-MSMail-Priority: Normal
| >X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| >Message-ID: <Obu#co$$CHA.2368@TK2MSFTNGP10.phx.gbl>
| >Newsgroups: microsoft.public.dotnet.framework.aspnet.security
| >NNTP-Posting-Host: pd9e6a4c0.dip0.t-ipconnect.de 217.230.164.192
| >Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| >Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet.security:4770
| >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
| >
| >Hallo,
| >
| >why is the call(different Principals)
| >
| >System.Threading.Thread.CurrentPrincipal
| >
| >different from the call
| >Context.User
| >
| >I would like to use PrincipalPermission and User.IsinRole in a normal
| >WebService Method. For that reason i have to set the
| >Thread.CurrentPrincipal, but the User has another Principal, so i have
set
| >the user Context.User with the new GenericUser, too. Why?
| >
| >Frank
| >--
| >---------------------------
| >To send an eMail remove NOSPAM
| >"Mike Moore [MSFT]" <michmo@online.microsoft.com> schrieb im Newsbeitrag
| >news:f6wLllm8CHA.1864@cpmsftngxa06...
| >> 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.g
b
| >> 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: Setting Principal for HttpWorkerRequest
    ... why is the call(different Principals) ... > Thank you, Mike Moore ... > Microsoft, ASP.NET ... > |>>Subject: Re: Setting Principal for HttpWorkerRequest ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Grant child objects rights to parent
    ... This is one of the main complaints I hear from Netware admins. ... don't believe Microsoft have any plans to change containers to Security ... principals. ... Microsoft MVP - Windows Server - Directory Services ...
    (microsoft.public.windows.server.active_directory)