# @stinkstudios/cf-auth

> Module to password protect CloudFront distributions

Latest version **1.7.0** (published 2020-03-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @stinkstudios/cf-auth
pnpm add @stinkstudios/cf-auth
yarn add @stinkstudios/cf-auth
bun add @stinkstudios/cf-auth
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.7.0 |
| Published | 2020-03-09 |
| First published | 2018-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.13.0 |
| Dependencies | 0 |
| Unpacked size | 32.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Patrick Arminio |
| Maintainers | andrewsellers, emielvanbetsbrugge |
| Keywords | cloudfront, authentication, aws, lambda |

## Links

- npm: https://www.npmjs.com/package/@stinkstudios/cf-auth
- Repository: https://github.com/Stinkstudios/npm-packages
- Homepage: https://stinkstudios.com
- Issues: https://github.com/Stinkstudios/npm-packages/issues
- npm.io page: https://npm.io/package/@stinkstudios/cf-auth

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@oxyhq/services](https://npm.io/package/@oxyhq/services.md) — 2.3K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads

## Recent versions

- 1.7.0 (latest) — 2020-03-09
- 1.6.0 — 2020-02-14
- 1.5.0 — 2020-02-10
- 1.4.0 — 2020-01-29
- 1.3.0 — 2020-01-28
- 1.2.0 — 2019-09-24
- 1.1.0 — 2019-03-26
- 1.0.7 — 2019-03-25
- 1.0.6 — 2019-02-21
- 1.0.5 — 2018-11-07
- 1.0.4 — 2018-10-29
- 1.0.3 — 2018-10-23
- 1.0.1 — 2018-10-22
- 1.0.0 — 2018-01-25

## README

# @stinkstudios/cf-auth

[![Main Workflow][workflow-img]][workflow-url] [![NPM version][npm-img]][npm-url] [![Downloads][downloads-img]][npm-url] [![Known Vulnerabilities][snyk-img]][snyk-url] [![MIT license][mit-img]][mit-url]

# 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

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

## Usage

```js
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:

```json
{
  "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.

```json
{
  "enabledDistributions": ["EDFDVBD6EXAMPLE"]
}
```

### Whitelisted IPS

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

```json
{
  "whitelistedIPs": ["127.0.0.1"]
}
```

[downloads-img]: https://img.shields.io/npm/dm/@stinkstudios/cf-auth.svg?style=flat-square
[npm-img]: https://img.shields.io/npm/v/@stinkstudios/cf-auth.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@stinkstudios/cf-auth
[snyk-img]: https://snyk.io/test/github/Stinkstudios/npm-packages/badge.svg?targetFile=packages%2Fcloudfront-auth%2Fpackage.json
[snyk-url]: https://snyk.io/test/github/Stinkstudios/npm-packages?targetFile=packages%2Fcloudfront-auth%2Fpackage.json
[mit-img]: http://img.shields.io/badge/license-MIT-brightgreen.svg
[mit-url]: http://opensource.org/licenses/MIT
[workflow-img]: https://github.com/stinkstudios/npm-packages/workflows/Main/badge.svg?branch=master
[workflow-url]: https://github.com/Stinkstudios/npm-packages/actions?query=workflow%3AMain

---
_Source: https://npm.io/package/@stinkstudios/cf-auth · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
