ClaimsIdentity ClaimsIdentity ClaimsIdentity ClaimsIdentity Constructors

Definition

Overloads

ClaimsIdentity() ClaimsIdentity() ClaimsIdentity()

Initializes a new instance of the ClaimsIdentity class with an empty claims collection.

ClaimsIdentity(IIdentity, IEnumerable<Claim>, String, String, String) ClaimsIdentity(IIdentity, IEnumerable<Claim>, String, String, String) ClaimsIdentity(IIdentity, IEnumerable<Claim>, String, String, String) ClaimsIdentity(IIdentity, IEnumerable<Claim>, String, String, String)

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(IEnumerable<Claim>, String, String, String) ClaimsIdentity(IEnumerable<Claim>, String, String, String) ClaimsIdentity(IEnumerable<Claim>, String, String, String)

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(String, String, String) ClaimsIdentity(String, String, String) ClaimsIdentity(String, String, String)

Initializes a new instance of the ClaimsIdentity class with the specified authentication type, name claim type, and role claim type.

ClaimsIdentity(SerializationInfo, StreamingContext) ClaimsIdentity(SerializationInfo, StreamingContext) ClaimsIdentity(SerializationInfo, StreamingContext) ClaimsIdentity(SerializationInfo, StreamingContext)

Initializes a new instance of the ClaimsIdentity class from a serialized stream created by using ISerializable.

ClaimsIdentity(IEnumerable<Claim>, String) ClaimsIdentity(IEnumerable<Claim>, String) ClaimsIdentity(IEnumerable<Claim>, String) ClaimsIdentity(IEnumerable<Claim>, String)

Initializes a new instance of the ClaimsIdentity class with the specified claims and authentication type.

ClaimsIdentity(IIdentity, IEnumerable<Claim>) ClaimsIdentity(IIdentity, IEnumerable<Claim>) ClaimsIdentity(IIdentity, IEnumerable<Claim>) ClaimsIdentity(IIdentity, IEnumerable<Claim>)

Initializes a new instance of the ClaimsIdentity class using the specified claims and the specified IIdentity.

ClaimsIdentity(IIdentity) ClaimsIdentity(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) ClaimsIdentity(ClaimsIdentity) ClaimsIdentity(ClaimsIdentity)

Initializes a new instance of the ClaimsIdentity class from an existing ClaimsIdentity instance.

ClaimsIdentity(SerializationInfo) ClaimsIdentity(SerializationInfo) ClaimsIdentity(SerializationInfo) ClaimsIdentity(SerializationInfo)

Initializes a new instance of the ClaimsIdentity class from a serialized stream created by using ISerializable.

ClaimsIdentity(BinaryReader) ClaimsIdentity(BinaryReader) ClaimsIdentity(BinaryReader) ClaimsIdentity(BinaryReader)

Initializes an instance of ClaimsIdentity with the specified BinaryReader.

ClaimsIdentity(IEnumerable<Claim>) ClaimsIdentity(IEnumerable<Claim>) ClaimsIdentity(IEnumerable<Claim>) ClaimsIdentity(IEnumerable<Claim>)

Initializes a new instance of the ClaimsIdentity class using an enumerated collection of Claim objects.

ClaimsIdentity(String) ClaimsIdentity(String) ClaimsIdentity(String) ClaimsIdentity(String)

Initializes a new instance of the ClaimsIdentity class with an empty claims collection and the specified authentication type.

ClaimsIdentity() ClaimsIdentity() ClaimsIdentity()

Initializes a new instance of the ClaimsIdentity class with an empty claims collection.

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

Remarks

The following table shows initial property values for an instance of the ClaimsIdentity class.

Property Value
Actor null.
AuthenticationType null.
BootstrapContext null.
Claims A empty collection.
IsAuthenticated Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property.
Label null.
Name Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection.
NameClaimType DefaultNameClaimType.
RoleClaimType DefaultRoleClaimType.

ClaimsIdentity(IIdentity, IEnumerable<Claim>, String, String, String) ClaimsIdentity(IIdentity, IEnumerable<Claim>, String, String, String) ClaimsIdentity(IIdentity, IEnumerable<Claim>, String, String, String) ClaimsIdentity(IIdentity, IEnumerable<Claim>, String, String, String)

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);
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)

Parameters

identity
IIdentity IIdentity IIdentity 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 String String String

The type of authentication used.

nameType
String String String String

The claim type to use for name claims.

roleType
String String String String

The claim type to use for role claims.

Exceptions

Remarks

The following table shows initial property values for an instance of the ClaimsIdentity class.

Property Value
Actor If identity is assignable from ClaimsIdentity, the value of the identity.Actor property; otherwise, null.
AuthenticationType The authenticationType parameter. If the authenticationType parameter is null or an empty string, the value of the identity.AuthenticationType (IIdentity.AuthenticationType) property is used.
BootstrapContext If identity is assignable from ClaimsIdentity, the value of the identity.BootStrapContext property; otherwise, null.
Claims Initialized from the claims parameter. If identity is assignable from ClaimsIdentity, the claims from identity are added to the new instance before those specified by the claims parameter.
IsAuthenticated Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property.
Label If identity is assignable from ClaimsIdentity, the value of the identity.Label property; otherwise, null.
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. Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection.
NameClaimType The value of the nameType parameter. 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 The value of the roleClaimType parameter. 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(IEnumerable<Claim>, String, String, String) ClaimsIdentity(IEnumerable<Claim>, String, String, String) ClaimsIdentity(IEnumerable<Claim>, String, String, String)

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);
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)

Parameters

claims
IEnumerable<Claim>

The claims with which to populate the claims identity.

authenticationType
String String String String

The type of authentication used.

nameType
String String String String

The claim type to use for name claims.

roleType
String String String String

The claim type to use for role claims.

Remarks

The following table shows initial property values for an instance of the ClaimsIdentity class.

Property Value
Actor null.
AuthenticationType The value of the authenticationType parameter. If the authenticationType parameter is null or an empty string, the property is set to null.
BootstrapContext null.
Claims Initialized from the claims parameter.
IsAuthenticated Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property.
Label null.
Name Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection.
NameClaimType The value of the nameType parameter. However, if the nameType parameter is null or an empty string, the property is set to DefaultNameClaimType.
RoleClaimType The value of the roleClaimType parameter. However, if the roleClaimType parameter is null or an empty string, the property is set to DefaultRoleClaimType.

ClaimsIdentity(String, String, String) ClaimsIdentity(String, String, String) ClaimsIdentity(String, String, String) ClaimsIdentity(String, String, String)

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);
new System.Security.Claims.ClaimsIdentity : string * string * string -> System.Security.Claims.ClaimsIdentity
Public Sub New (authenticationType As String, nameType As String, roleType As String)

Parameters

authenticationType
String String String String

The type of authentication used.

nameType
String String String String

The claim type to use for name claims.

roleType
String String String String

The claim type to use for role claims.

Remarks

The following table shows initial property values for an instance of the ClaimsIdentity class.

Property Value
Actor null.
AuthenticationType The value of the authenticationType parameter. If the authenticationType parameter is null or an empty string, the property is set to null.
BootstrapContext null.
Claims An empty collection.
IsAuthenticated Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property.
Label null.
Name Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection.
NameClaimType The value of the nameType parameter. If the nameType parameter is null or an empty string, the property is set to DefaultNameClaimType.
RoleClaimType The value of the roleType parameter. If the roleType parameter is null or an empty string, the property is set to DefaultRoleClaimType.

ClaimsIdentity(SerializationInfo, StreamingContext) ClaimsIdentity(SerializationInfo, StreamingContext) ClaimsIdentity(SerializationInfo, StreamingContext) ClaimsIdentity(SerializationInfo, StreamingContext)

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);
[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
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameters

context
StreamingContext StreamingContext StreamingContext StreamingContext

The context for serialization.

Exceptions

Security

SecurityCriticalAttribute
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

ClaimsIdentity(IEnumerable<Claim>, String) ClaimsIdentity(IEnumerable<Claim>, String) ClaimsIdentity(IEnumerable<Claim>, String) ClaimsIdentity(IEnumerable<Claim>, String)

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);
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)

Parameters

claims
IEnumerable<Claim>

The claims with which to populate the claims identity.

authenticationType
String String String String

The type of authentication used.

Remarks

The following table shows initial property values for an instance of the ClaimsIdentity class.

Property Value
Actor null.
AuthenticationType The value of the authenticationType parameter. If the authenticationType parameter is null or an empty string, the property is set to null.
BootstrapContext null.
Claims Initialized from the claims parameter.
IsAuthenticated Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property.
Label null.
Name Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection.
NameClaimType DefaultNameClaimType.
RoleClaimType DefaultRoleClaimType.

ClaimsIdentity(IIdentity, IEnumerable<Claim>) ClaimsIdentity(IIdentity, IEnumerable<Claim>) ClaimsIdentity(IIdentity, IEnumerable<Claim>) ClaimsIdentity(IIdentity, IEnumerable<Claim>)

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);
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))

Parameters

identity
IIdentity IIdentity IIdentity IIdentity

The identity from which to base the new claims identity.

claims
IEnumerable<Claim>

The claims with which to populate the claims identity.

Remarks

The following table shows initial property values for an instance of the ClaimsIdentity class.

Property Value
Actor If identity is assignable from ClaimsIdentity, the value of the identity.Actor property; otherwise, null.
AuthenticationType The authenticationType parameter. If the authenticationType parameter is null or an empty string, the value of the identity.AuthenticationType (IIdentity.AuthenticationType) property is used.
BootstrapContext If identity is assignable from ClaimsIdentity, the value of the identity.BootStrapContext property; otherwise, null.
Claims Initialized from the claims parameter. If identity is assignable from ClaimsIdentity, the claims from identity are added to the new instance before those specified by the claims parameter.
IsAuthenticated Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property.
Label If identity is assignable from ClaimsIdentity, the value of the identity.Label property; otherwise, null.
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. Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection.
NameClaimType If identity is assignable from ClaimsIdentity, the value of the identity.NameClaimType property is used; otherwise, DefaultNameClaimType is used.
RoleClaimType If identity is assignable from ClaimsIdentity, the value of the identity.RoleClaimType property is used; otherwise, DefaultRoleClaimType is used.

ClaimsIdentity(IIdentity) ClaimsIdentity(IIdentity) 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);
new System.Security.Claims.ClaimsIdentity : System.Security.Principal.IIdentity -> System.Security.Claims.ClaimsIdentity
Public Sub New (identity As IIdentity)

Parameters

identity
IIdentity IIdentity IIdentity IIdentity

The identity from which to base the new claims identity.

Remarks

The following table shows initial property values for an instance of the ClaimsIdentity class.

Property Value
Actor If identity is assignable from ClaimsIdentity, the value of the identity.Actor property; otherwise, null.
AuthenticationType The value of the identity.AuthenticationType (IIdentity.AuthenticationType) property is used.
BootstrapContext If identity is assignable from ClaimsIdentity, the value of the identity.BootStrapContext property; otherwise, null.
Claims If identity is assignable from ClaimsIdentity, the claims from identity are added to the new instance; otherwise, an empty collection.
IsAuthenticated Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property.
Label If identity is assignable from ClaimsIdentity, the value of the identity.Label property; otherwise, null.
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. Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection.
NameClaimType If identity is assignable from ClaimsIdentity, the value of the identity.NameClaimType property is used; otherwise, DefaultNameClaimType is used.
RoleClaimType If identity is assignable from ClaimsIdentity, the value of the identity.RoleClaimType property is used; otherwise, DefaultRoleClaimType is used.

ClaimsIdentity(ClaimsIdentity) ClaimsIdentity(ClaimsIdentity) 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)

Parameters

Exceptions

Remarks

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 If the value of the other.Actor property isn't null, the other.Actor ClaimsIdentity is cloned and assigned; otherwise, null.
AuthenticationType The value of the other.AuthenticationType property.
BootstrapContext The value of the other.BootstrapContext property.
Claims The List<Claim> of claims, if any, in the other.Claims property.
Label The value of the other.Label property.
NameClaimType The value of the other.NameClaimType property.
RoleClaimType The value of the other.RoleClaimType property.
CustomSerializationData If other.CustomSerializationData isn't null, other.CustomSerializationData is cloned and assigned; otherwise, null.

ClaimsIdentity(SerializationInfo) ClaimsIdentity(SerializationInfo) ClaimsIdentity(SerializationInfo) ClaimsIdentity(SerializationInfo)

Initializes a new instance of the ClaimsIdentity class from a serialized stream created by using ISerializable.

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
Protected Sub New (info As SerializationInfo)

Parameters

Exceptions

Security

SecurityCriticalAttribute
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

ClaimsIdentity(BinaryReader) ClaimsIdentity(BinaryReader) ClaimsIdentity(BinaryReader) ClaimsIdentity(BinaryReader)

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)

Parameters

Exceptions

Remarks

Normally, the reader is constructed from the bytes returned from WriteTo.

ClaimsIdentity(IEnumerable<Claim>) ClaimsIdentity(IEnumerable<Claim>) ClaimsIdentity(IEnumerable<Claim>) ClaimsIdentity(IEnumerable<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);
new System.Security.Claims.ClaimsIdentity : seq<System.Security.Claims.Claim> -> System.Security.Claims.ClaimsIdentity
Public Sub New (claims As IEnumerable(Of Claim))

Parameters

claims
IEnumerable<Claim>

The claims with which to populate the claims identity.

Remarks

The following table shows initial property values for an instance of the ClaimsIdentity class.

Property Value
Actor null.
AuthenticationType null.
BootstrapContext null.
Claims Initialized from the claims parameter.
IsAuthenticated Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property.
Label null.
Name Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection.
NameClaimType DefaultNameClaimType.
RoleClaimType DefaultRoleClaimType.

ClaimsIdentity(String) ClaimsIdentity(String) ClaimsIdentity(String) ClaimsIdentity(String)

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);
new System.Security.Claims.ClaimsIdentity : string -> System.Security.Claims.ClaimsIdentity
Public Sub New (authenticationType As String)

Parameters

authenticationType
String String String String

The type of authentication used.

Remarks

The following table shows initial property values for an instance of the ClaimsIdentity class.

Property Value
Actor null.
AuthenticationType The value of the authenticationType parameter. If the authenticationType parameter is null or an empty string, the property is set to null.
BootstrapContext null.
Claims An empty collection.
IsAuthenticated Note: When accessed, the value of the IsAuthenticated property is returned based on the value of the AuthenticationType property.
Label null.
Name Note: When accessed, the value of the Name property is returned based on the NameClaimType and the Claims collection.
NameClaimType DefaultNameClaimType.
RoleClaimType DefaultRoleClaimType.

Applies to