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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.