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.
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
Steps
- Acquire a token (which can be done with Postman) and set it into
src/test/event.json
as the value for theauthorizationTokengit
property. - 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 thelocal-env-var-overrides.json.example
template - Execute the below command
npm run-script test-invoke-local-lambda
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.