An open API service indexing awesome lists of open source software.

https://github.com/nprail/static-auth-poc

🔑 Authentication middleware for static websites (POC)
https://github.com/nprail/static-auth-poc

authentication authorization middleware static-site

Last synced: about 2 months ago
JSON representation

🔑 Authentication middleware for static websites (POC)

Awesome Lists containing this project

README

          

# Static Site Auth (POC)

## Instructions

Clone the repo.

```bash
git clone git@github.com:nprail/static-auth-poc.git
cd static-auth-poc
```

Install the dependencies.

```bash
npm install
```

Start the proxy and login server.

```bash
npm start
```

Browse to http://localhost:3000

- **Username:** demo@example.com
- **Password:** demo

## Components

### Proxy Server

The proxy server simply proxies the a site and adds middleware that verifies that the token exists and is valid.

### Login Server

The login server hosts the login page and acts as the login API.

## Flow

1. User goes to a password protected site (e.g. protected.example.com)
2. User is redirected to the Login Server and logs in
3. User is redirected back to protected.example.com with new JWT token stored in a cookie
4. The JWT token is then used to verify that the user has access to the site