@stinkstudios/cf-auth
TypeScript icon, indicating that this package has built-in type declarations

1.7.0 • Public • Published

@stinkstudios/cf-auth

Main Workflow NPM version Downloads Known Vulnerabilities MIT license

CloudFront Authentication Library

This package has been created to facilitate the creation of lambda@edge function that will be used to password protect CloudFront distributions.

Installation

yarn add @stinkstudios/cf-auth # TODO: name might change

Usage

const cfAuth = require('@stinkstudios/cf-auth').default;

exports.handler = (event, context, callback) =>
  cfAuth(
    {
      validCredentails: [
        {
          username: 'my-name',
          password: 'good password',
        },
      ],
      whitelistedIPs: ['127.0.0.1'],
    },
    event,
    callback
  );

Configuration

Credentials

You can pass a list of allowed credentials in the configuration:

{
  "validCredentails": [
    {
      "username": "my-name",
      "password": "good password"
    }
  ]
}

Distributions

You can pass a list of distributions where the authentication is required, by default the list is undefined, so the authentication is added to all the distributions.

{
  "enabledDistributions": ["EDFDVBD6EXAMPLE"]
}

Whitelisted IPS

You can pass a list of IPs that won't be asked for the authentication.

{
  "whitelistedIPs": ["127.0.0.1"]
}

Package Sidebar

Install

npm i @stinkstudios/cf-auth

Weekly Downloads

1

Version

1.7.0

License

MIT

Unpacked Size

33.6 kB

Total Files

12

Last publish

Collaborators

  • andrewsellers
  • emielvanbetsbrugge