https://github.com/awkward/serverless-plugin-authorizer
Make authorization as simple as a boolean
https://github.com/awkward/serverless-plugin-authorizer
Last synced: about 1 year ago
JSON representation
Make authorization as simple as a boolean
- Host: GitHub
- URL: https://github.com/awkward/serverless-plugin-authorizer
- Owner: awkward
- Created: 2018-02-07T10:41:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-29T10:33:40.000Z (about 8 years ago)
- Last Synced: 2024-10-02T08:26:57.940Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 5
- Watchers: 13
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Serverless Plugin Authorizer
Normally you would define this in every function in your http event:
```yaml
# Before
authorizer:
resultTtlInSeconds: 30
arn: arn:aws:lambda:xxxx:function:authorizer-fn
type: request
```
However, now you can add `authorization` which will allow everything to be passed through as `authorizer` in your functions.
```yaml
# After
custom:
authorization:
resultTtlInSeconds: 30
arn: arn:aws:lambda:xxxx:function:authorizer-fn
type: request
```
Using `authorize: true` to your http event like so:
```yaml
# After
functions:
myFunction:
handler: src/myFunction.handler
events:
- http:
path: path/to/function
method: get
authorize: true
```
## Install
Using yarn:
```
yarn add serverless-plugin-authorizer
```
Using npm:
```
npm install serverless-plugin-authorizer --save-dev
```
Add the plugin to your `serverless.yml` file:
```yaml
plugins:
- serverless-plugin-authorizer
```