The name is open for discussion.
Make sure you have a recent version of rust installed. You probably need 1.61-nightly or above.
We currently use a postgresql server for persistent storage (also in development mode). So you'll have to install and run your own postgresql server. After installation, you can start a postgresql shell with
psql, but you will likely need access it as the postgres user, so use e.g.
sudo -u postgres psql.
Next, in this shell, you'll have to create a user with permissions to create a database:
CREATE USER zauth WITH PASSWORD 'zauth' CREATEDB;
Note that by default the postgresql server is configured to not allow for username:password authentication. Please refer to the official documentation for information about postgresql authentication.
SHOW hba_file;in the psql shell to find the location of the client authentication file, which might for example be
A configuration allowing password authentication for the zauth user on the local system could look like this:
host all zauth 127.0.0.1/32 md5 host all zauth ::1/128 md5
We use diesel to manage our database. Install the cli with
cargo install diesel_cli. If you wish to only install the postgres features of
diesel(for nix-shell for example), run
cargo install diesel_cli --no-default-features --features postgres --force
Create the development and testing database with
diesel database reset --database-url "postgresql://zauth:zauth@localhost/zauth" diesel database reset --database-url "postgresql://zauth:zauth@localhost/zauth_test"
This will also run the migrations.
npm run buildto compile the css assets.
When working on the stylesheets, you can run
npm run watchto automatically recompile them on every change.
You can now start the server with
cargo run. If you want to create an admin user you can start it with the
ZAUTH_ADMIN_PASSWORD=adminadmin cargo run
The server should then run on localhost:8000 and create an admin user with password 'adminadmin'.
There are also other environment variables like:
ZAUTH_EMPTY_DB=trueto clean the database from users and clients
ZAUTH_CLIENT_NAME=mozaic_incto create a client with the name mozaic_inc
ZAUTH_SEED_USER=100to create 100 users, some are active, some are pending (always creates the same users)
ZAUTH_SEED_CLIENT=100to create 100 clients, some need a grant, others don't (always creates the same clients)
You can now start developing! A good way to start is to look at the routes defined in the controllers.
Testing the OAuth2 flow
There are tests trying out the OAuth2 flow which can be run with
You can also test the OAuth2 flow manually by running the flask application in