Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scripting theme configuration for a realm

Tags:

keycloak

I have made a custom theme for Keycloak and I'd like to set a specific realm to use that theme for the login page and enable internationalization without using admin console, mainly because I want to make it automatic as the realm creation based on the JSON import.

It seems the JSON file is unable to handle theme configuration, is there any way to make this configuration without any human action?

like image 862
Brice Avatar asked Jan 24 '17 16:01

Brice


People also ask

How do you customize a Keycloak?

Login to Keycloak admin and select realm, then go to the theme and select the custom option for the login theme. Remember that the custom option in login will be visible only after adding the custom folder on the path, as explained earlier. This is it!

What is realm Keycloak?

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. clients. Clients are entities that can request Keycloak to authenticate a user.

How do I change the logo on a Keycloak?

Let's try to change the logo to our own. For that, we need to add a new folder, account inside the themes/custom directory. We'll rather copy it from the themes/keycloak directory so that we have all the required elements.


1 Answers

You can use Keycloak CLI to specify a theme for realm. Keycloak CLI executable (kcadm.bat or kcadm.sh) is placed in the /bin directory

First, you need to login with admin credentials:

kcadm config credentials --server http://localhost:8080/auth --realm master --user admin --password ADMIN_PASSWORD

Then you need to update corresponding realm, setting its loginTheme attribute:

kcadm update realms/REALM_NAME -s "loginTheme=REALM_LOGIN_THEME_NAME"
like image 181
Kir Merzlikin Avatar answered Sep 18 '22 07:09

Kir Merzlikin