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.​ClaimsPrincipal

Assembly: System.Security.Claims

Inheritance: object → ClaimsPrincipal

Implemented Interfaces

An <see cref="T:System.Security.Principal.IPrincipal" /> implementation that supports multiple claims-based identities.

Properties

Gets a collection that contains all of the claims from all of the claims identities associated with this claims principal.
public static Func<​ClaimsPrincipal>
ClaimsPrincipalSelector
Gets or sets the delegate used to select the claims principal returned by the <see cref="P:System.Security.Claims.ClaimsPrincipal.Current" /> property.
public static ClaimsPrincipal
Current
Gets the current claims principal.
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[])" /> .
Gets a collection that contains all of the claims identities associated with this claims principal.
Identity
Gets the primary claims identity associated with this claims principal.
PrimaryIdentitySelector
Gets or sets the delegate used to select the claims identity returned by the <see cref="P:System.Security.Claims.ClaimsPrincipal.Identity" /> property.

Methods

public void
AddIdentities​(Collections.​Generic.​IEnumerable<​ClaimsIdentity> identities)
Adds the specified claims identities to this claims principal.
identities The claims identities to add.
public void
AddIdentity​(ClaimsIdentity identity)
Adds the specified claims identity to this claims principal.
identity The claims identity to add.
Clone​()
Returns a copy of this instance.
Returns A new copy of the <see cref="T:System.Security.Claims.ClaimsPrincipal" /> object.
protected ClaimsIdentity
CreateClaimsIdentity​(IO.​BinaryReader reader)
Creates a new claims identity.
Returns The created claims identity.
reader The binary reader.
FindAll​(Predicate<​Claim> match)
Retrieves all of the claims that are matched by the specified predicate.
Returns The matching claims.
match The function that performs the matching logic.
FindAll​(string type)
Retrieves all or the claims that have the specified claim type.
Returns The matching claims.
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.ClaimsPrincipal" /> 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 any of the claims identities associated with this claims principal contains 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 any of the claims identities associated with this claims principal contains a claim with the specified claim type and value.
Returns <see langword="true" /> if a matching claim exists; otherwise, <see langword="false" /> .
type The type of the claim to match.
value The value of the claim to match.
public bool
IsInRole​(string role)
Returns a value that indicates whether the entity (user) represented by this claims principal is in the specified role.
Returns <see langword="true" /> if claims principal is in the specified role; otherwise, <see langword="false" /> .
role The role for which to check.
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
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object