C# Класс System.Security.Claims.ClaimsPrincipal

Наследование: System.Security.Principal.IPrincipal
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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

Приватные методы

Метод Описание
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.

Описание методов

AddIdentities() публичный Метод

Adds a IEnumerable{ClaimsIdentity} to the internal list.
if 'identities' is null.
public AddIdentities ( IEnumerable identities ) : void
identities IEnumerable Enumeration of ClaimsIdentities to add.
Результат void

AddIdentity() публичный Метод

Adds a single ClaimsIdentity to an internal list.
if 'identity' is null.
public AddIdentity ( ClaimsIdentity identity ) : void
identity ClaimsIdentity the add.
Результат void

ClaimsPrincipal() публичный Метод

public ClaimsPrincipal ( )

ClaimsPrincipal() публичный Метод

public ClaimsPrincipal ( System reader )
reader System

ClaimsPrincipal() защищенный Метод

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

ClaimsPrincipal() публичный Метод

public ClaimsPrincipal ( System identities )
identities System

ClaimsPrincipal() публичный Метод

Initializes an instance of ClaimsPrincipal.
public ClaimsPrincipal ( ) : System.Collections.Generic
Результат System.Collections.Generic

ClaimsPrincipal() публичный Метод

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 .
Результат System.Collections.Generic

ClaimsPrincipal() публичный Метод

Initializes an instance of ClaimsPrincipal.
if 'identities' is null.
public ClaimsPrincipal ( IEnumerable identities ) : System.Collections.Generic
identities IEnumerable the subjects in the principal.
Результат System.Collections.Generic

ClaimsPrincipal() публичный Метод

Initializes an instance of ClaimsPrincipal
if 'identity' is null.
public ClaimsPrincipal ( IIdentity identity ) : System.Collections.Generic
identity IIdentity representing the subject in the principal.
Результат System.Collections.Generic

ClaimsPrincipal() публичный Метод

Initializes an instance of ClaimsPrincipal
if 'principal' is null.
public ClaimsPrincipal ( IPrincipal principal ) : System.Collections.Generic
principal IPrincipal used to form this instance.
Результат System.Collections.Generic

ClaimsPrincipal() защищенный Метод

protected ClaimsPrincipal ( SerializationInfo info, StreamingContext context ) : System.Collections.Generic
info SerializationInfo
context StreamingContext
Результат System.Collections.Generic

Clone() публичный Метод

Creates a new instance of ClaimsPrincipal with values copied from this object.
public Clone ( ) : ClaimsPrincipal
Результат ClaimsPrincipal

Clone() публичный Метод

public Clone ( ) : System.Security.Claims.ClaimsPrincipal
Результат System.Security.Claims.ClaimsPrincipal

CreateClaimsIdentity() защищенный Метод

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.
Результат ClaimsIdentity

CreateClaimsIdentity() защищенный Метод

protected CreateClaimsIdentity ( System reader ) : System.Security.Claims.ClaimsIdentity
reader System
Результат System.Security.Claims.ClaimsIdentity

FindAll() публичный Метод

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.
Результат IEnumerable

FindAll() публичный Метод

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.
Результат IEnumerable

FindAll() публичный Метод

public FindAll ( System match ) : System.Collections.Generic.IEnumerable
match System
Результат System.Collections.Generic.IEnumerable

FindAll() публичный Метод

public FindAll ( string type ) : System.Collections.Generic.IEnumerable
type string
Результат System.Collections.Generic.IEnumerable

FindFirst() публичный Метод

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.
Результат Claim

FindFirst() публичный Метод

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.
Результат Claim

FindFirst() публичный Метод

public FindFirst ( System match ) : System.Security.Claims.Claim
match System
Результат System.Security.Claims.Claim

FindFirst() публичный Метод

public FindFirst ( string type ) : System.Security.Claims.Claim
type string
Результат System.Security.Claims.Claim

GetObjectData() защищенный Метод

protected GetObjectData ( SerializationInfo info, StreamingContext context ) : void
info SerializationInfo
context StreamingContext
Результат void

GetObjectData() защищенный Метод

protected GetObjectData ( System info, System context ) : void
info System
context System
Результат void

HasClaim() публичный Метод

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.
Результат bool

HasClaim() публичный Метод

public HasClaim ( System match ) : bool
match System
Результат bool

HasClaim() публичный Метод

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.
Результат bool

IsInRole() публичный Метод

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.
Результат bool

WriteTo() публичный Метод

Serializes using a BinaryWriter
if 'writer' is null.
public WriteTo ( BinaryWriter writer ) : void
writer BinaryWriter
Результат void

WriteTo() защищенный Метод

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.
Результат void

WriteTo() публичный Метод

public WriteTo ( System writer ) : void
writer System
Результат void

WriteTo() защищенный Метод

protected WriteTo ( System writer, byte userData ) : void
writer System
userData byte
Результат void