2023-04-17 16:45:47 +02:00
---
title: Keycloak SSO
slug: /deployment/security/keycloak
---
# Keycloak SSO
Follow the sections in this guide to set up Keycloak SSO.
2023-04-21 21:59:41 +05:30
{% note %}
2023-04-17 16:45:47 +02:00
Security requirements for your **production** environment:
- **DELETE** the admin default account shipped by OM in case you had [Basic Authentication ](/deployment/security/basic-auth )
enabled before configuring the authentication with Keycloak SSO.
- **UPDATE** the Private / Public keys used for the [JWT Tokens ](/deployment/security/enable-jwt-tokens ). The keys we provide
by default are aimed only for quickstart and testing purposes. They should NEVER be used in a production installation.
2023-04-21 21:59:41 +05:30
{% /note %}
2023-04-17 16:45:47 +02:00
## Create Server Credentials
### Step 1: Access the Keycloak Admin Console
- You need an administrator account. If you don't have, see [Creating the first administrator ](https://www.keycloak.org/docs/latest/server_admin/#creating-first-admin_server_administration_guide ).
- Go to the URL for the Admin Console. For example, for localhost, use this URL: http://localhost:8080/admin/
2023-04-21 21:59:41 +05:30
{% image src="/images/v1.0.0/deployment/security/keycloak/1-login-page.png" alt="login-page" /%}
2023-04-17 16:45:47 +02:00
- Enter the username and password you created.
### Step 2: Change Realm selected
- The Keycloak use Realms as the primary form of organization, we can't use the realm "master" for new clients (apps), only for administration, so change for your specific realm or c reate a new.
- In this example we are used an existing one called "Data-sec".
2023-04-21 21:59:41 +05:30
{% image src="/images/v1.0.0/deployment/security/keycloak/2-change-realm.png" alt="change-realm" /%}
2023-04-17 16:45:47 +02:00
### Step 3: Create OpenMetadata as a new Client
- Click on `Clients` in the menu.
- Click on `Create` button.
- Enter the Client ID and Protocol as the image.
- Click on `Save` button.
2023-04-21 21:59:41 +05:30
{% image src="/images/v1.0.0/deployment/security/keycloak/3-add-client.png" alt="add-client" /%}
2023-04-17 16:45:47 +02:00
### Step 4: Edit settings of the client
- Change "Acess Type" value from "public" to "confidential".
- Change "implicit flow" and "service accounts" to enabled.
2023-04-21 21:59:41 +05:30
{% image src="/images/v1.0.0/deployment/security/keycloak/4-edit-settings-client.png" alt="edit-settings-client" /%}
2023-04-17 16:45:47 +02:00
- At the bottom of the same settings page, change the configurations to the openmetadata address.
- The image below shows different possibilities, such as running locally or with a custom domain.
2023-04-21 21:59:41 +05:30
{% image src="/images/v1.0.0/deployment/security/keycloak/5-edit-settings-url.png" alt="edit-settings-url.png" /%}
2023-04-17 16:45:47 +02:00
- Click on `Save` button.
2023-04-21 21:59:41 +05:30
{% note %}
2023-04-17 16:45:47 +02:00
Note: Scopes `openid` , `email` & `profile` are required to fetch the user details so you will have to add these scopes in your client.
2023-04-21 21:59:41 +05:30
{% /note %}
2023-04-17 16:45:47 +02:00
2023-04-21 21:59:41 +05:30
{% note %}
2023-04-17 16:45:47 +02:00
Configuring a service account in Keycloak is optional if you configure the ingestion-bot with
the JWT Token, you can follow the documentation of [Enable JWT Tokens ](/deployment/security/enable-jwt-tokens ).
2023-04-21 21:59:41 +05:30
{% /note %}
2023-04-17 16:45:47 +02:00
### Step 5: Where to Find the Credentials
- Navigate to the `Credentials` tab.
- You will find your Client `Secret` related to the Client id "open-metadata"
2023-04-21 21:59:41 +05:30
{% image src="/images/v1.0.0/deployment/security/keycloak/6-client-credentials.png" alt="client-credentials" /%}
2023-04-17 16:45:47 +02:00
- Navigate to the `Service Account Roles` tab.
- You will find your service account id related to the Client id "open-metadata"
2023-04-21 21:59:41 +05:30
{% image src="/images/v1.0.0/deployment/security/keycloak/7-client-service-account.png" alt="client-service-account.png" /%}
2023-04-17 16:45:47 +02:00
After the applying these steps, the users in your realm are able to login in the openmetadata, as a suggestion create a user called "admin-user". Now you can update the configuration of your deployment:
2023-04-21 21:59:41 +05:30
{% inlineCalloutContainer %}
{% inlineCallout
2023-04-17 16:45:47 +02:00
color="violet-70"
icon="celebration"
bold="Docker Security"
2023-04-21 21:59:41 +05:30
href="/deployment/security/keycloak/docker" %}
2023-04-17 16:45:47 +02:00
Configure Keycloak SSO for your Docker Deployment.
2023-04-21 21:59:41 +05:30
{% /inlineCallout %}
{% inlineCallout
2023-04-17 16:45:47 +02:00
color="violet-70"
icon="storage"
bold="Bare Metal Security"
2023-04-21 21:59:41 +05:30
href="/deployment/security/keycloak/bare-metal" %}
2023-04-17 16:45:47 +02:00
Configure Keycloak SSO for your Bare Metal Deployment.
2023-04-21 21:59:41 +05:30
{% /inlineCallout %}
{% inlineCallout
2023-04-17 16:45:47 +02:00
color="violet-70"
icon="fit_screen"
bold="Kubernetes Security"
2023-04-21 21:59:41 +05:30
href="/deployment/security/keycloak/kubernetes" %}
2023-04-17 16:45:47 +02:00
Configure Keycloak SSO for your Kubernetes Deployment.
2023-04-21 21:59:41 +05:30
{% /inlineCallout %}
{% /inlineCalloutContainer %}
2023-04-17 16:45:47 +02:00
## Configure Ingestion
After everything has been set up, you will need to configure your workflows if you are running them via the
`metadata` CLI or with any custom scheduler.
Note that KeyCloak SSO is a layer on top of Custom OIDC.
When setting up the YAML config for the connector, update the `workflowConfig` as follows:
```yaml
workflowConfig:
openMetadataServerConfig:
hostPort: 'http://localhost:8585/api'
authProvider: custom-oidc
securityConfig:
clientId: '{your_client_id}'
secretKey: '{your_client_secret}'
tokenEndpoint: '{your_token_endpoint}' # e.g. http://localhost:8081/realms/data-sec/protocol/openid-connect/token
```
2023-04-21 21:59:41 +05:30
{% note %}
2023-04-17 16:45:47 +02:00
A dockerized demo for showing how this SSO works with OpenMetadata can be found [here ](https://github.com/open-metadata/openmetadata-demo/tree/main/keycloak-sso ).
2023-04-21 21:59:41 +05:30
{% /note %}