Represents a claim.
Assembly: mscorlib (in mscorlib.dll)
Thetype exposes the following members.
|Claim(String, String)||Initializes a new instance of the class with the specified claim type, and value.|
|Claim(String, String, String)||Initializes a new instance of the class with the specified claim type, value, and value type.|
|Claim(String, String, String, String)||Initializes a new instance of the class with the specified claim type, value, value type, and issuer.|
|Claim(String, String, String, String, String)||Initializes a new instance of the class with the specified claim type, value, value type, issuer, and original issuer.|
|Claim(String, String, String, String, String, ClaimsIdentity)||Initializes a new instance of the class with the specified claim type, value, value type, issuer, original issuer and subject.|
|Issuer||Gets the issuer of the claim.|
|OriginalIssuer||Gets the original issuer of the claim.|
|Properties||Gets a dictionary that contains additional properties associated with this claim.|
|Subject||Gets the subject of the claim.|
|Type||Gets the claim type of the claim.|
|Value||Gets the value of the claim.|
|ValueType||Gets the value type of the claim.|
|Clone()||Returns a new object copied from this object. The new claim does not have a subject.|
|Clone(ClaimsIdentity)||Returns a new object copied from this object. The subject of the new claim is set to the specified ClaimsIdentity.|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string representation of this object. (Overrides Object.ToString().)|
A claim is a statement about a subject by an issuer. Claims represent attributes of the subject that are useful in the context of authentication and authorization operations. Subjects and issuers are both entities that are part of an identity scenario. Some typical examples of a subject are: a user, an application or service, a device, or a computer. Some typical examples of an issuer are: the operating system, an application. a service, a role provider, an identity provider, or a federation provider. An issuer delivers claims by issuing security tokens, typically through a Security Token Service (STS). (In WIF, you can build an STS by deriving from the SecurityTokenService class.) On occasion, the collection of claims received from an issuer can be extended by subject attributes stored directly at the resource. A claim can be evaluated to determine access rights to data and other secured resources during the process of authorization and can also be used to make or express authentication decisions about a subject.
Beginning with .NET 4.5, the Windows Identity Foundation (WIF) classes, which implement claims-based identity, have been fully integrated into the .NET Framework. The claims concept is implemented by the class.
The following describes important properties of the class:
The Type property is a string (typically a URI) that contains the semantic information about the claim; it tells you what the value of the claim means. For example, a claim with a claim type of GivenName (“http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname”) represents a user’s first name. The value of the Type property can be one of the well-known claim types defined in the ClaimTypes class, or it can be an arbitrary URI as defined by the issuer. For example, a claim type of “urn:spendinglimit” might represent a user attribute which makes sense within the business context of the issuer.
The Value property contains the value of the claim. In order to reduce dependencies and simplify administration, in WIF the value of a claim is represented only as a string. For more complex value types, it is recommended that you use standard XML schema types to indicate how the value is meant to be serialized into and deserialized from a string.
The ValueType property contains a string that identifies the type information for the value. This property should be used to understand the format of the value and to provide information about how to deserialize it. If your solution requires complex value types, it is recommended that you use standard XML schema types in the ValueType property to indicate how the Value property is meant to be serialized into and deserialized from a string.
The Subject property is a ClaimsIdentity object that represents the subject of the claim. The subject of the claim is the entity (typically the user who is requesting access to a resource) about which the claim is asserted. The ClaimsIdentity contains, among its properties, a collection of claims that describe the properties and attributes of the subject as attested to by one or more issuers.
The Issuer property contains the name of the entity that issued the claim. The issuer of a claim is represented in WIF by a string that contains a name taken from a list of well-known issuers that is maintained by the issuer name registry. The issuer name registry is an instance of a class that derives from the IssuerNameRegistry class. The issuer name registry associates a mnemonic name to the cryptographic material needed to verify the signatures of tokens produced by the corresponding issuer. For example, the ConfigurationBasedIssuerNameRegistry class, available out of the box with .NET 4.5, associates the mnemonic name for each issuer with its corresponding X.509 certificate. The list of well-known issuers is typically built at startup time by the issuer name registry. The list used by the ConfigurationBasedIssuerNameRegistry is specified in the application configuration file.
The OriginalIssuer property contains the name of the entity that originally issued the claim. This property is designed to facilitate scenarios where a claim may pass through multiple issuers before it is presented by the client to the RP application; such as federation scenarios. You can examine the OriginalIssuer property to determine the entity that originally issued the claim. The name is taken from the list of well-known issuers maintained by the issuer name registry, as in the case of the Issuer property.
The following example extracts the claims associated to the authenticated user performing an HTTP request and writes them in the HTTP response. The current user is read from the HttpContext as a ClaimsPrincipal and the claims are read from it. The claims are then written to HTTP the response.
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.