README
Global Authorizer function to authorize protected routes
How do I get set up?
- Summary of set up
** npm install @teamfabric/authorizer **
Add a route under a /app/routes/auth/authorizer.js
Copy and paste below
const { authorize } = require('@teamfabric/authorizer')
exports.handler = async event => {
return authorize(event)
}
In your serverless.yml add the handeer to the route above
functions:
authorizerFunc:
handler: app/routes/auth/authorize.handler
For routes you want to protect add
authorizer:
name: authorizerFunc
resultTtlInSeconds: 0
For example
user-get:
name: ${self:provider.apiName}-user-get
memorySize: 512
handler: app/routes/user/core/get.handler
events:
- http:
method: get
path: /user/{userId}
private: true
authorizer:
name: authorizerFunc
resultTtlInSeconds: 0
TO DO
- move the jwt public and private key to files