Files
harmony/examples/zitadel
Jean-Gabriel Gill-Couture b8bc2217fd feat(zitadel): ExternalPort + machine-user/role/key/grant provisioning
ZitadelScore:
- Auto-provisions an `iam-admin-pat` Kubernetes secret via the chart's
  FirstInstance.Org.Machine.Pat block. ZitadelSetupScore depended on
  this secret existing; without the chart values, the prior code path
  was non-functional.
- New `external_port: Option<u32>` field. Controls Zitadel's emitted
  issuer URL when the host port mapping isn't 80/443 (k3d typically
  maps 8080:80). Without it, JWT-bearer audience validation 500s with
  `Errors.Internal` because the assertion's `aud` doesn't match the
  chart-default issuer at port 80.

ZitadelSetupScore is extended for the JWT-bearer flow needed by the
NATS auth callout:
- API apps (resource servers — required for project-id audience scope)
- Project roles (`POST .../projects/{id}/roles`, idempotent)
- Machine users with KEY_TYPE_JSON keys (provisioned + cached
  device-side; Zitadel does not expose the key material on subsequent
  reads, so the local cache is the source of truth)
- User grants (project + role keys)

Cache (ZitadelClientConfig) gains projects, machine_user_ids,
machine_keys, and user_grants — keyed for idempotency across re-runs.
Backwards compatible with existing harmony_sso example: the new fields
have `#[serde(default)]` and prior callers just need empty vecs.

Refresh upgrade-by-default in helm chart (separate commit) lets
ExternalPort changes propagate to existing releases on re-run.
2026-05-03 15:01:22 -04:00
..