Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kopertop/lambda-jwt

API Gateway Lambda function to support JSON Web Tokens
https://github.com/kopertop/lambda-jwt

Last synced: 3 months ago
JSON representation

API Gateway Lambda function to support JSON Web Tokens

Awesome Lists containing this project

README

        

Lambda API Gateway support for JSON Web Tokens
==============================================

API Gateway custom Lambda function for JSON Web Token: https://jwt.io/introduction/

To Generate your own private key
--------------------------------
```
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -nodes
```

Upload to AWS
-------------

Log into the AWS console and create an empty "jwtAuthorize" function using Node.js.

Create or copy your public key as "cert.pem" in this folder.

Run

```
npm install
grunt deploy --account-id=
```

Tie this function to your AWS API Gateway
-----------------------------------------

Go to the AWS console and choose your API gateway. Under "Resources" choose "Custom Authorizers".
Create a new authorizer with the identityToken source of `method.request.header.Authorization`
and a Token validation expression of `Bearer [^\.]+\.[^\.]+\.[^\.]+` and associate it with your newly
created jwtAuthorizer Lambda function.