C# Class System.Security.Claims.ClaimsPrincipal

Inheritance: System.Security.Principal.IPrincipal
Afficher le fichier Open project: dotnet/corefx Class Usage Examples

Méthodes publiques

Méthode Description
AddIdentities ( IEnumerable identities ) : void

Adds a IEnumerable{ClaimsIdentity} to the internal list.

AddIdentity ( ClaimsIdentity identity ) : void

Adds a single ClaimsIdentity to an internal list.

ClaimsPrincipal ( )
ClaimsPrincipal ( System reader )
ClaimsPrincipal ( System identities )
ClaimsPrincipal ( ) : System.Collections.Generic

Initializes an instance of ClaimsPrincipal.

ClaimsPrincipal ( BinaryReader reader ) : System.Collections.Generic

Initializes an instance of ClaimsPrincipal using a BinaryReader. Normally the BinaryReader is constructed using the bytes from WriteTo(BinaryWriter) and initialized in the same way as the BinaryWriter.

ClaimsPrincipal ( IEnumerable identities ) : System.Collections.Generic

Initializes an instance of ClaimsPrincipal.

ClaimsPrincipal ( IIdentity identity ) : System.Collections.Generic

Initializes an instance of ClaimsPrincipal

ClaimsPrincipal ( IPrincipal principal ) : System.Collections.Generic

Initializes an instance of ClaimsPrincipal

Clone ( ) : ClaimsPrincipal

Creates a new instance of ClaimsPrincipal with values copied from this object.

Clone ( ) : System.Security.Claims.ClaimsPrincipal
FindAll ( Predicate match ) : IEnumerable

Retrieves a IEnumerable{Claim} where each claim is matched by .

Each ClaimsIdentity is called. ClaimsIdentity.FindAll.

FindAll ( string type ) : IEnumerable

Retrieves a IEnumerable{Claim} where each Claim.Type equals type.

Each ClaimsIdentity is called. ClaimsIdentity.FindAll.

FindAll ( System match ) : System.Collections.Generic.IEnumerable
FindAll ( string type ) : System.Collections.Generic.IEnumerable
FindFirst ( Predicate match ) : Claim

Retrieves the first Claim that is matched by .

Each ClaimsIdentity is called. ClaimsIdentity.FindFirst.

FindFirst ( string type ) : Claim

Retrieves the first Claim where the Claim.Type equals type.

Each ClaimsIdentity is called. ClaimsIdentity.FindFirst.

FindFirst ( System match ) : System.Security.Claims.Claim
FindFirst ( string type ) : System.Security.Claims.Claim
HasClaim ( Predicate match ) : bool

Determines if a claim is contained within all the ClaimsIdentities in this ClaimPrincipal.

Each ClaimsIdentity is called. ClaimsIdentity.HasClaim.

HasClaim ( System match ) : bool
HasClaim ( string type, string value ) : bool

Determines if a claim of claimType AND claimValue exists in any of the identities.

Each ClaimsIdentity is called. ClaimsIdentity.HasClaim.

IsInRole ( string role ) : bool

IsInRole answers the question: does an identity this principal possesses contain a claim of type RoleClaimType where the value is '==' to the role.

Each Identity has its own definition of the ClaimType that represents a role.

WriteTo ( BinaryWriter writer ) : void

Serializes using a BinaryWriter

WriteTo ( System writer ) : void

Méthodes protégées

Méthode Description
ClaimsPrincipal ( System info, System context )
ClaimsPrincipal ( SerializationInfo info, StreamingContext context ) : System.Collections.Generic
CreateClaimsIdentity ( BinaryReader reader ) : ClaimsIdentity

Provides and extensibility point for derived types to create a custom ClaimsIdentity.

CreateClaimsIdentity ( System reader ) : System.Security.Claims.ClaimsIdentity
GetObjectData ( SerializationInfo info, StreamingContext context ) : void
GetObjectData ( System info, System context ) : void
WriteTo ( BinaryWriter writer, byte userData ) : void

Serializes using a BinaryWriter

WriteTo ( System writer, byte userData ) : void

Private Methods

Méthode Description
AddIdentities ( System identities ) : void
AddIdentity ( System identity ) : void
Initialize ( BinaryReader reader ) : void

Initializes from a BinaryReader. Normally the reader is initialized with the results from WriteTo(BinaryWriter) Normally the BinaryReader is initialized in the same way as the BinaryWriter passed to WriteTo(BinaryWriter).

OnSerializingMethod ( StreamingContext context ) : void
SelectPrimaryIdentity ( IEnumerable identities ) : ClaimsIdentity

This method iterates through the collection of ClaimsIdentities and chooses an identity as the primary.

Method Details

AddIdentities() public méthode

Adds a IEnumerable{ClaimsIdentity} to the internal list.
if 'identities' is null.
public AddIdentities ( IEnumerable identities ) : void
identities IEnumerable Enumeration of ClaimsIdentities to add.
Résultat void

AddIdentity() public méthode

Adds a single ClaimsIdentity to an internal list.
if 'identity' is null.
public AddIdentity ( ClaimsIdentity identity ) : void
identity ClaimsIdentity the add.
Résultat void

ClaimsPrincipal() public méthode

public ClaimsPrincipal ( )

ClaimsPrincipal() public méthode

public ClaimsPrincipal ( System reader )
reader System

ClaimsPrincipal() protected méthode

protected ClaimsPrincipal ( System info, System context )
info System
context System

ClaimsPrincipal() public méthode

public ClaimsPrincipal ( System identities )
identities System

ClaimsPrincipal() public méthode

Initializes an instance of ClaimsPrincipal.
public ClaimsPrincipal ( ) : System.Collections.Generic
Résultat System.Collections.Generic

ClaimsPrincipal() public méthode

Initializes an instance of ClaimsPrincipal using a BinaryReader. Normally the BinaryReader is constructed using the bytes from WriteTo(BinaryWriter) and initialized in the same way as the BinaryWriter.
if 'reader' is null.
public ClaimsPrincipal ( BinaryReader reader ) : System.Collections.Generic
reader BinaryReader a pointing to a .
Résultat System.Collections.Generic

ClaimsPrincipal() public méthode

Initializes an instance of ClaimsPrincipal.
if 'identities' is null.
public ClaimsPrincipal ( IEnumerable identities ) : System.Collections.Generic
identities IEnumerable the subjects in the principal.
Résultat System.Collections.Generic

ClaimsPrincipal() public méthode

Initializes an instance of ClaimsPrincipal
if 'identity' is null.
public ClaimsPrincipal ( IIdentity identity ) : System.Collections.Generic
identity IIdentity representing the subject in the principal.
Résultat System.Collections.Generic

ClaimsPrincipal() public méthode

Initializes an instance of ClaimsPrincipal
if 'principal' is null.
public ClaimsPrincipal ( IPrincipal principal ) : System.Collections.Generic
principal IPrincipal used to form this instance.
Résultat System.Collections.Generic

ClaimsPrincipal() protected méthode

protected ClaimsPrincipal ( SerializationInfo info, StreamingContext context ) : System.Collections.Generic
info SerializationInfo
context StreamingContext
Résultat System.Collections.Generic

Clone() public méthode

Creates a new instance of ClaimsPrincipal with values copied from this object.
public Clone ( ) : ClaimsPrincipal
Résultat ClaimsPrincipal

Clone() public méthode

public Clone ( ) : System.Security.Claims.ClaimsPrincipal
Résultat System.Security.Claims.ClaimsPrincipal

CreateClaimsIdentity() protected méthode

Provides and extensibility point for derived types to create a custom ClaimsIdentity.
if 'reader' is null.
protected CreateClaimsIdentity ( BinaryReader reader ) : ClaimsIdentity
reader BinaryReader the that points at the claim.
Résultat ClaimsIdentity

CreateClaimsIdentity() protected méthode

protected CreateClaimsIdentity ( System reader ) : System.Security.Claims.ClaimsIdentity
reader System
Résultat System.Security.Claims.ClaimsIdentity

FindAll() public méthode

Retrieves a IEnumerable{Claim} where each claim is matched by .
Each ClaimsIdentity is called. ClaimsIdentity.FindAll.
if 'match' is null.
public FindAll ( Predicate match ) : IEnumerable
match Predicate The predicate that performs the matching logic.
Résultat IEnumerable

FindAll() public méthode

Retrieves a IEnumerable{Claim} where each Claim.Type equals type.
Each ClaimsIdentity is called. ClaimsIdentity.FindAll.
if 'type' is null.
public FindAll ( string type ) : IEnumerable
type string The type of the claim to match.
Résultat IEnumerable

FindAll() public méthode

public FindAll ( System match ) : System.Collections.Generic.IEnumerable
match System
Résultat System.Collections.Generic.IEnumerable

FindAll() public méthode

public FindAll ( string type ) : System.Collections.Generic.IEnumerable
type string
Résultat System.Collections.Generic.IEnumerable

FindFirst() public méthode

Retrieves the first Claim that is matched by .
Each ClaimsIdentity is called. ClaimsIdentity.FindFirst.
if 'match' is null.
public FindFirst ( Predicate match ) : Claim
match Predicate The predicate that performs the matching logic.
Résultat Claim

FindFirst() public méthode

Retrieves the first Claim where the Claim.Type equals type.
Each ClaimsIdentity is called. ClaimsIdentity.FindFirst.
if 'type' is null.
public FindFirst ( string type ) : Claim
type string The type of the claim to match.
Résultat Claim

FindFirst() public méthode

public FindFirst ( System match ) : System.Security.Claims.Claim
match System
Résultat System.Security.Claims.Claim

FindFirst() public méthode

public FindFirst ( string type ) : System.Security.Claims.Claim
type string
Résultat System.Security.Claims.Claim

GetObjectData() protected méthode

protected GetObjectData ( SerializationInfo info, StreamingContext context ) : void
info SerializationInfo
context StreamingContext
Résultat void

GetObjectData() protected méthode

protected GetObjectData ( System info, System context ) : void
info System
context System
Résultat void

HasClaim() public méthode

Determines if a claim is contained within all the ClaimsIdentities in this ClaimPrincipal.
Each ClaimsIdentity is called. ClaimsIdentity.HasClaim.
if 'match' is null.
public HasClaim ( Predicate match ) : bool
match Predicate The predicate that performs the matching logic.
Résultat bool

HasClaim() public méthode

public HasClaim ( System match ) : bool
match System
Résultat bool

HasClaim() public méthode

Determines if a claim of claimType AND claimValue exists in any of the identities.
Each ClaimsIdentity is called. ClaimsIdentity.HasClaim.
if 'type' is null. if 'value' is null.
public HasClaim ( string type, string value ) : bool
type string the type of the claim to match.
value string the value of the claim to match.
Résultat bool

IsInRole() public méthode

IsInRole answers the question: does an identity this principal possesses contain a claim of type RoleClaimType where the value is '==' to the role.
Each Identity has its own definition of the ClaimType that represents a role.
public IsInRole ( string role ) : bool
role string The role to check for.
Résultat bool

WriteTo() public méthode

Serializes using a BinaryWriter
if 'writer' is null.
public WriteTo ( BinaryWriter writer ) : void
writer BinaryWriter
Résultat void

WriteTo() protected méthode

Serializes using a BinaryWriter
if 'writer' is null.
protected WriteTo ( BinaryWriter writer, byte userData ) : void
writer BinaryWriter the to use for data storage.
userData byte additional data provided by derived type.
Résultat void

WriteTo() public méthode

public WriteTo ( System writer ) : void
writer System
Résultat void

WriteTo() protected méthode

protected WriteTo ( System writer, byte userData ) : void
writer System
userData byte
Résultat void