@stinkstudios/cf-auth
v1.7.0
Published
Module to password protect CloudFront distributions
Downloads
2
Readme
@stinkstudios/cf-auth
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"]
}