ClaimsIdentity Class

ClaimsIdentity Class

.NET Framework (current version)
 

Represents a claims-based identity.

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


<SerializableAttribute>
<ComVisibleAttribute(True)>
Public Class ClaimsIdentity
	Implements IIdentity

NameDescription
System_CAPS_pubmethodClaimsIdentity()

Initializes a new instance of the ClaimsIdentity class with an empty claims collection.

System_CAPS_pubmethodClaimsIdentity(BinaryReader)

System_CAPS_protmethodClaimsIdentity(ClaimsIdentity)

System_CAPS_pubmethodClaimsIdentity(IEnumerable(Of Claim))

Initializes a new instance of the ClaimsIdentity class using an enumerated collection of Claim objects.

System_CAPS_pubmethodClaimsIdentity(IEnumerable(Of Claim), String)

Initializes a new instance of the ClaimsIdentity class with the specified claims and authentication type.

System_CAPS_pubmethodClaimsIdentity(IEnumerable(Of Claim), String, String, String)

Initializes a new instance of the ClaimsIdentity class with the specified claims, authentication type, name claim type, and role claim type.

System_CAPS_pubmethodClaimsIdentity(IIdentity)

Initializes a new instance of the ClaimsIdentity class using the name and authentication type from the specified IIdentity.

System_CAPS_pubmethodClaimsIdentity(IIdentity, IEnumerable(Of Claim))

Initializes a new instance of the ClaimsIdentity class using the specified claims and the specified IIdentity.

System_CAPS_pubmethodClaimsIdentity(IIdentity, IEnumerable(Of Claim), String, String, String)

Initializes a new instance of the ClaimsIdentity class from the specified IIdentity using the specified claims, authentication type, name claim type, and role claim type.

System_CAPS_protmethodClaimsIdentity(SerializationInfo)

Initializes a new instance of the ClaimsIdentity class from a serialized stream created by using ISerializable.

System_CAPS_protmethodClaimsIdentity(SerializationInfo, StreamingContext)

Initializes a new instance of the ClaimsIdentity class from a serialized stream created by using ISerializable.

System_CAPS_pubmethodClaimsIdentity(String)

Initializes a new instance of the ClaimsIdentity class with an empty claims collection and the specified authentication type.

System_CAPS_pubmethodClaimsIdentity(String, String, String)

Initializes a new instance of the ClaimsIdentity class with the specified authentication type, name claim type, and role claim type.

NameDescription
System_CAPS_pubpropertyActor

Gets or sets the identity of the calling party that was granted delegation rights.

System_CAPS_pubpropertyAuthenticationType

Gets the authentication type.

System_CAPS_pubpropertyBootstrapContext

Gets or sets the token that was used to create this claims identity.

System_CAPS_pubpropertyClaims

Gets the claims associated with this claims identity.

System_CAPS_protpropertyCustomSerializationData

System_CAPS_pubpropertyIsAuthenticated

Gets a value that indicates whether the identity has been authenticated.

System_CAPS_pubpropertyLabel

Gets or sets the label for this claims identity.

System_CAPS_pubpropertyName

Gets the name of this claims identity.

System_CAPS_pubpropertyNameClaimType

Gets the claim type that is used to determine which claims provide the value for the Name property of this claims identity.

System_CAPS_pubpropertyRoleClaimType

Gets the claim type that will be interpreted as a .NET Framework role among the claims in this claims identity.

NameDescription
System_CAPS_pubmethodAddClaim(Claim)

Adds a single claim to this claims identity.

System_CAPS_pubmethodAddClaims(IEnumerable(Of Claim))

Adds a list of claims to this claims identity.

System_CAPS_pubmethodClone()

Returns a new ClaimsIdentity copied from this claims identity.

System_CAPS_protmethodCreateClaim(BinaryReader)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodFindAll(Predicate(Of Claim))

Retrieves all of the claims that are matched by the specified predicate.

System_CAPS_pubmethodFindAll(String)

Retrieves all of the claims that have the specified claim type.

System_CAPS_pubmethodFindFirst(Predicate(Of Claim))

Retrieves the first claim that is matched by the specified predicate.

System_CAPS_pubmethodFindFirst(String)

Retrieves the first claim with the specified claim type.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_protmethodGetObjectData(SerializationInfo, StreamingContext)

Populates the SerializationInfo with data needed to serialize the current ClaimsIdentity object.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodHasClaim(Predicate(Of Claim))

Determines whether this claims identity has a claim that is matched by the specified predicate.

System_CAPS_pubmethodHasClaim(String, String)

Determines whether this claims identity has a claim with the specified claim type and value.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodRemoveClaim(Claim)

Attempts to remove a claim from the claims identity.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodTryRemoveClaim(Claim)

Attempts to remove a claim from the claims identity.

System_CAPS_pubmethodWriteTo(BinaryWriter)

System_CAPS_protmethodWriteTo(BinaryWriter, Byte())

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticDefaultIssuer

The default issuer; “LOCAL AUTHORITY”.

System_CAPS_pubfieldSystem_CAPS_staticDefaultNameClaimType

The default name claim type; ClaimTypes.Name.

System_CAPS_pubfieldSystem_CAPS_staticDefaultRoleClaimType

The default role claim type; ClaimTypes.Role.

The ClaimsIdentity class is a concrete implementation of a claims-based identity; that is, an identity described by a collection of claims. A claim is a statement about an entity made by an issuer that describes a property, right, or some other quality of that entity. Such an entity is said to be the subject of the claim. A claim is represented by the Claim class. The claims contained in a ClaimsIdentity describe the entity that the corresponding identity represents, and can be used to make authorization and authentication decisions. A claims-based access model has many advantages over more traditional access models that rely exclusively on roles. For example, claims can provide much richer information about the identity they represent and can be evaluated for authorization or authentication in a far more specific manner.

Beginning with .NET Framework 4.5, Windows Identity Foundation (WIF) and claims-based identity have been fully integrated into the .NET Framework. This means that many classes that represent an identity in the .NET Framework now derive from ClaimsIdentity and describe their properties through a collection of claims. This is different from previous versions of the .NET Framework, in which, these classes implemented the IIdentity interface directly. The collection of claims that describe the identity can be accessed through the Claims property. The ClaimsIdentity class provides several methods for finding and modifying claims and fully supports language integrated queries (LINQ). In application code, ClaimsIdentity objects are typically accessed through ClaimsPrincipal objects; for example, the principal returned by Thread.CurrentPrincipal.

System_CAPS_noteNote

The ClaimsPrincipal class has a Claims property as well. In the majority of cases you should access the user’s claims through the ClaimsPrincipal.Claims collection rather than through the Claims collection. You will need to access the claims of an individual ClaimsIdentity only in the cases where the principal contains more than one ClaimsIdentity and you need to evaluate or modify a specific identity.

System_CAPS_importantImportant

To add or remove claims from the Claims collection, a caller must have full trust.

In the claims-based model, the IIdentity.Name property and the IPrincipal.IsInRole(String) method are implemented by evaluating the claims contained by an identity. The base implementations in the claims-based model are provided by the ClaimsIdentity.Name property and the ClaimsPrincipal.IsInRole method. The NameClaimType and RoleClaimType properties enable you to specify a claim type that should be used to evaluate the claims contained by the identity when performing these operations.

Delegation scenarios are supported through the Actor and BootstrapContext properties.

Universal Windows Platform
Available since 10
.NET Framework
Available since 4.5

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft