Skip to main content
Version: ACE 5

Configure Keycloak for multi-tenant environment

caution

This guide describes a work-in-progress ACE feature and is intended for testing.

Install and start keycloak

Setup tenant id in Local Keycloak.

Firstly generate an user token in Keycloak referring this documentation - Keycloak User Token

Setup an user attribute with tenant id:

  1. Open Keycloak in local environment (i.e localhost:8282)
  2. Click on Administration Console
  3. Login with credentials
  4. Select ACE realm
  5. Navigate to users and select the user you are going to log in with
  6. Navigate to Attributes and add an Attribute with Key as "tenantId" and Value as "tenant1" or "tenant2". Logical
  7. Click on save

Create a mapper with the tenant id attribute

  1. Navigate to Client Scopes -> profile -> Mappers
  2. Create a Mapper by clicking on Add Mapper -> By Configuration -> User Attribute Logical
  3. Enter the details for Name, User Attribute , Token Claim Name as "tenantId". Logical