For my WCF services I've implemented an IAuthorizationPolicy and hooked it up (and can confirm that it's being used).
In the Evaluate() method I am setting a custom principal like so:
evaluationContext.Properties["Principal"] = myCustomPrincipal;
However, when the service is invoked, Thread.CurrentPrincipal is a GenericPrincipal!
My service behavior is configured as follows:
<serviceAuthorization principalPermissionMode="Custom">
<authorizationPolicies>
<add policyType="MyNamespace.MyPrincipalAuthorizationPolicy, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</authorizationPolicies>
</serviceAuthorization>
I tried to use reflector to see what was going on but didn't see anything useful.
Am I doing it wrong? Is there some configuration I'm missing?