Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-plugin-cfauthorizer

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-plugin-cfauthorizer

Kenneth Falck <kennu@sc5.io> 2016

  • 0.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-37.93%
Maintainers
1
Weekly downloads
 
Created
Source

Serverless CloudFormation Authorizer Plugin

Kenneth Falck kennu@sc5.io 2016

Overview

Compatibility: Serverless 1.0

This plugin allows you to define your own API Gateway Authorizers as the Serverless CloudFormation resources and apply them to HTTP endpoints. Currently the main use case for this is to enable Cognito User Pool authorizers, which are not yet supported by Serverless 1.0.

Installation

npm install --save serverless-plugin-cfauthorizer

Configuration (serverless.yml)

You will first need to add a custom authorizer in the custom cfAuthorizers section of your serverless.yml. Here is an example of a Cognito User Pool authorizer. To use this example, you need to substitute your own User Pool ARN on the last line. Note that the properties of the authorizer are standard CloudFormation properties, so you can use any supported values.

custom:
  cfAuthorizers:
    MyAuthorizer:
      Type: "COGNITO_USER_POOLS"
      Name: "MyUserPoolAuthorizer"
      IdentitySource: "method.request.header.Authorization"
      ProviderARNs:
        - "arn:aws:cognito-idp:eu-west-1:xxxxxxxxxxxx:userpool/eu-west-1_xxxxxxxxx"

Once the above resource has been added, you can configure individual HTTP endpoints in serverless.yml to use the authorizer. They will refer to it using the resource name, which is MyAuthorizer in the example.

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          method: get
          path: hello
          cfAuthorizer: MyAuthorizer

After making the changes, all you need to do is redeploy the service:

sls deploy

Use API Gateway Console to verify that the authorizer has been deployed properly.

FAQs

Package last updated on 18 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc