mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-22 12:43:32 +09:00
For `oidc.mode: System`, emit a per-cluster public `KeycloakClient` plus a per-cluster `KeycloakClientScope` inside the platform `cozy` realm. The scope carries an `oidc-audience-mapper` that pins `id_token.aud` to the per-cluster clientId, so a token minted for cluster A is rejected by cluster B's apiserver. The clientId is namespace-prefixed (`<ns>-<release>`) to stay unique across the realm — two clusters with the same name in different tenants would otherwise collide. The client is `public: true`, redirects locked to localhost:8000 / localhost:18000 (the kubelogin/oidc-login defaults), with PKCE required via the standard Keycloak attribute. `defaultClientScopes` includes both `groups` and the per-cluster audience scope. A render-time guard fails fast when `oidc.mode: System` is set but `_cluster.oidc-enabled` is not `"true"` — the Keycloak operator CRDs are otherwise absent and the chart would silently no-op. Nothing is rendered for `mode: CustomConfig` or `mode: None`. Signed-off-by: Ivan Okhotnikov <ivan.okhotnikov@aenix.io>
How to test packages local
cd packages/core/installer
make image-cozystack REGISTRY=YOUR_CUSTOM_REGISTRY
make apply
kubectl delete po -l app=source-controller -n cozy-fluxcd