ClaimsPrincipal 构造函数

定义

初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class.

重载

ClaimsPrincipal()

初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class.

ClaimsPrincipal(IEnumerable<ClaimsIdentity>)

使用指定的声明标识,初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class using the specified claims identities.

ClaimsPrincipal(BinaryReader)

用指定的 BinaryReader 初始化 ClaimsPrincipal 的实例。Initializes an instance of ClaimsPrincipal with the specified BinaryReader.

ClaimsPrincipal(IIdentity)

从指定的标识初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class from the specified identity.

ClaimsPrincipal(IPrincipal)

从指定的主体初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class from the specified principal.

ClaimsPrincipal(SerializationInfo, StreamingContext)

从使用 ISerializable 创建的序列化流初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class from a serialized stream created by using ISerializable.

ClaimsPrincipal()

初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class.

public:
 ClaimsPrincipal();
public ClaimsPrincipal ();
Public Sub New ()

注解

没有标识与新的实例关联。No identities are associated with the new instance. (Identities 集合为空) 。(The Identities collection is empty).

适用于

ClaimsPrincipal(IEnumerable<ClaimsIdentity>)

使用指定的声明标识,初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class using the specified claims identities.

public:
 ClaimsPrincipal(System::Collections::Generic::IEnumerable<System::Security::Claims::ClaimsIdentity ^> ^ identities);
public ClaimsPrincipal (System.Collections.Generic.IEnumerable<System.Security.Claims.ClaimsIdentity> identities);
new System.Security.Claims.ClaimsPrincipal : seq<System.Security.Claims.ClaimsIdentity> -> System.Security.Claims.ClaimsPrincipal
Public Sub New (identities As IEnumerable(Of ClaimsIdentity))

参数

identities
IEnumerable<ClaimsIdentity>

从其初始化新声明主体的标识。The identities from which to initialize the new claims principal.

例外

identitiesnullidentities is null.

注解

Identities集合将用指定标识初始化。The Identities collection is initialized with the specified identities.

适用于

ClaimsPrincipal(BinaryReader)

用指定的 BinaryReader 初始化 ClaimsPrincipal 的实例。Initializes an instance of ClaimsPrincipal with the specified BinaryReader.

public:
 ClaimsPrincipal(System::IO::BinaryReader ^ reader);
public ClaimsPrincipal (System.IO.BinaryReader reader);
new System.Security.Claims.ClaimsPrincipal : System.IO.BinaryReader -> System.Security.Claims.ClaimsPrincipal
Public Sub New (reader As BinaryReader)

参数

例外

readernullreader is null.

注解

通常, BinaryReader 使用和初始化的中的字节 WriteTo 来构造,其方式与相同 BinaryWriterNormally, the BinaryReader is constructed using the bytes from WriteTo and initialized in the same way as the BinaryWriter.

适用于

ClaimsPrincipal(IIdentity)

从指定的标识初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class from the specified identity.

public:
 ClaimsPrincipal(System::Security::Principal::IIdentity ^ identity);
public ClaimsPrincipal (System.Security.Principal.IIdentity identity);
new System.Security.Claims.ClaimsPrincipal : System.Security.Principal.IIdentity -> System.Security.Claims.ClaimsPrincipal
Public Sub New (identity As IIdentity)

参数

identity
IIdentity

从其初始化新的声明主体的标识。The identity from which to initialize the new claims principal.

例外

identitynullidentity is null.

注解

如果指定的标识可从中赋值,则将 ClaimsIdentity 使用它来初始化 Identities 集合。If the specified identity is assignable from ClaimsIdentity, it is used to initialize the Identities collection. 否则,将 ClaimsIdentity 使用指定的标识创建,并使用来初始化集合。Otherwise, a ClaimsIdentity is created using the specified identity and is used to initialize the collection.

适用于

ClaimsPrincipal(IPrincipal)

从指定的主体初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class from the specified principal.

public:
 ClaimsPrincipal(System::Security::Principal::IPrincipal ^ principal);
public ClaimsPrincipal (System.Security.Principal.IPrincipal principal);
new System.Security.Claims.ClaimsPrincipal : System.Security.Principal.IPrincipal -> System.Security.Claims.ClaimsPrincipal
Public Sub New (principal As IPrincipal)

参数

principal
IPrincipal

从其初始化新的声明主体的主体。The principal from which to initialize the new claims principal.

例外

principalnullprincipal is null.

注解

如果指定的主体可从赋值 ClaimsPrincipal ,则其所有标识都将添加到 Identities 集合中。If the specified principal is assignable from ClaimsPrincipal, all of its identities are added to the Identities collection. 如果无法从分配指定的主体 ClaimsPrincipal ,则 ClaimsIdentity 会在其属性中创建一个新的, IIdentity 并将其 IPrincipal.Identity 添加到 Identities 集合中。If the specified principal is not assignable from ClaimsPrincipal, a new ClaimsIdentity is created from the IIdentity in its IPrincipal.Identity property and added to the Identities collection.

适用于

ClaimsPrincipal(SerializationInfo, StreamingContext)

从使用 ISerializable 创建的序列化流初始化 ClaimsPrincipal 类的新实例。Initializes a new instance of the ClaimsPrincipal class from a serialized stream created by using ISerializable.

protected:
 ClaimsPrincipal(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected ClaimsPrincipal (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Security.SecurityCritical]
protected ClaimsPrincipal (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Security.Claims.ClaimsPrincipal : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.Claims.ClaimsPrincipal
[<System.Security.SecurityCritical>]
new System.Security.Claims.ClaimsPrincipal : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.Claims.ClaimsPrincipal
Protected Sub New (info As SerializationInfo, context As StreamingContext)

参数

info
SerializationInfo

序列化数据。The serialized data.

context
StreamingContext

序列化的上下文。The context for serialization.

属性

例外

info 为 null。info is null.

适用于