.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

WebServiceHost2Factory is forcing Thread.CurrentPrincipal to RoleProviderPrincipal instead of my cus

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :WCF
 
Hi gang, I've been working through various samples to try and piece together a solution for SAML token-based authentication for ASP.Net and WCF RESTful services...  some of the samples I've been referencing: http://custombasicauth.codeplex.com/Wikipage http://www.leastprivilege.com/SecuringWCFDataServicesUsingWIF.aspx http://weblogs.asp.net/cibrax/archive/2010/02/17/a-good-way-to-handle-claim-based-security-in-restful-services.aspx etc... I've been battling my way through each roadblock, and I'm so close I can taste it.  The latest block that's got me is this: If I use the regular WebServiceHostFactory, the custom authorization policies are applied and Thread.CurrentPrincipal ends up taking the value that my HttpModule set for HttpContext.Current.User...   but...  if I use the WebServiceHost2Factory (i.e. from the REST Starter Kit) to gain the auto help endpoint, etc...,  then the auth policies aren't applied, and the Thread.CurrentPrincipal ends up being an instance of RoleProviderPrincipal in no way related to the ClaimsPrincipal I set in the HttpModule..   :-( Any thoughts, ideas how to get the WebServiceHost2Factory to play nice with the custom / overridden principal? Thanks, Tyler  


View Complete Post


More Related Resource Links

Weird Thread.CurrentPrincipal behavior

  
msdn has a code sample illustrating the use of SetPrincipalPolicy. I copy the code and the output below:

using System;
using System.Security.Principal;
using System.Threading;

class ADPrincipal
{
    static void Main(string[] args)
    {
        // Create a new thread with a generic principal.
        Thread t = new Thread(new ThreadStart(PrintPrincipalInformation));
        t.Start();
        t.Join();

        // Set the principal policy to WindowsPrincipal.
        AppDomain currentDomain = AppDomain.CurrentDomain;
        currentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
           
        // The new thread will have a Windows principal representing the
        // current user.
        t = new Thread(new ThreadStart(PrintPrincipalInformation));
        t.Start();
        t.Join();

Remoting Issue - Authentication Type changes from Kerberos to NTLM in Thread.CurrentPrincipal.Identi

  

Am facing followingproblem, Authentication Type changes from Kerberos to NTLM in Thread.CurrentPrincipal.Identity where as the user name comes properly while calling the method of service2 through remoting from service1.

Actually the problem scenario is as follows, from client am making calls to service1 and from the service1 am making the call to another service2 where the problem occurs.

             Kerberos                              NTML
Client ----------------> Server1 -------------------------> another service2
         remoting call                      remoting call

But When I made the remoting call from the client directly to service2, am getting the security type as Kerberos properly.

Please advise.

Am running out of time, looking for you valuable comments...!!!

 

Thanks


Thread Performance: Resource Contention Concurrency Profiling in Visual Studio 2010

  

Visual Studio 2010 includes new resource contention profiling features that help detect concurrency contention among threads. We walk through a profiling investigation to demonstrate how you can pinpoint and fix resource contention problems in your code.

Maxim Goldin

MSDN Magazine June 2010


Thread Diagnostics: Performance Tuning with The Concurrency Visualizer in Visual Studio 2010

  

Understanding performance bottlenecks in multithreaded apps used to require significant instrumentation and analysis by expert developers. The Concurrency Visualizer in Visual Studio 2010 significantly reduces the burden of parallel performance analysis.

Hazim Shafi

MSDN Magazine March 2010


CLR Inside Out: Thread Management In The CLR

  

Getting the performance you want in concurrent applications is not as straightforward as you might think. See how common threading issues can affect your application.

Erika Fuentes and Eric Eilebrecht

MSDN Magazine December 2008


Editor's Note: new Thread(ReadEditorsNote).Start(); yourAttention.WaitOne();

  

Introducing the issue, Howard Dierking points out that you can't simply parallelize your code blindly if you expect to truly reap the benefits that parallelism promises.

Howard Dierking

MSDN Magazine October 2008


Pooled Threads: Improve Scalability With New Thread Pool APIs

  

The new threadpool APIs in Windows Vista and in the upcoming Windows Server 2008 provide advances that even native Windows developers can benefit from.

Robert Saccone

MSDN Magazine October 2007


Concurrent Affairs: Build a Richer Thread Synchronization Lock

  

In my last column, I showed the various thread synchronization mechanisms employed by the Microsoft® . NET Framework (see Concurrent Affairs: Performance-Conscious Thread Synchronization). I then examined the performance characteristics of all these mechanisms and determined that the Interlocked methods performed the best because the calling thread never has to transition to kernel mode.

Jeffrey Richter

MSDN Magazine March 2006


Concurrent Affairs: Performance-Conscious Thread Synchronization

  

In my career, I have architected and implemented many thread synchronization techniques. This has provided me with a lot of experience that has shaped the way I now think about thread synchronization problems.

Jeffrey Richter

MSDN Magazine October 2005


Basic Instincts: Thread Synchronization

  

My last three Basic Instincts columns have examined techniques for using asynchronous delegates and creating secondary threads. Those columns demonstrated how to introduce multithreaded behavior into your applications.

Ted Pattison

MSDN Magazine September 2004


.NET Column: The CLR's Thread Pool

  

How does the thread pool work in the CLR?

Jeffrey Richter

MSDN Magazine June 2003


.NET Column: Safe Thread Synchronization

  

By far, the most common use of thread synchronization is to ensure mutually exclusive access to a shared resource by multiple threads. In the Win32® API, the CRITICAL_SECTION structure and associated functions offers the fastest and most efficient way to synchronize threads for mutually exclusive access when the threads are all running in a single process.

Jeffrey Richter

MSDN Magazine January 2003


Windows CE 3.0: Enhanced Real-Time Features Provide Sophisticated Thread Handling

  

Windows CE is a small, configurable, feature-rich, real-time operating system. In Windows CE 3.0, the real-time support has been improved. This article looks at specific support for the creation of real-time systems and how it compares to the support in Windows for the desktop. The way interrupt handlers, processes, memory management, and synchronization work in Windows CE 3.0 is discussed. An extensive look at threads and thread priority, misconceptions surrounding them, and their impact on performance is included. Refinements to the Windows CE scheduler and support for nestable interrupts are also covered.

Paul Yao

MSDN Magazine November 2000


how to start and stop thread with button

  

hi all,

i am new to threading.

im trying to write a simple application which will update a textbox (on other thread) when button clicked.

and stops when clicking on "stop".

 

when i click on the "start" it  starts but for some reason the app freezes, when i debug the prog i can see it  is running  but the main window stays frozen.

 

please help.


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend