digital-lambda-authorizer

0.1.12 • Public • Published

digital-lambda-authorizer

Lambda function that acts as an authorizer for Digital API Gateways.

The logic for the authorizer validates an Okta token, which should be supplied in a request header when clients make calls to a protected resource. This codebase allows parameters to be supplied for the Okta client ID and issuer URL that is used in the token validation process. Due to this parameterization, it is possible to deploy this authorizer multiple times to the same environment and the same account (using different parameter values) when you have more than 1 Okta client ID that being used to generate tokens.

Local Environment Setup

You will need to have the following installed on your computer:

  • node 14.0.0 and npm
    • MacOS users should consider installing nvm for easy switching of node versions
  • AWS CLI - Install the AWS CLI and [configure it with your AWS credentials].
  • SAM CLI - Install the SAM CLI
    • The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
  • Docker or Docker Desktop - Install Docker community edition

Testing locally

Steps

  1. Acquire a token (which can be done with Postman) and set it into src/test/event.json as the value for the authorizationTokengit property.
  2. Create/update a file in the root directory of this project called local-env-var-overrides.json and populate it with correct values. The contents of the file should be based on the local-env-var-overrides.json.example template
  3. Execute the below command

npm run-script test-invoke-local-lambda

Deploying manually to the AWS Dev environment

To deploy the authorizer for use by Digital applications, run this command npm run-script deploy:dev

To deploy the authorizer for use by Digital applications, run this command npm run-script deploy:dev-fleet

Note - running the correct script will ensure that the right stack name and parameter values are used.

Readme

Keywords

none

Package Sidebar

Install

npm i digital-lambda-authorizer

Weekly Downloads

0

Version

0.1.12

License

UNLICENSED

Unpacked Size

75.6 kB

Total Files

30

Last publish

Collaborators

  • saviobatista