laardee / serverless-authentication-boilerplate

Generic authentication boilerplate for Serverless framework
http://laardee.github.io/serverless-authentication-gh-pages
MIT License
568 stars 71 forks source link

Feature: Custom Authorizer #66

Open thejeff77 opened 4 years ago

thejeff77 commented 4 years ago

This looks great for authorizing with different providers through an intermediary service, and setting up the endpoints to do so!

However, for using the auth-result of this with any other functions, and for re-usability, it seems like an ideal solution would be to use a "custom authorizer" to validate the credentials passed up for subsequent calls which would act as the middleware and pass the profile back to the lambda function.

The test app here appears to put the auth code inline which makes for a lot of duplicate boilerplate.

Authorizer Blueprints: https://github.com/awslabs/aws-apigateway-lambda-authorizer-blueprints/blob/master/blueprints/nodejs/index.js

I'm interested in discussing this, and potentially collaborating on a new project, or helping with this one...

It seems to me that Cognito and Auth0 can be very expensive, and open source Custom Authorizers would be an amazing alternative/cheap open source project to these pay solutions.

Example Deployment: