ClaimsIdentity Constructor (IIdentity, IEnumerable(Claim), String, String, String)

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

.NET Framework (current version)
 

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.

Namespace:   System.Security.Claims
Assembly:  mscorlib (in mscorlib.dll)

new : 
        identity:IIdentity *
        claims:IEnumerable<Claim> *
        authenticationType:string *
        nameType:string *
        roleType:string -> ClaimsIdentity

Parameters

identity
Type: System.Security.Principal.IIdentity

The identity from which to base the new claims identity.

claims
Type: System.Collections.Generic.IEnumerable<Claim>

The claims with which to populate the new claims identity.

authenticationType
Type: System.String

The type of authentication used.

nameType
Type: System.String

The claim type to use for name claims.

roleType
Type: System.String

The claim type to use for role claims.

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

System_CAPS_noteNote

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.

System_CAPS_noteNote

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.

Universal Windows Platform
Available since 10
.NET Framework
Available since 4.5
Return to top
Show:
© 2016 Microsoft