feat(k8s): optionally auto-fill the medewerker OTP step for the public demo (refs #177) #181

Merged
not merged 4 commits from feat/demo-otp-autofill into main 2026-09-25 11:34:31 +00:00
4 changed files with 26 additions and 14 deletions
Showing only changes of commit 6cd2268be9 - Show all commits
@@ -94,6 +94,10 @@ volumes:
{{- with .defaultMode }} {{- with .defaultMode }}
defaultMode: {{ . }} defaultMode: {{ . }}
{{- end }} {{- end }}
{{- with .items }}
items:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }} {{- end }}
{{- with $w.data }} {{- with $w.data }}
- name: data - name: data
@@ -30,8 +30,8 @@ spec:
annotations: annotations:
checksum/portal-config: {{ include "big.keycloakUrl" $ | sha256sum }} checksum/portal-config: {{ include "big.keycloakUrl" $ | sha256sum }}
{{- end }} {{- end }}
{{- /* subPath mounts never refresh, so Keycloak restarts when the toggle flips. */}} {{- /* Keycloak reads the theme at startup, so it restarts when the toggle flips. */}}
{{- if eq .configMap "kc-theme-js" }} {{- if eq .configMap "kc-theme" }}
annotations: annotations:
checksum/otp-autofill: {{ $.Values.demo.otpAutofill | toString | sha256sum }} checksum/otp-autofill: {{ $.Values.demo.otpAutofill | toString | sha256sum }}
{{- end }} {{- end }}
@@ -1,9 +1,13 @@
{{- /* {{- /*
Keycloak login theme `big-demo`: keycloak.v2 plus one script. It is always Keycloak theme `big-demo`: keycloak.v2 plus one login script. It is always
mounted and always the default theme (KC_SPI_THEME_DEFAULT), so the only thing mounted and always the default theme (KC_SPI_THEME_DEFAULT), so the only thing
`demo.otpAutofill` switches is what that script does. Off, it is empty and the `demo.otpAutofill` switches is what that script does. Off, it is empty and the
login is exactly keycloak.v2. login is exactly keycloak.v2.
KC_SPI_THEME_DEFAULT covers every theme type, and Keycloak does not fall back
for a type the theme lacks (the account console 500s), so account, admin and
email are declared too, each a plain child of Keycloak 26's own default.
On, the medewerker OTP step computes the code from the realm fixture secret On, the medewerker OTP step computes the code from the realm fixture secret
(docs/runbooks/keycloak.md) and submits it: the demo still shows MFA being (docs/runbooks/keycloak.md) and submits it: the demo still shows MFA being
enforced without anyone needing an authenticator. The secret is committed and enforced without anyone needing an authenticator. The secret is committed and
@@ -17,18 +21,16 @@ metadata:
labels: labels:
{{- include "big.labels" (dict "root" $ "name" "kc-theme") | nindent 4 }} {{- include "big.labels" (dict "root" $ "name" "kc-theme") | nindent 4 }}
data: data:
theme.properties: | login.properties: |
parent=keycloak.v2 parent=keycloak.v2
import=common/keycloak import=common/keycloak
scripts=js/otp-autofill.js scripts=js/otp-autofill.js
--- account.properties: |
apiVersion: v1 parent=keycloak.v3
kind: ConfigMap admin.properties: |
metadata: parent=keycloak.v2
name: kc-theme-js email.properties: |
labels: parent=keycloak
{{- include "big.labels" (dict "root" $ "name" "kc-theme-js") | nindent 4 }}
data:
otp-autofill.js: | otp-autofill.js: |
{{- if .Values.demo.otpAutofill }} {{- if .Values.demo.otpAutofill }}
// RFC 6238 with Keycloak's default policy (HmacSHA1, 6 digits, 30 s) over the // RFC 6238 with Keycloak's default policy (HmacSHA1, 6 digits, 30 s) over the
+8 -2
View File
@@ -289,8 +289,14 @@ workloads:
probe: { tcpSocket: { port: 8080 }, initialDelaySeconds: 15 } probe: { tcpSocket: { port: 8080 }, initialDelaySeconds: 15 }
files: files:
- { configMap: rr-kc-realms, mountPath: /opt/keycloak/data/import } - { configMap: rr-kc-realms, mountPath: /opt/keycloak/data/import }
- { configMap: kc-theme, mountPath: /opt/keycloak/themes/big-demo/login/theme.properties, subPath: theme.properties } - configMap: kc-theme
- { configMap: kc-theme-js, mountPath: /opt/keycloak/themes/big-demo/login/resources/js/otp-autofill.js, subPath: otp-autofill.js } mountPath: /opt/keycloak/themes/big-demo
items:
- { key: login.properties, path: login/theme.properties }
- { key: otp-autofill.js, path: login/resources/js/otp-autofill.js }
- { key: account.properties, path: account/theme.properties }
- { key: admin.properties, path: admin/theme.properties }
- { key: email.properties, path: email/theme.properties }
# ── Flowable (S-03) ───────────────────────────────────────────────────────── # ── Flowable (S-03) ─────────────────────────────────────────────────────────
flowable-db: flowable-db: