arrow-left

All pages
gitbookPowered by GitBook
1 of 5

Loading...

Loading...

Loading...

Loading...

Loading...

Dummy

Dummy authentication provider to disable authentication

You can have a dummy authentication that always accepts basic auth. So you should see this popup:

basic auth popup

But then whatever user or password you type, it will enter Datashare.

hashtag
Example

docker run -ti ICIJ/datashare -m SERVER \
  --dataDir /home/dev/data \
    --batchQueueType REDIS \
    --dataSourceUrl 'jdbc:postgresql://postgres/datashare?user=dstest&password=test'\
    --sessionStoreType REDIS \
    --authFilter org.icij.datashare.session.YesBasicAuthFilter
Screenshot of an 'authentication required' window with username and password fields and 'Cancel' and 'OK' buttons

OAuth2

OAuth2 authentication with a third-party id service

This is the default authentication mode: if not provided in CLI, it will be selected. With OAuth2 you will need a third-party authorization service. The diagram below describes the workflow:

oauth

hashtag
Example

docker run -ti ICIJ/datashare:version --mode SERVER \
    --oauthClientId 30045255030c6740ce4c95c \
    --oauthClientSecret 10af3d46399a8143179271e6b726aaf63f20604092106 \
    --oauthAuthorizeUrl https://my.oauth-server.org/oauth/authorize \
    --oauthTokenUrl https://my.oauth-server.org/oauth/token \
    --oauthApiUrl https://my.oauth-server.org/api/v1/me.json \
    --oauthCallbackPath /auth/callback

hashtag
Integration with KeyCloak

We made a small demo to show how it could be setup.

repositoryarrow-up-right
A diagram of a workflow

Basic with a database

Basic authentication with a database.

Basic authentication is a simple protocol that uses the HTTP headers and the browser to authenticate users. User credentials are sent to the server in the header Authorization with user:password base64 encoded:

Authorization: Basic dXNlcjpwYXNzd29yZA==

It is secure as long as the communication to the server is encrypted (with SSL for example).

On the server side, you have to provide a database user inventory. You can launch datashare first with the full database URL, then Datashare will automatically migrate your database schema. Datashare supports SQLite and PostgreSQL as back-end databases. SQLite is not recommended for a multi-user server because it cannot be multithreaded, so it will introduce contention on users' DB SQL requests.

Then you have to provision users. The passwords are sha256 hex encoded (for example with bash):

$ echo -n bar | sha256sum
fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9  -

Then you can insert the user like this in your database:

If you use other indices, you'll have to include them in the group_by_applications, but local-datashare should remain. For example if you use myindex:

Or you can use COPY statement if you want to create them all at once.

Then when accessing Datashare, you should see this popup:

hashtag
Example

Here is an example of launching Datashare with Docker and the basic auth provider filter backed in database:

Authentication providers

Authentication with Datashare in server mode is the most impacting choice that has to be made. It can be one of the followings:

  • Basic authentication with credentials stored in database (PostgreSQL)

  • Basic authentication with credentials stored in Redis

OAuth2 with credentials provided by an identity provider (KeyCloak for example)

  • Dummy basic auth to accept any user (⚠️ if the service is exposed to internet, it will leak your documents)

  • $ psql datashare
    datashare=> insert into user_inventory (id, email, name, provider, details) values ('fbar', 'foo@bar.com', 'Foo Bar', 'my_company', '{"password": "fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9", "groups_by_applications":{"datashare":["local-datashare"]}}');
    PostgreSQL import CSVarrow-up-right
    basic auth popup
    $ psql datashare
    datashare=> insert into user_inventory (id, email, name, provider, details) values ('fbar', 'foo@bar.com', 'Foo Bar', 'my_company', '{"password": "fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9", "groups_by_applications":{"datashare":["myindex", "local-datashare"]}}');
    docker run -ti ICIJ/datashare --mode SERVER \
        --batchQueueType REDIS \
        --dataSourceUrl 'jdbc:postgresql://postgres/datashare?user=<username>&password=<password>' \
        --sessionStoreType REDIS \
        --authFilter org.icij.datashare.session.BasicAuthAdaptorFilter \
        --authUsersProvider org.icij.datashare.session.UsersInDb

    Basic with Redis

    Basic authentication with Redis

    Basic authentication is a simple protocol that uses the HTTP headers and the browser to authenticate users. User credentials are sent to the server in the header Authorization with user:password base64 encoded:

    Authorization: Basic dXNlcjpwYXNzd29yZA==

    It is secure as long as the communication to the server is encrypted (with SSL for example).

    On the server side, you have to provide a user store for Datashare. For now we are using a Redis data store.

    So you have to provision users. The passwords are sha256 hex encoded. For example using bash:

    Then insert the user like this in Redis:

    If you use other indices, you'll have to include them in the group_by_applications, but local-datashare should remain. For exammple if you use myindex:

    Then you should see this popup:

    hashtag
    Example

    Here is an example of launching Datashare with Docker and the basic auth provider filter backed in Redis:

    Screenshot of an 'authentication required' window with username and password fields and 'Cancel' and 'OK' buttons
    $ echo -n bar | sha256sum
    fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9  -
    $ redis-cli -h my.redis-server.org
    redis-server.org:6379> set foo '{"uid":"foo", "password":"fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9", "groups_by_applications":{"datashare":["local-datashare"]}}'
    basic auth popup
    $ redis-cli -h my.redis-server.org
    redis-server.org:6379> set foo '{"uid":"foo", "password":"fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9", "groups_by_applications":{"datashare":["myindex","local-datashare"]}}'
    docker run -ti ICIJ/datashare --mode SERVER \
        --batchQueueType REDIS \
        --dataSourceUrl 'jdbc:postgresql://postgres/datashare?user=<username>&password=<password>' \
        --sessionStoreType REDIS \
        --authFilter org.icij.datashare.session.BasicAuthAdaptorFilter \
        --authUsersProvider org.icij.datashare.session.UsersInRedis
    Screenshot of an 'authentication required' window with username and password fields and 'Cancel' and 'OK' buttons