Coder Social home page Coder Social logo

believerhsp / oauth-tutorial Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hamelsmu/oauth-tutorial

0.0 0.0 0.0 713 KB

Like GitHub Pages, but you choose who can see it without usernames & passwords.

Shell 89.37% CSS 1.54% Dockerfile 9.08%

oauth-tutorial's Introduction

Make Static Sites Private With OAuth For Free

Like GitHub Pages, but you choose who can see it, without usernames & passwords ๐Ÿช„ ๐ŸŽฉ ๐Ÿฐ

Background

Do you want to serve a static site semi-privately so only specific users can see it? For example, you may want to host private docs or offer a paid course. There are many complicated solutions that involve building a login flow and maintaining a database of usernames/passwords. Thankfully, there is a much easier way with Oauth2 Proxy.

Concretely, this tutorial shows how to use the Oauth2 Proxy to make a static site private with minimal dependencies and secure it with an email whitelist (a text file with emails). There are many other authorization schemes in addition to an email whitelist, which you can read about here.

This section describes how OAuth works in the context of this tutorial.

Tutorial

This tutorial has three parts that become progressively complex depending on your goals. However, you can stop at any lesson once you are satisfied.

Prerequisites: knowledge of Docker and familiarity with hosting static sites (like on GitHub Pages).

  1. Running OAuth Locally: this runs a minimal static site locally, secured with the OAuth2 Proxy. This allows you to gain an intuition of how things work before proceeding to the next step.

  2. Serve The Private Site (For Free!): You will host the same site you created locally for free! You will also learn how to set up SSL for https with a custom domain.

  3. (Optional) Hosting on Kubernetes: Finally, you will deploy a website secured by OAuth on Kubernetes. This assumes some experience with Kubernetes.

FAQ

  1. Does the proxy only work for static sites? No! You can put applications behind the proxy too. See this explanation.

  2. Does GitHub Pages have something like this?: Only if you purchase GitHub Enterprise Cloud which is absurdly expensive if you want it solely for the purposes of securing a static site (> $100/month for just 5 users!).

  3. Can't you do this with Netlify?: To do something similar on Netlify, you have to use invite-only private sites, which triggers identity pricing, which means that you need to pay over $99 per month if you have over 5 Active users! That is ridiculous.

oauth-tutorial's People

Contributors

hamelsmu avatar

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.