ClaimsIdentity 建構函式
定義
初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class.
多載
ClaimsIdentity() |
使用空的宣告集合,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class with an empty claims collection. |
ClaimsIdentity(IIdentity, IEnumerable<Claim>, String, String, String) |
從指定的 ClaimsIdentity,使用指定的宣告、驗證類型、名稱宣告型別,以及角色宣告類型,初始化 IIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class from the specified IIdentity using the specified claims, authentication type, name claim type, and role claim type. |
ClaimsIdentity(IEnumerable<Claim>, String, String, String) |
使用指定的宣告、驗證類型、名稱宣告類型,以及角色宣告類型,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class with the specified claims, authentication type, name claim type, and role claim type. |
ClaimsIdentity(String, String, String) |
使用指定的驗證類型、宣告類型和角色宣告類型,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class with the specified authentication type, name claim type, and role claim type. |
ClaimsIdentity(SerializationInfo, StreamingContext) |
從使用 ISerializable 建立的序列化資料流,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class from a serialized stream created by using ISerializable. |
ClaimsIdentity(IEnumerable<Claim>, String) |
使用指定的宣告和驗證類型,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class with the specified claims and authentication type. |
ClaimsIdentity(IIdentity, IEnumerable<Claim>) |
使用指定的宣告和指定的 ClaimsIdentity,初始化 IIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class using the specified claims and the specified IIdentity. |
ClaimsIdentity(IIdentity) |
使用名稱和驗證類型,從指定的 ClaimsIdentity 初始化 IIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class using the name and authentication type from the specified IIdentity. |
ClaimsIdentity(ClaimsIdentity) |
從現有的 ClaimsIdentity 執行個體初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class from an existing ClaimsIdentity instance. |
ClaimsIdentity(SerializationInfo) |
從使用 ISerializable 建立的序列化資料流,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class from a serialized stream created by using ISerializable. |
ClaimsIdentity(BinaryReader) |
使用指定的 BinaryReader,初始化 ClaimsIdentity 的執行個體。Initializes an instance of ClaimsIdentity with the specified BinaryReader. |
ClaimsIdentity(IEnumerable<Claim>) |
使用 ClaimsIdentity 物件的列舉集合,初始化 Claim 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class using an enumerated collection of Claim objects. |
ClaimsIdentity(String) |
使用空白宣告集合和指定的驗證類型,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class with an empty claims collection and the specified authentication type. |
ClaimsIdentity()
使用空的宣告集合,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class with an empty claims collection.
public:
ClaimsIdentity();
public ClaimsIdentity ();
Public Sub New ()
備註
下表所顯示的是 ClaimsIdentity 類別之執行個體的初始屬性值。The following table shows initial property values for an instance of the ClaimsIdentity class.
屬性Property | 值Value |
---|---|
Actor | null .null . |
AuthenticationType | null .null . |
BootstrapContext | null .null . |
Claims | 空白集合。A empty collection. |
IsAuthenticated | 注意: 存取時, IsAuthenticated 會根據屬性的值傳回屬性的值 AuthenticationType 。Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property. |
Label | null .null . |
Name | 注意: 存取時, Name 會根據和集合傳回屬性的值 NameClaimType Claims 。Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection. |
NameClaimType | DefaultNameClaimType.DefaultNameClaimType. |
RoleClaimType | DefaultRoleClaimType.DefaultRoleClaimType. |
適用於
ClaimsIdentity(IIdentity, IEnumerable<Claim>, String, String, String)
從指定的 ClaimsIdentity,使用指定的宣告、驗證類型、名稱宣告型別,以及角色宣告類型,初始化 IIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class from the specified IIdentity using the specified claims, authentication type, name claim type, and role claim type.
public:
ClaimsIdentity(System::Security::Principal::IIdentity ^ identity, System::Collections::Generic::IEnumerable<System::Security::Claims::Claim ^> ^ claims, System::String ^ authenticationType, System::String ^ nameType, System::String ^ roleType);
public ClaimsIdentity (System.Security.Principal.IIdentity identity, System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims, string authenticationType, string nameType, string roleType);
public ClaimsIdentity (System.Security.Principal.IIdentity? identity, System.Collections.Generic.IEnumerable<System.Security.Claims.Claim>? claims, string? authenticationType, string? nameType, string? roleType);
new System.Security.Claims.ClaimsIdentity : System.Security.Principal.IIdentity * seq<System.Security.Claims.Claim> * string * string * string -> System.Security.Claims.ClaimsIdentity
Public Sub New (identity As IIdentity, claims As IEnumerable(Of Claim), authenticationType As String, nameType As String, roleType As String)
參數
- identity
- IIdentity
新宣告識別的基底識別。The identity from which to base the new claims identity.
- claims
- IEnumerable<Claim>
用來填入新宣告識別的宣告。The claims with which to populate the new claims identity.
- authenticationType
- String
使用的驗證 (Authentication) 類型。The type of authentication used.
- nameType
- String
要用於名稱宣告的宣告類型。The claim type to use for name claims.
- roleType
- String
要用於角色宣告的宣告類型。The claim type to use for role claims.
例外狀況
identity
是傳回給 this
之循環參考中的 ClaimsIdentity 和 Actor 結果。identity
is a ClaimsIdentity and Actor results in a circular reference back to this
.
備註
下表所顯示的是 ClaimsIdentity 類別之執行個體的初始屬性值。The following table shows initial property values for an instance of the ClaimsIdentity class.
屬性Property | 值Value |
---|---|
Actor | 如果 identity 可從指派 ClaimsIdentity ,則為屬性的值, identity.Actor 否則為 null 。If identity is assignable from ClaimsIdentity, the value of the identity.Actor property; otherwise, null . |
AuthenticationType | authenticationType 參數。The authenticationType parameter. 如果 authenticationType 參數為 null 或空字串,則 identity.AuthenticationType IIdentity.AuthenticationType 會使用 () 屬性的值。If the authenticationType parameter is null or an empty string, the value of the identity.AuthenticationType (IIdentity.AuthenticationType) property is used. |
BootstrapContext | 如果 identity 可從指派 ClaimsIdentity ,則為屬性的值, identity.BootStrapContext 否則為 null 。If identity is assignable from ClaimsIdentity, the value of the identity.BootStrapContext property; otherwise, null . |
Claims | 從參數初始化 claims 。Initialized from the claims parameter. 如果 identity 可從指派 ClaimsIdentity ,則的宣告 identity 會先加入至新的實例,再由參數所指定 claims 。If identity is assignable from ClaimsIdentity, the claims from identity are added to the new instance before those specified by the claims parameter. |
IsAuthenticated | 注意: 存取時, IsAuthenticated 會根據屬性的值傳回屬性的值 AuthenticationType 。Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property. |
Label | 如果 identity 可從指派 ClaimsIdentity ,則為屬性的值, identity.Label 否則為 null 。If identity is assignable from ClaimsIdentity, the value of the identity.Label property; otherwise, null . |
Name | 如果 identity 無法從指派 ClaimsIdentity ,則不是 null ,而且具有 IIdentity.Name 不是的屬性,而是 null 使用屬性值,將名稱宣告加入至新的實例 IIdentity.Name 。If identity is not assignable from ClaimsIdentity, is not null , and has an IIdentity.Name property that is not null ; a name claim is added to the new instance using the value of the IIdentity.Name property. 注意: 存取時, Name 會根據和集合傳回屬性的值 NameClaimType Claims 。Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection. |
NameClaimType | nameType 參數的值。The value of the nameType parameter. 但是,如果參數的值 nameType 為 null 或空字串,而且 identity 可以從指派,則會 ClaimsIdentity 使用屬性的值, identity.NameClaimType 否則 DefaultNameClaimType 會使用。However, if the value of the nameType parameter is null or an empty string and identity is assignable from ClaimsIdentity, the value of the identity.NameClaimType property is used; otherwise, DefaultNameClaimType is used. |
RoleClaimType | roleClaimType 參數的值。The value of the roleClaimType parameter. 但是,如果參數的值 roleClaimType 為 null 或空字串,而且識別可以從指派,則會 ClaimsIdentity 使用屬性的值, identity.RoleClaimType 否則 DefaultRoleClaimType 會使用。However, if the value of the roleClaimType parameter is null or an empty string and identity is assignable from ClaimsIdentity, the value of the identity.RoleClaimType property is used; otherwise, DefaultRoleClaimType is used. |
適用於
ClaimsIdentity(IEnumerable<Claim>, String, String, String)
使用指定的宣告、驗證類型、名稱宣告類型,以及角色宣告類型,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class with the specified claims, authentication type, name claim type, and role claim type.
public:
ClaimsIdentity(System::Collections::Generic::IEnumerable<System::Security::Claims::Claim ^> ^ claims, System::String ^ authenticationType, System::String ^ nameType, System::String ^ roleType);
public ClaimsIdentity (System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims, string authenticationType, string nameType, string roleType);
public ClaimsIdentity (System.Collections.Generic.IEnumerable<System.Security.Claims.Claim>? claims, string? authenticationType, string? nameType, string? roleType);
new System.Security.Claims.ClaimsIdentity : seq<System.Security.Claims.Claim> * string * string * string -> System.Security.Claims.ClaimsIdentity
Public Sub New (claims As IEnumerable(Of Claim), authenticationType As String, nameType As String, roleType As String)
參數
- claims
- IEnumerable<Claim>
用來填入宣告識別的宣告。The claims with which to populate the claims identity.
- authenticationType
- String
使用的驗證 (Authentication) 類型。The type of authentication used.
- nameType
- String
要用於名稱宣告的宣告類型。The claim type to use for name claims.
- roleType
- String
要用於角色宣告的宣告類型。The claim type to use for role claims.
備註
下表所顯示的是 ClaimsIdentity 類別之執行個體的初始屬性值。The following table shows initial property values for an instance of the ClaimsIdentity class.
屬性Property | 值Value |
---|---|
Actor | null .null . |
AuthenticationType | authenticationType 參數的值。The value of the authenticationType parameter. 如果 authenticationType 參數為 null 或空字串,則會將屬性設定為 null 。If the authenticationType parameter is null or an empty string, the property is set to null . |
BootstrapContext | null .null . |
Claims | 從參數初始化 claims 。Initialized from the claims parameter. |
IsAuthenticated | 注意: 存取時, IsAuthenticated 會根據屬性的值傳回屬性的值 AuthenticationType 。Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property. |
Label | null .null . |
Name | 注意: 存取時, Name 會根據和集合傳回屬性的值 NameClaimType Claims 。Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection. |
NameClaimType | nameType 參數的值。The value of the nameType parameter. 但是,如果 nameType 參數為 null 或空字串,則會將屬性設定為 DefaultNameClaimType 。However, if the nameType parameter is null or an empty string, the property is set to DefaultNameClaimType. |
RoleClaimType | roleClaimType 參數的值。The value of the roleClaimType parameter. 但是,如果 roleClaimType 參數為 null 或空字串,則會將屬性設定為 DefaultRoleClaimType 。However, if the roleClaimType parameter is null or an empty string, the property is set to DefaultRoleClaimType. |
適用於
ClaimsIdentity(String, String, String)
使用指定的驗證類型、宣告類型和角色宣告類型,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class with the specified authentication type, name claim type, and role claim type.
public:
ClaimsIdentity(System::String ^ authenticationType, System::String ^ nameType, System::String ^ roleType);
public ClaimsIdentity (string authenticationType, string nameType, string roleType);
public ClaimsIdentity (string? authenticationType, string? nameType, string? roleType);
new System.Security.Claims.ClaimsIdentity : string * string * string -> System.Security.Claims.ClaimsIdentity
Public Sub New (authenticationType As String, nameType As String, roleType As String)
參數
- authenticationType
- String
使用的驗證 (Authentication) 類型。The type of authentication used.
- nameType
- String
要用於名稱宣告的宣告類型。The claim type to use for name claims.
- roleType
- String
要用於角色宣告的宣告類型。The claim type to use for role claims.
備註
下表所顯示的是 ClaimsIdentity 類別之執行個體的初始屬性值。The following table shows initial property values for an instance of the ClaimsIdentity class.
屬性Property | 值Value |
---|---|
Actor | null .null . |
AuthenticationType | authenticationType 參數的值。The value of the authenticationType parameter. 如果 authenticationType 參數為 null 或空字串,則會將屬性設定為 null 。If the authenticationType parameter is null or an empty string, the property is set to null . |
BootstrapContext | null .null . |
Claims | 空的集合。An empty collection. |
IsAuthenticated | 注意: 存取時, IsAuthenticated 會根據屬性的值傳回屬性的值 AuthenticationType 。Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property. |
Label | null .null . |
Name | 注意: 存取時, Name 會根據和集合傳回屬性的值 NameClaimType Claims 。Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection. |
NameClaimType | nameType 參數的值。The value of the nameType parameter. 如果 nameType 參數為 null 或空字串,則會將屬性設定為 DefaultNameClaimType 。If the nameType parameter is null or an empty string, the property is set to DefaultNameClaimType. |
RoleClaimType | roleType 參數的值。The value of the roleType parameter. 如果 roleType 參數為 null 或空字串,則會將屬性設定為 DefaultRoleClaimType 。If the roleType parameter is null or an empty string, the property is set to DefaultRoleClaimType. |
適用於
ClaimsIdentity(SerializationInfo, StreamingContext)
從使用 ISerializable 建立的序列化資料流,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class from a serialized stream created by using ISerializable.
protected:
ClaimsIdentity(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected ClaimsIdentity (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Security.SecurityCritical]
protected ClaimsIdentity (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Security.Claims.ClaimsIdentity : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.Claims.ClaimsIdentity
[<System.Security.SecurityCritical>]
new System.Security.Claims.ClaimsIdentity : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.Claims.ClaimsIdentity
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
.
適用於
ClaimsIdentity(IEnumerable<Claim>, String)
使用指定的宣告和驗證類型,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class with the specified claims and authentication type.
public:
ClaimsIdentity(System::Collections::Generic::IEnumerable<System::Security::Claims::Claim ^> ^ claims, System::String ^ authenticationType);
public ClaimsIdentity (System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims, string authenticationType);
public ClaimsIdentity (System.Collections.Generic.IEnumerable<System.Security.Claims.Claim>? claims, string? authenticationType);
new System.Security.Claims.ClaimsIdentity : seq<System.Security.Claims.Claim> * string -> System.Security.Claims.ClaimsIdentity
Public Sub New (claims As IEnumerable(Of Claim), authenticationType As String)
參數
- claims
- IEnumerable<Claim>
用來填入宣告識別的宣告。The claims with which to populate the claims identity.
- authenticationType
- String
使用的驗證 (Authentication) 類型。The type of authentication used.
備註
下表所顯示的是 ClaimsIdentity 類別之執行個體的初始屬性值。The following table shows initial property values for an instance of the ClaimsIdentity class.
屬性Property | 值Value |
---|---|
Actor | null .null . |
AuthenticationType | authenticationType 參數的值。The value of the authenticationType parameter. 如果 authenticationType 參數為 null 或空字串,則會將屬性設定為 null 。If the authenticationType parameter is null or an empty string, the property is set to null . |
BootstrapContext | null .null . |
Claims | 從參數初始化 claims 。Initialized from the claims parameter. |
IsAuthenticated | 注意: 存取時, IsAuthenticated 會根據屬性的值傳回屬性的值 AuthenticationType 。Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property. |
Label | null .null . |
Name | 注意: 存取時, Name 會根據和集合傳回屬性的值 NameClaimType Claims 。Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection. |
NameClaimType | DefaultNameClaimType.DefaultNameClaimType. |
RoleClaimType | DefaultRoleClaimType.DefaultRoleClaimType. |
適用於
ClaimsIdentity(IIdentity, IEnumerable<Claim>)
使用指定的宣告和指定的 ClaimsIdentity,初始化 IIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class using the specified claims and the specified IIdentity.
public:
ClaimsIdentity(System::Security::Principal::IIdentity ^ identity, System::Collections::Generic::IEnumerable<System::Security::Claims::Claim ^> ^ claims);
public ClaimsIdentity (System.Security.Principal.IIdentity identity, System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims);
public ClaimsIdentity (System.Security.Principal.IIdentity? identity, System.Collections.Generic.IEnumerable<System.Security.Claims.Claim>? claims);
new System.Security.Claims.ClaimsIdentity : System.Security.Principal.IIdentity * seq<System.Security.Claims.Claim> -> System.Security.Claims.ClaimsIdentity
Public Sub New (identity As IIdentity, claims As IEnumerable(Of Claim))
參數
- identity
- IIdentity
新宣告識別的基底識別。The identity from which to base the new claims identity.
- claims
- IEnumerable<Claim>
用來填入宣告識別的宣告。The claims with which to populate the claims identity.
備註
下表所顯示的是 ClaimsIdentity 類別之執行個體的初始屬性值。The following table shows initial property values for an instance of the ClaimsIdentity class.
屬性Property | 值Value |
---|---|
Actor | 如果 identity 可從指派 ClaimsIdentity ,則為屬性的值, identity.Actor 否則為 null 。If identity is assignable from ClaimsIdentity, the value of the identity.Actor property; otherwise, null . |
AuthenticationType | authenticationType 參數。The authenticationType parameter. 如果 authenticationType 參數為 null 或空字串,則 identity.AuthenticationType IIdentity.AuthenticationType 會使用 () 屬性的值。If the authenticationType parameter is null or an empty string, the value of the identity.AuthenticationType (IIdentity.AuthenticationType) property is used. |
BootstrapContext | 如果 identity 可從指派 ClaimsIdentity ,則為屬性的值, identity.BootStrapContext 否則為 null 。If identity is assignable from ClaimsIdentity, the value of the identity.BootStrapContext property; otherwise, null . |
Claims | 從參數初始化 claims 。Initialized from the claims parameter. 如果 identity 可從指派 ClaimsIdentity ,則的宣告 identity 會先加入至新的實例,再由參數所指定 claims 。If identity is assignable from ClaimsIdentity, the claims from identity are added to the new instance before those specified by the claims parameter. |
IsAuthenticated | 注意: 存取時, IsAuthenticated 會根據屬性的值傳回屬性的值 AuthenticationType 。Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property. |
Label | 如果 identity 可從指派 ClaimsIdentity ,則為屬性的值, identity.Label 否則為 null 。If identity is assignable from ClaimsIdentity, the value of the identity.Label property; otherwise, null . |
Name | 如果 identity 無法從指派 ClaimsIdentity ,則不是 null ,而且具有 IIdentity.Name 不是的屬性,而是 null 使用屬性值,將名稱宣告加入至新的實例 IIdentity.Name 。If identity is not assignable from ClaimsIdentity, is not null , and has an IIdentity.Name property that is not null ; a name claim is added to the new instance using the value of the IIdentity.Name property. 注意: 存取時, Name 會根據和集合傳回屬性的值 NameClaimType Claims 。Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection. |
NameClaimType | 如果 identity 可從指派 ClaimsIdentity ,則會使用屬性的值, identity.NameClaimType 否則 DefaultNameClaimType 會使用。If identity is assignable from ClaimsIdentity, the value of the identity.NameClaimType property is used; otherwise, DefaultNameClaimType is used. |
RoleClaimType | 如果 identity 可從指派 ClaimsIdentity ,則會使用屬性的值, identity.RoleClaimType 否則 DefaultRoleClaimType 會使用。If identity is assignable from ClaimsIdentity, the value of the identity.RoleClaimType property is used; otherwise, DefaultRoleClaimType is used. |
適用於
ClaimsIdentity(IIdentity)
使用名稱和驗證類型,從指定的 ClaimsIdentity 初始化 IIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class using the name and authentication type from the specified IIdentity.
public:
ClaimsIdentity(System::Security::Principal::IIdentity ^ identity);
public ClaimsIdentity (System.Security.Principal.IIdentity identity);
public ClaimsIdentity (System.Security.Principal.IIdentity? identity);
new System.Security.Claims.ClaimsIdentity : System.Security.Principal.IIdentity -> System.Security.Claims.ClaimsIdentity
Public Sub New (identity As IIdentity)
參數
- identity
- IIdentity
新宣告識別的基底識別。The identity from which to base the new claims identity.
備註
下表所顯示的是 ClaimsIdentity 類別之執行個體的初始屬性值。The following table shows initial property values for an instance of the ClaimsIdentity class.
屬性Property | 值Value |
---|---|
Actor | 如果 identity 可從指派 ClaimsIdentity ,則為屬性的值, identity.Actor 否則為 null 。If identity is assignable from ClaimsIdentity, the value of the identity.Actor property; otherwise, null . |
AuthenticationType | identity.AuthenticationType IIdentity.AuthenticationType 使用 () 屬性的值。The value of the identity.AuthenticationType (IIdentity.AuthenticationType) property is used. |
BootstrapContext | 如果 identity 可從指派 ClaimsIdentity ,則為屬性的值, identity.BootStrapContext 否則為 null 。If identity is assignable from ClaimsIdentity, the value of the identity.BootStrapContext property; otherwise, null . |
Claims | 如果 identity 可從指派 ClaimsIdentity ,則的宣告 identity 會加入至新的實例,否則為空集合。If identity is assignable from ClaimsIdentity, the claims from identity are added to the new instance; otherwise, an empty collection. |
IsAuthenticated | 注意: 存取時, IsAuthenticated 會根據屬性的值傳回屬性的值 AuthenticationType 。Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property. |
Label | 如果 identity 可從指派 ClaimsIdentity ,則為屬性的值, identity.Label 否則為 null 。If identity is assignable from ClaimsIdentity, the value of the identity.Label property; otherwise, null . |
Name | 如果 identity 無法從指派 ClaimsIdentity ,則不是 null ,而且具有 IIdentity.Name 不是的屬性,而是 null 使用屬性值,將名稱宣告加入至新的實例 IIdentity.Name 。If identity is not assignable from ClaimsIdentity, is not null , and has an IIdentity.Name property that is not null ; a name claim is added to the new instance using the value of the IIdentity.Name property. 注意: 存取時, Name 會根據和集合傳回屬性的值 NameClaimType Claims 。Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection. |
NameClaimType | 如果 identity 可從指派 ClaimsIdentity ,則會使用屬性的值, identity.NameClaimType 否則 DefaultNameClaimType 會使用。If identity is assignable from ClaimsIdentity, the value of the identity.NameClaimType property is used; otherwise, DefaultNameClaimType is used. |
RoleClaimType | 如果 identity 可從指派 ClaimsIdentity ,則會使用屬性的值, identity.RoleClaimType 否則 DefaultRoleClaimType 會使用。If identity is assignable from ClaimsIdentity, the value of the identity.RoleClaimType property is used; otherwise, DefaultRoleClaimType is used. |
適用於
ClaimsIdentity(ClaimsIdentity)
從現有的 ClaimsIdentity 執行個體初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class from an existing ClaimsIdentity instance.
protected:
ClaimsIdentity(System::Security::Claims::ClaimsIdentity ^ other);
protected ClaimsIdentity (System.Security.Claims.ClaimsIdentity other);
new System.Security.Claims.ClaimsIdentity : System.Security.Claims.ClaimsIdentity -> System.Security.Claims.ClaimsIdentity
Protected Sub New (other As ClaimsIdentity)
參數
- other
- ClaimsIdentity
要複製的 ClaimsIdentity。The ClaimsIdentity to copy.
例外狀況
other
為 null
。other
is null
.
備註
下表顯示提供給函式之類別實例的屬性值指派 ClaimsIdentity ClaimsIdentity 。The following table shows the property value assignments for an instance of the ClaimsIdentity class from the ClaimsIdentity provided to the constructor.
屬性Property | 值Value |
---|---|
Actor | 如果屬性的值 other.Actor 不是 null ,則 other.Actor ClaimsIdentity 會複製並指派,否則為 null 。If the value of the other.Actor property isn't null , the other.Actor ClaimsIdentity is cloned and assigned; otherwise, null . |
AuthenticationType | other.AuthenticationType 屬性的值。The value of the other.AuthenticationType property. |
BootstrapContext | other.BootstrapContext 屬性的值。The value of the other.BootstrapContext property. |
Claims | List<Claim> 屬性中的宣告(如果有的話) other.Claims 。The List<Claim> of claims, if any, in the other.Claims property. |
Label | other.Label 屬性的值。The value of the other.Label property. |
NameClaimType | other.NameClaimType 屬性的值。The value of the other.NameClaimType property. |
RoleClaimType | other.RoleClaimType 屬性的值。The value of the other.RoleClaimType property. |
CustomSerializationData | 如果 other.CustomSerializationData 不 null other.CustomSerializationData 是,則會複製並指派,否則為 null 。If other.CustomSerializationData isn't null , other.CustomSerializationData is cloned and assigned; otherwise, null . |
適用於
ClaimsIdentity(SerializationInfo)
從使用 ISerializable 建立的序列化資料流,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class from a serialized stream created by using ISerializable.
protected:
ClaimsIdentity(System::Runtime::Serialization::SerializationInfo ^ info);
protected ClaimsIdentity (System.Runtime.Serialization.SerializationInfo info);
[System.Security.SecurityCritical]
protected ClaimsIdentity (System.Runtime.Serialization.SerializationInfo info);
new System.Security.Claims.ClaimsIdentity : System.Runtime.Serialization.SerializationInfo -> System.Security.Claims.ClaimsIdentity
[<System.Security.SecurityCritical>]
new System.Security.Claims.ClaimsIdentity : System.Runtime.Serialization.SerializationInfo -> System.Security.Claims.ClaimsIdentity
Protected Sub New (info As SerializationInfo)
參數
- info
- SerializationInfo
序列化的資料。The serialized data.
- 屬性
例外狀況
info
為 null
。info
is null
.
適用於
ClaimsIdentity(BinaryReader)
使用指定的 BinaryReader,初始化 ClaimsIdentity 的執行個體。Initializes an instance of ClaimsIdentity with the specified BinaryReader.
public:
ClaimsIdentity(System::IO::BinaryReader ^ reader);
public ClaimsIdentity (System.IO.BinaryReader reader);
new System.Security.Claims.ClaimsIdentity : System.IO.BinaryReader -> System.Security.Claims.ClaimsIdentity
Public Sub New (reader As BinaryReader)
參數
- reader
- BinaryReader
指向 ClaimsIdentity 的 BinaryReader。A BinaryReader pointing to a ClaimsIdentity.
例外狀況
reader
為 null
。reader
is null
.
備註
一般情況下,讀取器是以從傳回的位元組來構成 WriteTo 。Normally, the reader is constructed from the bytes returned from WriteTo.
適用於
ClaimsIdentity(IEnumerable<Claim>)
使用 ClaimsIdentity 物件的列舉集合,初始化 Claim 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class using an enumerated collection of Claim objects.
public:
ClaimsIdentity(System::Collections::Generic::IEnumerable<System::Security::Claims::Claim ^> ^ claims);
public ClaimsIdentity (System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims);
public ClaimsIdentity (System.Collections.Generic.IEnumerable<System.Security.Claims.Claim>? claims);
new System.Security.Claims.ClaimsIdentity : seq<System.Security.Claims.Claim> -> System.Security.Claims.ClaimsIdentity
Public Sub New (claims As IEnumerable(Of Claim))
參數
- claims
- IEnumerable<Claim>
用來填入宣告識別的宣告。The claims with which to populate the claims identity.
備註
下表所顯示的是 ClaimsIdentity 類別之執行個體的初始屬性值。The following table shows initial property values for an instance of the ClaimsIdentity class.
屬性Property | 值Value |
---|---|
Actor | null .null . |
AuthenticationType | null .null . |
BootstrapContext | null .null . |
Claims | 從參數初始化 claims 。Initialized from the claims parameter. |
IsAuthenticated | 注意: 存取時, IsAuthenticated 會根據屬性的值傳回屬性的值 AuthenticationType 。Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property. |
Label | null .null . |
Name | 注意: 存取時, Name 會根據和集合傳回屬性的值 NameClaimType Claims 。Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection. |
NameClaimType | DefaultNameClaimType.DefaultNameClaimType. |
RoleClaimType | DefaultRoleClaimType.DefaultRoleClaimType. |
適用於
ClaimsIdentity(String)
使用空白宣告集合和指定的驗證類型,初始化 ClaimsIdentity 類別的新執行個體。Initializes a new instance of the ClaimsIdentity class with an empty claims collection and the specified authentication type.
public:
ClaimsIdentity(System::String ^ authenticationType);
public ClaimsIdentity (string authenticationType);
public ClaimsIdentity (string? authenticationType);
new System.Security.Claims.ClaimsIdentity : string -> System.Security.Claims.ClaimsIdentity
Public Sub New (authenticationType As String)
參數
- authenticationType
- String
使用的驗證 (Authentication) 類型。The type of authentication used.
備註
下表所顯示的是 ClaimsIdentity 類別之執行個體的初始屬性值。The following table shows initial property values for an instance of the ClaimsIdentity class.
屬性Property | 值Value |
---|---|
Actor | null .null . |
AuthenticationType | authenticationType 參數的值。The value of the authenticationType parameter. 如果 authenticationType 參數為 null 或空字串,則會將屬性設定為 null 。If the authenticationType parameter is null or an empty string, the property is set to null . |
BootstrapContext | null .null . |
Claims | 空的集合。An empty collection. |
IsAuthenticated | 注意: 存取時, IsAuthenticated 會根據屬性的值傳回屬性的值 AuthenticationType 。Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property. |
Label | null .null . |
Name | 注意: 存取時, Name 會根據和集合傳回屬性的值 NameClaimType Claims 。Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection. |
NameClaimType | DefaultNameClaimType.DefaultNameClaimType. |
RoleClaimType | DefaultRoleClaimType.DefaultRoleClaimType. |