OperationBehaviorAttribute::Impersonation Property
Gets or sets a value that indicates the level of caller impersonation that the operation supports.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
public: property ImpersonationOption Impersonation { ImpersonationOption get(); void set(ImpersonationOption value); }
Property Value
Type: System.ServiceModel::ImpersonationOptionOne of the ImpersonationOption values. The default is NotAllowed.
Use the Impersonation property (together with a binding configuration that supports impersonation) to enable specified methods (those marked with the Impersonation property set to Allowed or Required) to execute under the caller's identity. For details, including how impersonation is performed when using Allowed together with the ServiceAuthorizationBehavior::ImpersonateCallerForAllOperations property, see Delegation and Impersonation with WCF and How to: Impersonate a Client on a Service.
Note |
|---|
When programmatically adding a service endpoint that performs impersonation, you must either use one of the AddServiceEndpoint methods or the ContractDescription::GetContract method to properly load the contract into a new System.ServiceModel.Description::ServiceDescription object. Using a configuration file requires no extra step. |
There may be specific scenarios when impersonation is not supported. For more information, seeUnsupported Scenarios.
The following service code example requires impersonation by setting the Impersonation property to Required.
The following code example shows using the ClientCredentials property to set the client application credentials prior to invoking the operation that requires those credentials for impersonation.
Available since 3.0
