views:

98

answers:

1

I have an application that hosts several WCF services. I have created a custom ServiceAuthorizationManager that is working perfectly. I inspect a few elements on the OperationContext.IncomingMessageHeaders to get a username and password. This was to overcome some limitations in our environment that wouldnt allow us to use what was built into the platform. the manager creates a custom IPrincpal, with a few necessary custom objects in it, and places it on the currently running thread, for use later in the WCF business logic. this is Working great.

Problem is that I have a WCF service that is a workflow, and I need to use the same mechanism there. The Manager is being called correctly, however when executing the Thread's currentPrincpal isn't my custom principal, it's a genericprincipal. Investigation shows that the workflow runtime is creating a thread, and not using the thread that the WCF call came in on.

Has anyone run into this issue, and are there any good solutions to it?

A: 

If the runtime is in the same appdomain as the manager then you should be able to call

AppDomain.CurrentDomain.SetThreadPrincipal

See here for more information

Preet Sangha