I'm running into a weird problem with Thread.CurrentPrincipal
. I implemented my own custom IAuthorizationPolicy
in WCF. In Evaluate() method, I set evaluateContext.Properties["Principal"] = <my custom principal>.
I can see that later on my Thread.CurrentPrincipal correctly contains my custom principal. The problem that I'm running into is that when I check Thread.CurrentPrincipal in ProvideFault()
method of a class that implements IErrorHandler
interface (this is for logging my WCF exceptions), it's somehow reset back generic principal. Now I thought that ProvideFault runs on the same thread, so why in a world is Thread.CurrentPrincipal is suddenly reset?
Thanks in advance,
Eric