Class AppSyncCognitoAuthorizer

AppSyncCognitoAuthorizer is a class that extends CognitoAuthorizer and implements authentication logic for AppSync resolver events with a Cognito authorizer.

Hierarchy

Constructors

Properties

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

The claims of the authenticated user.

Type declaration

  • [name: string]: string | number | boolean | string[]
event: AppSyncResolverEvent<any, null | Record<string, any>>
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 AppSync event.

    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 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 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

Generated using TypeDoc