Skip to main content
Version: 4.0

4.3 Users & Access

Data Context Hub uses Keycloak for sign-in and access control. Users sign in once and can use every DCH application, and applications that call DCH endpoints authenticate with a Keycloak access token. You manage users, roles and clients in the Keycloak Admin Console.

Roles​

What a user may do in Data Context Hub depends on their roles:

  • dch-execute: view data and run operations, without changing anything.
  • dch-modify: additionally create, change and delete most things.
  • dch-admin: full access, including administrative operations.

Assign the roles to users in the Admin Console, under Users › Role mapping, or assign them to a group and add the users to it.

Connect existing users​

Instead of creating every user in Keycloak, you can connect the user accounts you already have:

  • User Federation: Keycloak reads users from an existing directory, such as Active Directory or another LDAP server, or Kerberos. The credentials stay in that directory.
  • Identity Providers: users sign in with an account of another system, for example through OpenID Connect or SAML 2.0, or a social login such as Google or GitHub.

For systems neither covers, Keycloak can be extended with custom providers.

Access for applications​

An application that calls Data Context Hub endpoints, for example the Linked Data API, needs its own client in Keycloak:

  1. In the Admin Console, open Clients and choose Create client.
  2. Enter a unique Client ID for your application.
  3. Turn on Client authentication and select only Service accounts roles. This enables the client credentials flow; for security, leave the other flows off.
  4. Save the client, and copy its secret from the Credentials tab.
  5. Keycloak creates a service account named service-account-<clientId> for the client. Assign the roles the application needs to this service account.

The application then requests an access token with its client ID and secret, without any user interaction:

curl --request POST '<keycloakUrl>/realms/<realm>/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=<clientId>' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_secret=<clientSecret>'

Replace <keycloakUrl> with the URL of your Keycloak server, <realm> with the realm of your Data Context Hub, and <clientId> and <clientSecret> with the values of your client. Send the returned access_token as a bearer token in the Authorization header of your requests.