ClaimsPrincipal.Identity Property

.NET Framework (current version)
 

Gets the primary claims identity associated with this claims principal.

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

Public Overridable ReadOnly Property Identity As IIdentity

Property Value

Type: System.Security.Principal.IIdentity

The primary claims identity associated with this claims principal.

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.

Universal Windows Platform
Available since 10
.NET Framework
Available since 4.5
Return to top
Show: