Configuration - SSO
This page describes how to configure the authentication module of the Datachain solution, based on Keycloak. It is required when the solution is not connected to an external SSO.
Images can be configured via docker *.env files or environment variables.
|
This page describes the |
SSO module - Image dc/keycloak
Image description
Description |
Datachain authentication component. On first startup, it creates the |
|||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Size |
~620MB |
|||||||||||||||
Technical components |
Keycloak 21.1 (Quarkus), started in |
|||||||||||||||
User |
|
|||||||||||||||
Volumes |
No volumes. Data is stored in the PostgreSQL database (see Data management, image |
|||||||||||||||
Logs |
Module logs on the docker standard output |
|||||||||||||||
URLs |
|
Environment variables
For more information on native Keycloak configuration, see https://www.keycloak.org/server/all-config. The native variables (KC_*, KEYCLOAK_ADMIN*) keep their original meaning.
The passwords of the KC_DB_PASSWORD, KEYCLOAK_ADMIN_PASSWORD and DC_DEFAULT_ADMIN_PASSWORD variables can be provided through a docker secret, using the variable suffixed with _FILE that contains the file path. These are the only variables concerned: the general rule described in About environment variables does not apply to this image.
Database
| Variable | Default | Description |
|---|---|---|
KC_DB |
postgres |
Native Keycloak setting: database type. Do not modify. |
KC_DB_URL_HOST |
dc-pg-keycloak |
DNS name of the PostgreSQL server. To be modified when using an external database. |
KC_DB_URL_PORT |
5432 |
PostgreSQL server port |
KC_DB_URL_DATABASE |
keycloak |
Database name |
KC_DB_USERNAME |
postgres |
Database user |
KC_DB_PASSWORD |
(image default value) |
Password of the database user. To be modified, via this variable or |
KC_DB_PASSWORD_FILE |
(empty) |
Path of the file (docker secret) that contains the database password. If it exists, it replaces |
Keycloak operation
| Variable | Default | Description |
|---|---|---|
KEYCLOAK_FRONTEND_URL |
Public URL of Keycloak, including the |
|
KC_HEALTH_ENABLED |
true |
Enables the health check addresses |
KC_METRICS_ENABLED |
true |
Enables the monitoring metrics |
KC_FEATURES |
token-exchange,admin-fine-grained-authz,scripts |
Optional Keycloak features enabled: token exchange, fine-grained administration permissions and scripts |
Keycloak administrator
Administration account of the master realm, created by Keycloak on first startup.
| Variable | Default | Description |
|---|---|---|
KEYCLOAK_ADMIN |
admin |
Keycloak administrator login for the |
KEYCLOAK_ADMIN_PASSWORD |
(image default value) |
Password of this administrator. To be modified, via this variable or |
KEYCLOAK_ADMIN_PASSWORD_FILE |
(empty) |
Path of the file (docker secret) that contains the password. If it exists, it replaces |
Datachain realm
These variables are inserted into the dc-realm realm import file when the container starts. Keycloak only imports this file if the realm does not exist yet: they are therefore only taken into account on first startup. Afterwards, any change is made in the Keycloak administration console (clients, internationalization).
| Variable | Default | Description |
|---|---|---|
DATACHAIN_CLIENT_URL |
Public URL of Datachain. Populates the base address and the allowed redirect addresses ( |
|
DC_CONSOLE_CLIENT_URL |
Public URL of the Console. Populates the |
|
DC_MARKETPLACE_CLIENT_URL |
Public URL of the Marketplace. Populates the |
|
INTERNALIZATION_ENABLED |
true |
Enables internationalization of the realm |
INTERNALIZATION_LOCALES |
|
Available languages (JSON format) |
INTERNALIZATION_DEFAULT_LOCALE |
fr |
Default language |
First Datachain administrator
These variables are only read by the image’s /create_default_admin_dc.sh script (see below).
| Variable | Default | Description |
|---|---|---|
DC_DEFAULT_ADMIN |
admin |
Login of the Datachain administrator created in the |
DC_DEFAULT_ADMIN_PASSWORD |
(image default value) |
Password of this administrator. To be modified, via this variable or |
DC_DEFAULT_ADMIN_PASSWORD_FILE |
(empty) |
Path of the file (docker secret) that contains the password. If it exists, it replaces |
|
The |
Creating the first Datachain administrator
The imported realm contains no users. Once Keycloak has started, the image’s /create_default_admin_dc.sh script creates the Datachain administrator: it waits for Keycloak to be ready, then creates the DC_DEFAULT_ADMIN user in the dc-realm realm, assigns it its password and the realm-admin roles (realm-management client) as well as dc_admin, dc_user, dc_member and dc_project (dc_backend client). It uses the KEYCLOAK_ADMIN account of the master realm.
The script must be run only once, in the Keycloak container:
docker exec -i <keycloak container id> sh -c 'sh /create_default_admin_dc.sh'
The provided deployment examples (scripts/insert_first_admin.sh) run this command; see General principles.
Content of the imported realm
The dc-realm realm (display name DataChain) is created with the following characteristics:
-
login theme:
datachain; -
access token lifetime: 5 minutes; maximum SSO session idle time: 4 hours; maximum SSO session lifetime: 5 hours;
-
TLS required for external connections (
sslRequired:external); -
brute force attack protection: disabled;
-
SMTP server: an internal Adobis server is preconfigured. To be reconfigured in the Keycloak administration console (Realm settings, Email) so that Keycloak can send e-mails.
Realm clients:
| Client | Type | Notes |
|---|---|---|
dc_front |
Public |
Datachain web interface. Redirect allowed to |
dc_core |
Confidential |
Datachain Core module. Redirect allowed to |
dc_console |
Confidential |
Console module. Redirect allowed to |
dc_marketplace |
Confidential |
Marketplace module. Redirect allowed to |
dc_backend |
Confidential, token access only (bearer-only) |
Holds the Datachain roles: |
dc_backend_keycloak |
Confidential, service account |
Service account of the backend towards Keycloak. |
dc_spark_backend |
Confidential, service account |
Service account of the Spark module. |
dc_exposition |
Public |
Public client with direct access grants, without redirect address. |
|
The secrets of the confidential clients ( |
Configuration file
Example of a keycloak.env file for a Docker Swarm deployment (values between angle brackets must be replaced):
# Public addresses
KEYCLOAK_FRONTEND_URL=https://<keycloak domain name>/auth
DATACHAIN_CLIENT_URL=https://<datachain domain name>
DC_CONSOLE_CLIENT_URL=https://<console domain name>
DC_MARKETPLACE_CLIENT_URL=https://<marketplace domain name>
# Database
KC_DB_URL_HOST=<postgresql host>
KC_DB_URL_DATABASE=keycloak
KC_DB_USERNAME=<user>
KC_DB_PASSWORD_FILE=/run/secrets/kc_db_password
# Administrators
KEYCLOAK_ADMIN=<keycloak administrator>
KEYCLOAK_ADMIN_PASSWORD_FILE=/run/secrets/kc_admin_password
DC_DEFAULT_ADMIN=<datachain administrator>
DC_DEFAULT_ADMIN_PASSWORD_FILE=/run/secrets/dc_admin_password
The service must be exposed by the reverse proxy under the /auth path to port 8080 (for example with Traefik, a rule such as Host(…) && PathPrefix(/auth`)`).
Dernière mise à jour le 2 novembre 2026 à 15:16