Welcome theme in Keycloak 17/Quarkus

Hi All,

Does anybody know how to enable a welcome theme in the new (Quarkus) distribution of Keycloak? I used to set it in the standalone.xml file, but now I don’t know where to do it.

Thanks!

1 Like

Hi,

you can configure it in your conf/keycloak.conf with the option ‘‘spi-theme-welcome-theme=theme-name’’

( Server Developer Guide )

1 Like

This works here at my side:
KC_SPI_THEME_WELCOME_THEME: mytheme

And in the mytheme folder I have the usual welcome folder.

2 Likes

Do you use that as a build or runtime env var?

Works as runtime config property

1 Like

I am trying to use the following in a Dockerfile

COPY ./theme/mythem themes/mytheme/
ENV KC_SPI_THEME_WELCOME_THEME=mytheme
ENV KC_SPI_THEME_ACCOUNT_THEME=mytheme
ENV KC_SPI_THEME_LOGIN_THEME=mytheme
ENV KC_SPI_THEME_EMAIL_THEME=mytheme

However the settings remain unset

image

The directory structure inside the container is /opt/keycloak/themes/mytheme/account and /opt/keycloak/themes/mytheme/welcome etc

Anything obvious I am doing wrong?

The realm theme configuration doesn‘t work via server config / env vars, this has to be done in each realm.
Server config is global, not realm-related. Welcome theme is a global theme, not realm-related.

Ah thanks, makes sense

I still lost, I use docker and docker-compose. I modified the statement in Dockerfile:
CMD [ “start-dev --spi-theme-welcome-theme=theme1 --spi-theme-login-theme=theme1 --spi-theme-account-theme=theme1” ] (no work)
I also tried to add it in docker-compose file
KC_SPI_THEME_WELCOME_THEME: theme1
KC_SPI_THEME_LOGIN_THEME: theme1
KC_SPI_THEME_ACCOUNT_THEME: theme1
No work too
So where I misunderstand it, thanks for help

Where are you copying in your theme to?

For us its
COPY ./theme/theme1 themes/theme1/

I did
COPY ./themes /opt/keycloak/themes

I can go to the realm → Themes tab → select the theme1 but it is not defaulted.

Only Welcome Theme is global, as dasniko pointed out to me, realm themes wont function so Login and Account wont function need to be applied per realm

1 Like

Thank you for your explanation and help. So how to use
KC_SPI_THEME_LOGIN_THEME: theme1
KC_SPI_THEME_ACCOUNT_THEME: theme1
or
–spi-theme-login-theme=alayacare
–spi-theme-account-theme=alayacare
In terms of the default setup or needs to find another way to do it

Not at all, you can’t configure login and account themes through Keycloak configuration. Only through admin UI / admin REST API. I already mentioned this in one of my above comments!
Or did you find anything else about this in the docs/guides?

Finally, I can set the default theme in docker-compose file:

command: "start-dev --spi-theme-default=theme1"
or
KC_SPI_THEME_DEFAULT: 'theme1'