Impersonating with a client caller identity

When using Windows authentication for either the transport layer or the message layer, the client authenticated user identity will be associated with the corresponding service operation context as a WindowsIdentity instance. The service operation can check the name and roles of the identity, and in some cases we can also make the service operation code execute under the client authenticated user identity, which is commonly called identity impersonation. This recipe will demonstrate how we can perform client identity impersonation in a WCF service operation that uses a Windows authentication type.

Getting ready

Impersonation is quite common in distributed applications or component services (like ASP.NET, ...

Get Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.