Skip to content

Commit 5b2a730

Browse files
committed
fix(apps/kubernetes,docs): explicit --oidc-extra-scope=email + doc alignment
Two follow-ups from the final adversarial review: - The chart-generated OIDC kubeconfig exec block requested only `--oidc-extra-scope=groups`. On a Keycloak realm where `email` is not a default client scope, kubectl-oidc-login would fetch a token that lacks the `email` claim — apiserver would then fail to identify the user, causing a silent auth failure. Add `--oidc-extra-scope=email` explicitly so the flow does not depend on realm-level default-scope hygiene. - `docs/oidc-tenant.md` still said the `User:` subject "must match the `preferred_username` claim emitted by the issuer" — obsolete after the claim switch. Rewrite to say `email`, and add a note that the chart requests the `email` scope explicitly. Signed-off-by: Ivan Okhotnikov <[email protected]>
1 parent de0299f commit 5b2a730

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎docs/oidc-tenant.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ spec:
9696
- cozystack-prod
9797
claimMappings:
9898
username:
99-
claim: preferred_username
99+
claim: email
100100
prefix: ""
101101
groups:
102102
claim: groups
@@ -143,10 +143,14 @@ maps to the same binding.
143143
| `view` | `view` |
144144

145145
The CRB `User:` subject is the literal `email` value; it must match the
146-
`preferred_username` claim emitted by the issuer. In the platform `cozy`
147-
realm `preferred_username` defaults to the user's email, so the typical
148-
case "just works". For `CustomConfig`, ensure your issuer's
149-
`preferred_username` claim matches the value you list here.
146+
`email` claim emitted by the issuer. In the platform `cozy` realm every
147+
user has an `email` attribute and the standard OIDC `email` scope is a
148+
default client scope, so the token always carries `email`. For
149+
`CustomConfig`, ensure your BYO issuer emits the `email` claim in the
150+
JWT — every conformant OIDC provider does when the `email` scope is
151+
included in the client's default scopes. The chart-generated OIDC
152+
kubeconfig requests `--oidc-extra-scope=email` explicitly so this does
153+
not depend on the client's realm-side default scope configuration.
150154

151155
Toggling a user out of `users[]` revokes their access on the next chart
152156
reconcile — the bootstrap Job prunes any CRBs labelled by the release

‎packages/apps/kubernetes/templates/oidc-rbac-job.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ spec:
305305
- get-token
306306
- --oidc-issuer-url=$OIDC_ISSUER_URL
307307
- --oidc-client-id=$OIDC_CLIENT_ID
308+
- --oidc-extra-scope=email
308309
- --oidc-extra-scope=groups
309310
- --oidc-use-pkce
310311
interactiveMode: IfAvailable

0 commit comments

Comments
 (0)