Base template for developing a Keycloak theme.
- Create a folder for your custom theme within the
src/main/resources/themesdirectory, if one does not already exist. - Then add a subdirectory for the theme type (e.g.
admin,login, etc.). - Modify any of the files within your custom theme directory. Assuming you are extending the
baseorkeycloaktheme, you only need to override the files you want to change. - To easily iterate without having to restart the server every time, load keycloak from docker with a script that turns theme caching off:
docker run --name keycloak-theme -d -p 9000:8080 \
-e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin \
--mount type=bind,source=$(pwd)/src/main/resources/theme/example/,target=/opt/jboss/keycloak/themes/example \
-v $(pwd)/docker/no-cache-theme.cli:/opt/jboss/startup-scripts/no-cache-theme.cli \
quay.io/keycloak/keycloak:16.1.0
- Login to the admin console at
http://localhost:9000/auth/adminwithadmin:admin - Go into
Realm Settings->Themesand select the theme you are working on (e.g. Login->example)
- Run
mvn packageto build a jar that can be placed in thestandalone/deploymentsdirectory of your Keycloak installation.