Class ApiGatewayv1JwtAuthorizer

Implements authorization on API Gateway v1 (Rest API) using JWT.

Hierarchy

Constructors

Properties

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

The claims of the authenticated user.

Type declaration

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

Methods

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

    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 using the claims provided by the API Gateway event or by decoding a JWT token from the 'Authorization' header.

    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