Skip to main content

HasClaims <ClaimType>

Used by classes that contains OAuth2 claims.

This provides common conveniences for interacting with user or token information within those claims. For example, iterating through allClaims or using keyed subscripting to access specific claims. *

Hierarchy

Implemented by

Index

Properties

readonlyallClaims

allClaims: String[]

Returns the collection of custom claims this object contains.

Unlike the claims property, this returns values as strings.

readonlyclaims

claims: ClaimType[keyof ClaimType][]

readonlycustomClaims

customClaims: String[]

Returns the collection of custom claims this object contains.

Unlike the `claims` property, this returns values as strings.

readonlypayload

payload: [String: any]

Raw payload of claims, as a dictionary representation.

Methods

optionalarrayValue

  • arrayValue<ValueType>(type: ValueType, key: String): ValueType[]
  • arrayValue<ValueType>(type: ValueType, claim: ClaimType): ValueType[]
  • Returns an array of claim values from this JWT token, with the given key and expected return type.


    Type parameters

    Parameters

    • type: ValueType

      The type the value is expected to be, or should be converted to (using ClaimConvertible).

    • key: String

      The key to use when extracting the claim.

    Returns ValueType[]

    The value for the supplied claim of the requested type.

optionalvalue

  • value<ValueType>(type: ValueType, key: String): ValueType
  • value<ValueType>(type: ValueType, claim: ClaimType): ValueType
  • Returns a claim value from this JWT token, with the given key and expected return type.


    Type parameters

    Parameters

    • type: ValueType

      The type the value is expected to be, or should be converted to (using ClaimConvertible).

    • key: String

      The key to use when extracting the claim.

    Returns ValueType

    The value for the supplied claim of the requested type.