I have the following situation (outline):
Authorization Webservice
This service gets called and verifies (by executing the given business logic) whether a user is valid or not.
Custom Business Webservice
This is some webservice created for a business app, that internally calls the "Authorization Webservice" in order to verify the account which called the business webservice.
I realized this logic by making use of WCF service authorization in my "Custom Business Webservice". Basically I configured
<serviceAuthorization principalPermissionMode="Custom">
<authorizationPolicies>
<add policyType="MyCompany.Authorization.WCF.AuthorizationPolicy, MyCompany.AuthorizationDll"/>
</authorizationPolicies>
</serviceAuthorization>
The AuthorizationPolicy
internally invokes the "Authorization Webservice".
The Problem
The problem is that I need to impersonate the caller of my "Custom Business Webservice". The client identity is the correct one, however the WindowsIdentity is that of the application pool user.
Note, impersonation works within the service itself if I use [OperationBehavior(Impersonation = ImpersonationOption.Required)]
but it does not within the AuthorizationPolicy's Evaluate(...)
method.
(I use Transport level security using windows authentication credentials, obviously)
Anyone has any hints on how I can impersonate the caller prior to entering the IAuthorizationPolicy.Evaluate(...)
method??