feat(fleet-auth): unify Zitadel role extraction + request roles via scope (Ch1) #327
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/fleet-ch1-role-gate-followups"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Role-gate follow-ups from v0.3 plan Ch1:
harmony_zitadel_roles: one authoritative parser forZitadel/OIDC project roles (array + object-map + project-scoped URN
variant), shared by the two backend trust boundaries that gate on roles.
The dashboard's
extract_zitadel_roles(object-map only) and the callout'sZitadelValidator::extract_roles(array + object-map) now both delegate;their duplicated logic and tests are deleted.
build_login_attemptforces theurn:zitadel:iam:org:project:rolesscope, so the gate no longer depends onZitadel's out-of-band "Assert Roles on Authentication" checkbox (which broke
it once). Idempotent if the scope is already present.
wrong checkbox instruction, document the in-band scope.
Item 4 (lift
require_roleto a composable layer) intentionally skipped asYAGNI — only
fleet-adminexists; revisit at the second role.this feels like a lot for such a small feature, and that is bound to zitadel. What we actually want is handling jwt tokens and oidc features, not becoming hard-bound to zitadel.
The only detail that is zitadel specific is the string for project roles claim as I saw it.
Also the code is extremely bloated with comments which turns what should be a utility function into a crate and a 400 lines p-r.
I think there is value in working towards clear separation of concerns for oidc / jwt handling in harmony but this is too much too early. Extracting the core abstractions/concepts from the harmony_zitadel_auth crate or better, renaming the crate to harmony_auth or harmony_oidc and having a small zitadel module inside it would make for something easier to reason about, much less comment bloated and more scalable as we add other idp than zitadel.
9dd33f2671tof316bd629b