For the complete documentation index, see llms.txt. This page is also available as Markdown.

User management

Choosing how users sign in is the most important decision when deploying Datashare in server mode. It controls who can reach your documents, and changing it later usually means re-provisioning users.

Choosing a provider

Provider
User store
Sign-out
Best for

External identity provider

Managed by IdP

Organizations that already run an IdP (KeyCloak, Okta, GitHub, etc.)

PostgreSQL or Redis

Yes

Self-managed deployments (recommended default)

PostgreSQL

No (browser-managed)

Legacy deployments already using it

Redis

No (browser-managed)

Legacy deployments already using it

None, accepts anything

No

Local development only (never expose to the network)

If you're starting from scratch and you don't have an identity provider, use the HTML form filter. If you already run an IdP, use OAuth2.

How it's configured

Two CLI flags select the authentication backend:

  • --auth: the authentication method that handles incoming requests (decides whether a request is authenticated, returns the challenge, and validates the session cookie). Accepted values: oauth, form, basic, yesCookie, yesBasic (default: form).

  • --authUsersProvider: where users are looked up (by login or login+password). Accepted values: database (default), redis, or a fully-qualified class name. Only applies to methods that check credentials against a local store (form auth, basic auth). OAuth2 doesn't use it.

For example, to use the HTML form method backed by a PostgreSQL user inventory:

--auth form \
--authUsersProvider database

Since these are the default values, an explicit --auth form --authUsersProvider database is equivalent to passing nothing at all.

The legacy --authFilter flag, which took a fully-qualified filter class name (e.g. org.icij.datashare.session.FormAuthFilter), is deprecated. Use --auth instead.

Provisioning users

The easiest way to create users is the datashare user create subcommand:

You can also provision users manually, as described below. Form auth and both basic auth providers share the same user record format. Only the storage location differs (PostgreSQL table vs. Redis key).

Hash the password

Passwords are stored as sha256 hex digests. With bash:

User record fields

Each user is a JSON object with at least:

  • password: the sha256 hex digest computed above.

  • groups_by_applications: a map of application name to the list of indices (projects) the user can access. The datashare key is required, and local-datashare should usually stay in the list. Add any extra indices the user should see:

Store the user

In PostgreSQL

Insert the user into the user_inventory table:

To create many users at once, use PostgreSQL's COPY statement to import a CSV.

In Redis

Store the user JSON under the login as key:

Last updated