Search code examples
javakeycloakmulti-tenant

Setting up a multi Tenancy application


I am currently working on a distributed (multi-site) application capable of operating offline.

I would like to be able to configure each instance of Keycloak remotely and individually from a Keycloak administration instance. In addition, each instance has its own users, policies and permissions.

How can I achieve this?


Solution

  • If you are new to Keycloak I would suggest starting by reading its documentation it will make your life easier when it comes to make decision.

    In addition, each instance has its own users, policies and permissions.

    From the Keycloak Documentation section Core Concepts and Terms one can read the following:

    realms : A realm manages a set of users, credentials, roles, and groups. A user belongs to and logs into a realm. Realms are isolated from one another and can only manage and authenticate the users that they control.

    Which seams suitable to cover that requirement.

    I would like to be able to configure each instance of Keycloak remotely and individually from a Keycloak administration instance.

    That is not possible, you can however, have multiple Keycloak instances doing Identity Brokering against the same Keycloak instance. From the documentation about Identity Brokering one can read:

    An Identity Broker is an intermediary service that connects multiple service providers with different identity providers. As an intermediary service, the identity broker is responsible for creating a trust relationship with an external identity provider in order to use its identities to access internal services exposed by service providers.

    From a user perspective, an identity broker provides a user-centric and centralized way to manage identities across different security domains or realms. An existing account can be linked with one or more identities from different identity providers or even created based on the identity information obtained from them.

    With this approach a user would be redirected to the leading page of the main Keycloak instance, and then could chose to login to a specific Keycloak instance.