Class JwtAuthorizerAbstract

A generic JWT authorizer base class, presupposing the presence of an issuer, a number of authorization claims, an admin permission claim and optionally a separate URL to a JWKS to use if the issuers well-known URL does not point to it in its metadata.

Hierarchy

Constructors

  • Parameters

    • issuerUrl: string
    • groupClaim: string
    • adminClaim: string
    • Optional jwksUrl: string
      Optional

    Returns JwtAuthorizer

Properties

adminClaim: string
claims?: {
    [name: string]: string | number | boolean | string[];
}

The claims of the authenticated user.

Type declaration

  • [name: string]: string | number | boolean | string[]
groupClaim: string
issuerUrl: string
jwksUrl?: string

Methods

  • Throws a ForbiddenError if the user is not authenticated or is not an admin.

    Returns void

  • Throws an UnauthenticatedError if the user is not authenticated.

    Returns void

  • Throws a ForbiddenError if the user is not authenticated or does not belong to the specified group.

    Parameters

    • group: string

      The name of the group to check.

    Returns void

  • Authenticates the user and sets the claims.

    Returns Promise<void>

  • Returns the value of the claim with the specified name, or undefined if the claim does not exist.

    Parameters

    • name: string

      The name of the claim to retrieve.

    Returns undefined | string | number | boolean | string[]

  • Returns the email of the authenticated user.

    Returns string

  • Returns an array of groups the user belongs to, or an empty array if the user is not authenticated or has no groups.

    Returns string[]

  • Returns the subject of the authenticated user.

    Returns string

  • Returns true if the user belongs to the specified group, false otherwise.

    Parameters

    • group: string

      The name of the group to check.

    Returns boolean

  • Returns true if the user belongs to the 'admin' group, false otherwise.

    Returns boolean

  • Returns true if the user is authenticated, false otherwise.

    Returns boolean

Generated using TypeDoc