Setup Keycloak for Console
Prerequisites
SmoothGlue can automatically configure this client and group out of the box. Please see the SmoothGlue auto-SSO feature. Skip to Create Console-Bot Admin User if not manually setting up the Keycloak client and group.
Create Keycloak Client
- In the
smoothgluerealm, click onClientsunderManagein the left pane. - Click
Create client. - Ensure the
Client typeisOpenId Connect. - Enter a unique client name (e.g.,
console) forClient ID. - Click on the
Nextbutton. - Ensure
Client authenticationis toggled on,Standard flowis enabled, andDirect access grantsis disabled - Click on the
Nextbutton. - Set
Valid Redirect URIstohttps://console.${DOMAIN}/login/generic_oauth. - Set
Valid post logout redirect URIstohttps://console.${DOMAIN}. - Click on the
Savebutton.
Configure Dedicated Mapper
- Go to the
consoleclient and click on theClient scopestab. - Click on the
console-dedicatedclient scope. - Click
Configure a new mapper. - Select
Group Membership. - Enter
console-group-membership-mapperforName, - Enter
groupsforToken Claim Name. - Click
Save.
Configure _structsureAdmins Group
Console assigns SmoothGlue admins configured in Console to the _structsureAdmins group in Keycloak. It is important that this group has the realm-admin role mapping so that admins can manage users in Keycloak via Console:
- In the
smoothgluerealm, clickGroupsin the left-hand panel. - Select
_structsureAdmins. - Go to
Role mappingtab. - Click
Assign role. - Ensure the drop-down filter in the top left is set to
Filter by clients. - Search for and enable the
realm-adminrole. - Click
Assign.
Configure Console for Keycloak
Console uses authservice to get a Java Web Token (JWT) from Keycloak that contains info about the currently logged-in user. Console uses the permissions of the logged-in user to interact with Keycloak APIs to manage user accounts.
If Keycloak is using non-publicly trusted or self-signed certificates, Console will need to be configured with additional CAs in order for Console to talk to Keycloak.
The following is automatically configured when using the SmoothGlue auto-SSO feature.
Add the following to bigbang-secrets.yaml:
addons:
authservice:
chains:
console:
callback_uri: https://console.<DOMAIN>/login/generic_oauth
match:
header: :authority
prefix: console.<DOMAIN>
client_id: console # the client name created above
client_secret: <client_secret> # retrieve the client secret from the client's `Credentials` tab in Keycloak
packages:
console:
values:
backend:
keycloak:
realm: smoothglue
host: keycloak.<DOMAIN> # this value can be omitted but is required when setting a custom subdomain for Keycloak.
caBundle: |
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
Create Console-Bot Admin User
We recommend starting with an initial Keycloak bot-admin user with the realm-admin role in order to be responsible for downstream tool access tokens. This bot-admin will be used to set up access keys within tools that Console supports integrations for.
Do not log in to Console UI with this user. It is recommended to remove the password for console-bot in Keycloak to reduce the chances of downgrading permissions.
- In the
smoothgluerealm, clickUsersin the left-hand panel. - Click
Add user. - Fill in the following information for the initial user:
- Email verified: Enabled
- Username:
console-bot - Email:
console-bot@<your-domain>.com - First name:
console - Last name:
bot - Groups:
_structsureAdmins
- Click
Create.
Set a password for the console-bot user:
- From the
smoothgluerealm, go toUsers>console-bot. - Go to the
Credentialstab. - Click
Set password. - Disable
Temporary. - Enter a password.
- Click
SaveandSave passwordto confirm.
Do not log in to Console UI with this user.