https://github.com/truggeri/maitre-d
A jwt based authorization service
https://github.com/truggeri/maitre-d
jwt-authorization ruby-on-rails
Last synced: about 2 months ago
JSON representation
A jwt based authorization service
- Host: GitHub
- URL: https://github.com/truggeri/maitre-d
- Owner: truggeri
- License: mit
- Created: 2021-10-16T20:42:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-24T15:29:33.000Z (about 4 years ago)
- Last Synced: 2025-06-13T15:53:46.049Z (about 1 year ago)
- Topics: jwt-authorization, ruby-on-rails
- Language: CSS
- Homepage:
- Size: 260 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Maitre-D
[](https://circleci.com/gh/truggeri/maitre-d/tree/main)

Description to come...


[](./Dockerfile)
## Configuration
There are a number of configuration choices that allow you to customize your instance of Maitre-D.
| ENV | Default | Description |
| --- | --- | -- |
| `AUTH_COOKIE_NAME` | `auth_token` | The name of the cookie stored when a user logs in. |
| `DATABASE_URL` | - | A postgresql url. |
| `HARD_UNAUTH` | `false` | If set to `true`, unauthorized requests will receive a simple 401. Otherwise, unauthorized requests will redirect to the login form.
| `JWT_RSA_PEM` | - | An RSA 256 PEM private key. |
| `JWT_RSA_PUB` | - | An RSA 256 public key from the provided private key. |
| `SECURITY_TOKEN` | - | A secure token that is passed as a param when logging in a user from another platform. This token acts as an api key to allow authentication to happen elsewhere. |
## Bootstrapping User
In order to manage roles, you must first have a user with permission to manage roles. To create this user,
we have provided a hook based upon two ENV being set upon startup.
| ENV | Description |
| --- | --- |
| `SUPERADMIN_USERNAME` | The username/email of the privileged user |
| `SUPERADMIN_PASSWORD` | The password of the user |
The user is created or updated with the given username and password and is given the "manage_roles" role
which allows access to the management dashboard.
## Local Setup
You'll need the following to run the project yourself.
### PostgreSQL Database
This app uses [PostgreSQL 13](https://www.postgresql.org/docs/13/) for it's datastore. In order to configure one, provide a database URL via an environment variable.
```bash
export DATABASE_URL=postgres://:@:
```
This database can be setup in any fashion that you choose. Options include [local install](https://www.postgresql.org/download/), [Docker](https://hub.docker.com/_/postgres?tab=description), or as [a web service](https://www.heroku.com/postgres). If you'd like to use Docker, we have a [Docker Compose](https://docs.docker.com/compose/) [file](./docker-compose.yml) to help,
```bash
cp .env.development.example .env.development
# Add your custom choices for ENV
source .env.development
docker-compose up --detach db
```
### Docker
If you'd like to run the application using Docker, there is a [Dockerfile](./Dockerfile) provided.
To use, build the container first and then run it with your configured database and port settings.
```bash
source .env.development
docker build -t maitre-d .
docker run --rm -e DATABASE_URL=$DATABASE_URL -p 3000:3000 maitre-d