Realm specific properties for login page theme

In a multi tenant system, we use only one instance of keycloak with many realms, each for one customer.
We don’t wan’t one theme per realm/customer, but one central theme where some realm/customer specific values can be used. Is it possible to store realm specific values in keycloak, and use them as placeholders for the theme? That would be great for multi tenancy

I didn’t test it, but should be possible.
The RealmModel object is available in login theme context. And in a realm you can store custom attributes (but only programmatically, not from the UI).
This should make it possible to get what you want!?

Thank you for your reply.
I couldn’t find any documentation or hint on this, but I will investigate if and how I can write realm custom attributes by REST API. If that’s possible, and they can be read in login theme context from the realm, that would help me a lot :slight_smile:

It’s an undocumented feature :wink:
The property in RealmModel is named attributes and it’s a Map.
See https://github.com/keycloak/keycloak/blob/master/server-spi/src/main/java/org/keycloak/models/RealmModel.java#L124

RealmModel doesn’t help here because on the login page we have only access to RealmBean, which wraps RealmModel and hides attributes.
But we have also access to the current client of the realm, which has a map of attributes, too.
So thanks to your hint we found this and are optimistic to solve our issues. Thanks :slight_smile:

You’re welcome! :slight_smile:

Is there an easy way to extend RealmBean? My issue is quite similar and I’m also thinking of using ClientBean attributes. But this doesn’t help for theming the account management console which only gives me access to a RealmBean which does not offer access to the realm attributes.

Or different approach, can I extend the FreeMarkerLoginFormsProvider/FreeMarkerAccountProvider in an easy way?

Hi Eicki,
you can check if you can solve it the same way we did successfully, without extending or modifying keycloak: There is a special client for the account management console (I think ‘account-console’). So by using “client.attributes[attributeName]” you should reach your individual attributes.
Greetings, Björn