Share via


ClaimsIdentity class

Represents an identity with a collection of claims.

Constructors

ClaimsIdentity(Claim[], string | boolean)

Creates a new instance of the ClaimsIdentity class.

Properties

claims
isAuthenticated

Indicates whether the identity is authenticated.

Methods

getClaimValue(string)

Gets the value of a claim by its type.

Constructor Details

ClaimsIdentity(Claim[], string | boolean)

Creates a new instance of the ClaimsIdentity class.

new ClaimsIdentity(claims: Claim[], authenticationType?: string | boolean)

Parameters

claims

Claim[]

The collection of claims associated with the identity.

authenticationType

string | boolean

The type of authentication used, or a boolean indicating if the identity is authenticated.

Property Details

claims

claims: Claim[]

Property Value

Claim[]

isAuthenticated

Indicates whether the identity is authenticated.

boolean isAuthenticated

Property Value

boolean

True if the identity is authenticated; otherwise, false.

Method Details

getClaimValue(string)

Gets the value of a claim by its type.

function getClaimValue(claimType: string): null | string

Parameters

claimType

string

The type of the claim to retrieve.

Returns

null | string

The value of the claim, or null if the claim is not found.