Wednesday, October 26, 2011

Impersonation and Delegation in WCF

Impersonation is a technique that WCF Services use to authorize the caller’s identity to access to service resources such as files and database tables. Service resources can be located either on local service machine or remotely hosted. The resources are being accessed by WCF Service’s process identity or specific windows identity.    

Difference between Impersonation and Delegation in WCF?

Impersonation is used to access the resources when the resources are on the same machine as the service. Delegation is used to access the resources that are remotely hosted.

There are two types of Impersonation in WCF

    Imperative Impersonation – Perform programmatically at run time
    Declarative Impersonation – Applied with a static attribute which associated with an operation.

Use Impersonation when

    You want to access windows resources that are protected with access control lists(ACL’s).
    You need to use specific identity or several windows identities to access resources.

Use Delegation when

    You need to access network resources.

Declarative Impersonation

[OperationBehavior(Impersonation = ImpersonationOption.Required)]
public string GetData(int value)
    return “test”;

Read more: Techbubles

Posted via email from Jasper-Net