distinction-dev / lambda-authorizer-utils

Collection of utilities and helper functions to make working with Lambda Authorizers easy
https://distinction-dev.github.io/lambda-authorizer-utils
MIT License
2 stars 1 forks source link

Lambda Authorizer Utils

Collection of utility functions / helpers to help with building Api Gateway Lambda Authorizer easier with Typescript

Install

yarn add @distinction-dev/lambda-authorizer-utils

Modules

Usage

import { AuthorizerResponse } from "@distinction-dev/lambda-authorizer-utils";

export const authorizer = (event: APIGatewayRequestAuthorizerEvent) => {
  const response = new AuthorizerResponse(
    "<principal_id>",
    "<aws_region>",
    "<aws_account_id>",
    "<api_id>",
    "<api_stage>"
  );
  response.addRoute("GET", "/test");
  return response.getPolicy();
};

Docs

Full docs here