Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Security.​Claims.​ClaimsIdentity
Assembly: System.Security.Claims
Inheritance: object → ClaimsIdentity
Implemented Interfaces
Represents a claims-based identity.
Fields and Constants
public const
string
DefaultIssuer
The default issuer; "LOCAL AUTHORITY".
public const
string
DefaultNameClaimType
The default name claim type; <see cref="F:System.Security.Claims.ClaimTypes.Name" /> .
public const
string
DefaultRoleClaimType
The default role claim type; <see cref="F:System.Security.Claims.ClaimTypes.Role" /> .
Properties
public
ClaimsIdentity
Actor
Gets or sets the identity of the calling party that was granted delegation rights.
public
string
AuthenticationType
Gets the authentication type.
public
object
BootstrapContext
Gets or sets the token that was used to create this claims identity.
public
Collections.​Generic.​IEnumerable<​Claim>
Claims
Gets the claims associated with this claims identity.
protected
byte[]
CustomSerializationData
Contains any additional data provided by a derived type. Typically set when calling <see cref="M:System.Security.Claims.ClaimsIdentity.WriteTo(System.IO.BinaryWriter,System.Byte[])" /> .
public
bool
IsAuthenticated
Gets a value that indicates whether the identity has been authenticated.
public
string
Label
Gets or sets the label for this claims identity.
public
string
Name
Gets the name of this claims identity.
public
string
NameClaimType
Gets the claim type that is used to determine which claims provide the value for the <see cref="P:System.Security.Claims.ClaimsIdentity.Name" /> property of this claims identity.
public
string
RoleClaimType
Gets the claim type that will be interpreted as a .NET role among the claims in this claims identity.
Methods
claim
The claim to add.
public
void
AddClaims​(Collections.​Generic.​IEnumerable<​Claim> claims)
Adds a list of claims to this claims identity.
claims
The claims to add.
public
ClaimsIdentity
Clone​()
Returns a new <see cref="T:System.Security.Claims.ClaimsIdentity" /> copied from this claims identity.
Returns A copy of the current instance.
protected
Claim
CreateClaim​(IO.​BinaryReader reader)
Provides an extensibility point for derived types to create a custom <see cref="T:System.Security.Claims.Claim" /> .
Returns A new <see cref="T:System.Security.Claims.Claim" /> .
reader
The <see cref="T:System.IO.BinaryReader" /> that points to the claim.
public
Collections.​Generic.​IEnumerable<​Claim>
FindAll​(Predicate<​Claim> match)
Retrieves all of the claims that are matched by the specified predicate.
Returns The matching claims. The list is read-only.
match
The function that performs the matching logic.
public
Collections.​Generic.​IEnumerable<​Claim>
FindAll​(string type)
Retrieves all of the claims that have the specified claim type.
Returns The matching claims. The list is read-only.
type
The claim type against which to match claims.
public
Claim
FindFirst​(Predicate<​Claim> match)
Retrieves the first claim that is matched by the specified predicate.
Returns The first matching claim or <see langword="null" /> if no match is found.
match
The function that performs the matching logic.
public
Claim
FindFirst​(string type)
Retrieves the first claim with the specified claim type.
Returns The first matching claim or <see langword="null" /> if no match is found.
type
The claim type to match.
protected
void
GetObjectData​(Runtime.​Serialization.​SerializationInfo info,
Runtime.​Serialization.​StreamingContext context)
Populates the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with data needed to serialize the current <see cref="T:System.Security.Claims.ClaimsIdentity" /> object.
info
The object to populate with data.
context
The destination for this serialization. Can be <see langword="null" /> .
public
bool
HasClaim​(Predicate<​Claim> match)
Determines whether this claims identity has a claim that is matched by the specified predicate.
Returns <see langword="true" /> if a matching claim exists; otherwise, <see langword="false" /> .
match
The function that performs the matching logic.
public
bool
HasClaim​(string type,
string value)
Determines whether this claims identity has a claim with the specified claim type and value.
Returns <see langword="true" /> if a match is found; otherwise, <see langword="false" /> .
type
The type of the claim to match.
value
The value of the claim to match.
public
void
RemoveClaim​(Claim claim)
Attempts to remove a claim from the claims identity.
claim
The claim to remove.
public
bool
TryRemoveClaim​(Claim claim)
Attempts to remove a claim from the claims identity.
Returns <see langword="true" /> if the claim was successfully removed; otherwise, <see langword="false" /> .
claim
The claim to remove.
public
void
WriteTo​(IO.​BinaryWriter writer)
Serializes using a <see cref="T:System.IO.BinaryWriter" /> .
writer
The writer to use for data storage.
protected
void
WriteTo​(IO.​BinaryWriter writer,
byte[] userData)
Serializes using a <see cref="T:System.IO.BinaryWriter" /> .
writer
The writer to use for data storage.
userData
Additional data provided by the derived type.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object