Keycloak Bootstrap Theme
A login and e-mail theme for Keycloak based on Bootstrap: light and dark design, passkeys with AutoFill, four languages and a strict Content Security Policy with script-src 'self'.
Since
2025
Licence
MIT / Apache-2.0
Technologies
The Challenge
Keycloak's default theme looks technical and rarely matches your own brand. Custom themes often copy inline scripts along, which rules out a strict Content Security Policy, and newer features such as passkeys are missing.
The Solution
A complete login and e-mail theme based on Bootstrap's sign-in example, in plain FreeMarker and CSS. It supports passkeys with a sign-in button, AutoFill and registration, plus OTP, registration and password reset.
What the theme offers
Passkeys
Sign-in button, conditional display in the browser's AutoFill and registration of new passkeys; the WebAuthn modules are taken from Keycloak itself at build time.
Light and dark
The chosen design is set before the first paint, with contrast to WCAG AA according to the README.
Configurable
Logo, favicon, copyright year, signature per realm and a cache buster via theme.properties; languages German, English, French and Spanish.
Strict Content Security Policy
Scripts and styles ship as files of their own, and the theme runs under script-src 'self' and style-src 'self'. A small Python tool reads the hashes Keycloak itself still embeds from a running instance and prints a matching CSP. Messages are output through kcSanitize.
Build
A multi-stage Dockerfile takes the WebAuthn modules from the Keycloak image, shrinks CSS and JavaScript with PurgeCSS, csso and terser, and delivers either a complete Keycloak image or just the theme folder. GitLab CI checks the build, the artefacts and that the CSS stays under 100 KB.
Use and licence
The theme consists of FreeMarker templates, CSS and a little JavaScript; every resource is served by Keycloak itself. Its own code is under the MIT licence, templates derived from Keycloak additionally under Apache-2.0.
Privacy
All fonts, styles and scripts come from your own Keycloak server; the theme makes no requests to third parties.
Results
A modern Keycloak theme that supports passkeys, fits your own brand and can run under a strict Content Security Policy.
Gallery
Screenshots of the sign-in page on sso.disisto.de, which uses this theme.