Skip to main content

Customize Keycloak Theme

Introduction​

OSIE uses Keycloak as the identity and access management solution. You can customize the Keycloak theme to match your brand identity.

By default, Keycloak uses this theme: Keycloak Keywind

There are other themes available, and you can also create your own theme.

Import a theme​

After you have a new theme, you can import it into Keycloak.

You must build the theme as a Docker image and push it to a Docker registry.

FROM alpine/git AS source
WORKDIR /source
RUN git clone https://github.com/lukin/keywind.git

FROM node:18 AS builder
WORKDIR /builder
COPY --from=source /source/keywind /builder
RUN npm install
RUN npm run build

FROM alpine:latest
COPY --from=builder /builder/theme/keywind /theme

Then, you can import the theme into Keycloak by following these steps:

Update osie helm chart values.yaml with the new theme image.

  initContainers: |-
- name: osie-keywind-theme
image: ghcr.io/osie-io/osie-keywind:0.1.0-rc1
imagePullPolicy: Always
command:
- sh
args:
- -c
- |
echo "Copying theme..."
cp -R /theme/* /keycloak-theme
volumeMounts:
- name: keycloak-theme
mountPath: /keycloak-theme

extraVolumeMounts: |-
- name: keycloak-theme
mountPath: /opt/bitnami/keycloak/themes/osie

extraVolumes: |-
- name: keycloak-theme
emptyDir: {}
helm --namespace osie upgrade osie osie/osie -f values.yaml

After the upgrade, the new theme will be available in Keycloak.

References​