UNPKG

@dvsa/appdev-api-common

Version:

Utils library for common API functionality

24 lines (23 loc) 908 B
import type { Request } from "express"; import type { Action } from "routing-controllers"; import type { APIGatewayModel } from "../api/api-gateway-model"; export type RoutingControllersRequest = Request & { apiGateway: APIGatewayModel; }; export declare class JWTAuthChecker { private readonly clientId; private readonly tenantId; /** * Create a new instance of the JWTAuthChecker class * @param clientId - the client id(s) to validate the token against * @param tenantId - the tenant id to validate the token against */ constructor(clientId?: string | null, tenantId?: string | null); /** * Perform a JWT token verification and role check * @param {RoutingControllersRequest} request * @param {string | string[]} roles * @returns {Promise<boolean>} */ execute: ({ request }: Action, roles?: string | string[]) => Promise<boolean>; }