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.​Principal.​GenericPrincipal

Assembly: System.Security.Claims

Inheritance: object → Claims.​ClaimsPrincipal → GenericPrincipal

Implemented Interfaces

Represents a generic principal.

Properties

public IIdentity
Identity
Gets the <see cref="T:System.Security.Principal.GenericIdentity" /> of the user represented by the current <see cref="T:System.Security.Principal.GenericPrincipal" /> .
Gets a collection that contains all of the claims from all of the claims identities associated with this 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.

Methods

public bool
IsInRole​(string role)
Determines whether the current <see cref="T:System.Security.Principal.GenericPrincipal" /> belongs to the specified role.
Returns <see langword="true" /> if the current <see cref="T:System.Security.Principal.GenericPrincipal" /> is a member of the specified role; otherwise, <see langword="false" /> .
role The name of the role for which to check membership.
public void
AddIdentities​(Collections.​Generic.​IEnumerable<​Claims.​ClaimsIdentity> identities)
Inherited from Claims.​ClaimsPrincipal
Adds the specified claims identities to this claims principal.
identities The claims identities to add.
public void
AddIdentity​(Claims.​ClaimsIdentity identity)
Inherited from Claims.​ClaimsPrincipal
Adds the specified claims identity to this claims principal.
identity The claims identity to add.
Clone​()
Inherited from Claims.​ClaimsPrincipal
Returns a copy of this instance.
Returns A new copy of the <see cref="T:System.Security.Claims.ClaimsPrincipal" /> object.
CreateClaimsIdentity​(IO.​BinaryReader reader)
Inherited from Claims.​ClaimsPrincipal
Creates a new claims identity.
Returns The created claims identity.
reader The binary reader.
FindAll​(Predicate<​Claims.​Claim> match)
Inherited from Claims.​ClaimsPrincipal
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)
Inherited from Claims.​ClaimsPrincipal
Retrieves all or the claims that have the specified claim type.
Returns The matching claims.
type The claim type against which to match claims.
FindFirst​(Predicate<​Claims.​Claim> match)
Inherited from Claims.​ClaimsPrincipal
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.
FindFirst​(string type)
Inherited from Claims.​ClaimsPrincipal
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)
Inherited from Claims.​ClaimsPrincipal
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<​Claims.​Claim> match)
Inherited from Claims.​ClaimsPrincipal
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)
Inherited from Claims.​ClaimsPrincipal
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 void
WriteTo​(IO.​BinaryWriter writer)
Inherited from Claims.​ClaimsPrincipal
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)
Inherited from Claims.​ClaimsPrincipal
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