Muokkaa

Jaa


EndpointIdentity.CreateIdentity(Claim) Method

Definition

Creates an identity with the specified claim.

public:
 static System::ServiceModel::EndpointIdentity ^ CreateIdentity(System::IdentityModel::Claims::Claim ^ identity);
public static System.ServiceModel.EndpointIdentity CreateIdentity (System.IdentityModel.Claims.Claim identity);
static member CreateIdentity : System.IdentityModel.Claims.Claim -> System.ServiceModel.EndpointIdentity
Public Shared Function CreateIdentity (identity As Claim) As EndpointIdentity

Parameters

identity
Claim

A Claim used to create the new identity.

Returns

An EndpointIdentity associated with the specified identity.

Exceptions

identity is null.

Examples

The following code shows how to call this method.

// Utility function to create an EndpointIdentity from a ClaimSet.
private EndpointIdentity CreateIdentityFromClaimSet(ClaimSet claims)
{
    foreach (Claim claim in claims.FindClaims(null, Rights.Identity))
    {
        return EndpointIdentity.CreateIdentity(claim);
    }
    return null;
}

Remarks

A secure WCF client that connects to an endpoint with this identity verifies that the claims presented by the server contain the identity claim used to construct this identity.

This method can create an identity of type DnsEndpointIdentity, SpnEndpointIdentity, UpnEndpointIdentity, or RsaEndpointIdentity.

Applies to