ClaimsPrincipal.Identity Property

.NET Framework 4.5

Gets the primary claims identity associated with this claims principal.

Namespace:  System.Security.Claims
Assembly:  mscorlib (in mscorlib.dll)

public virtual IIdentity Identity { get; }

Property Value

Type: System.Security.Principal.IIdentity
The primary claims identity associated with this claims principal.

Implements

IPrincipal.Identity

By default, the framework prioritizes identities of type WindowsIdentity when returning the identity. The first WindowsIdentity found in the Identities collection is returned. If there is no WindowsIdentity in the collection, the first identity assignable from ClaimsIdentity is returned. If there is no ClaimsIdentity, null is returned. If the Identities collection is empty, an ArgumentNullException is thrown.

You can change the default behavior by setting the PrimaryIdentitySelector property to specify a delegate to be called to determine the identity.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft