EndpointIdentity.CreateIdentity(Claim) Method

Definition

Creates an identity with the specified claim.

C#
public static System.ServiceModel.EndpointIdentity CreateIdentity(System.IdentityModel.Claims.Claim identity);

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.

C#
// 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

Producto Versiones
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)