Git Product home page Git Product logo

aws-cloudfront-private-static-sites's Introduction

Cloudfront + S3 statics sites: login with SAML, authorization and cloudfront signed cookies

  • Goal: protect s3 sites under cloudfront, with SAML login and signed cookies.
  • Bonus: authorized users are a list into csv queried through AWS S3 Select (authorization could be based in affiliation or whatever)

Architecture

architecture

Quick deploy

Setup details

Auth / Login page

The auth page is a Cloudfront error page. When cookies aren't present, Cloudfront shows this page to the user and then, login flow is triggered.

In this page you have to setup your cloudfront distribution domain name (first-deploy.sh does it for you).

Once done, you can sync only s3

    $ sls s3sync

For SAML login

Basic ENV VARS for SAML (your own, because demo is setup):

  • SAML_CERT: you idp saml certificate as string
  • IDP_HOST: your idp

For Cloudfront cookie signing

In order to sign cookies to allow access to protected cloudfront behaviors, you need to go to AWS Console and Create a New Key Pair, under Security Credentials.

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html#private-content-creating-cloudfront-key-pairs-procedure

Export two ENV VARS to allow cookie signing:

  • AWS_KEYPAIRID
  • AWS_PRIVATEKEY

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.