A Sinatra based web application that is able to authenticate clients to secured API endpoints.
The auth server requires two environment variables to be set: JWT_ISSUER and
JWT_SECRET. Corresponding variables with the same names and values need
to be set on the API server that connects to the auth server.
If you are running the server locally it is likely that you will be running it
alongside another sinatra or rack application. The Makefile runs the server on
port 9090 by default. To start the server on a different port run e.g.
bundle exec rackup -p 9393
To use this most applications use the EPB_AUTH_SERVER environment variable.
When you start a server that will make calls to the authentication server, make
sure you also set this environment variable as follows:
EPB_AUTH_SERVER=http://localhost:9090 make run
-
make installInstall dependencies and perform any additional setup tasks.
-
make testRun all acceptance, integration, and unit tests.
-
make runRun the auth server, which will be available at
http://localhost:9090. -
make formatFormat source files according to the
.editorconfigand prettier defaults -
make db-setupSetup the database (Create > Migrate)
-
make db-teardownDrop the current database.
Set the Sintra environment. Should be one of "production", "development" or "test".
Sinatra will fallback to RACK_ENV or "development" if unset.
sintra-activerecord
uses APP_ENV as the active record environment, but will fallback to RAILS_ENV if it is not supplied.
This should be one of "production", "development" or "test". It will default to
"development" if neither APP_ENV or RAILS_ENV is set.
Used by rackup to choose the default middleware stack. Should be one of "development" (default) or "deployment". If set to any other value no middleware stack is loaded.
The EPB environment. Can be one of "test", "development", "integration", "staging" or "production".
- Sets the unleash feature flag service app name to
toggles-#{stage} - Unless "development" or "test", enables Sentry and sets its environment value
Postgres connection string for connecting to the database
If present this will allow CORS for services with this origin.
The URL of the unleash feature flag service.
Authentication token for the unleash feature flag service.
Issuer for the JWT encoded auth token.
Secret for the JWT encoded auth token.
A path prefix for all routes.
For example if /auth the route /api/client becomes /auth/api/client.