ADR-019: canopy-identity — Identity-Service Contract for Workers and Services

NOTE

Amended by ADR-043 and ADR-037 / retired in part by #1443 (OIDC C1, 2026-08-24). The service identity half of this ADR (per-service client_credentials tokens, service:* roles; the audit actor_service column was never built — see Amendment 1) remains the fleet contract, with ADR-037 adding sender-side revalidation of the cached service token. The on-behalf-of half — the X-Canopy-Actor header and its canopy-signing actor JWTs — is RETIRED: worker identity now rides RFC 8693 exchanged bearers (ADR-043 amendment A2 + the receiver-contract slices), and the auth middleware rejects any request still carrying the header (401). The sections below describing the actor mechanism are preserved as the historical design record. Its provider list and the configurable roles path are corrected by ADR-048 (Amendment 2).

2026-10-12: both halves are now canopy-identity’s own tokens, system tokens and onward delegation; see Amendment 3.

NOTE

Environment keys as built (2026-09-17). None of the CANOPY_IDENTITY_* / CANOPY_<SERVICE>_CLIENT_* names in the "Required environment variables" table below is read by any code; the contract is carried by the per-service CANOPY_<SVC>__OIDC_* keys of ServiceSettings (crates/canopy-common/src/settings.rs, ADR-012 layering). Authoritative list and defaults: Configuration Reference › Baseline variables.

Contract variable As built

CANOPY_IDENTITY_ISSUER

CANOPY_<SVC>__OIDC_ISSUER (oidc_issuer), one per service.

CANOPY_IDENTITY_INTERNAL_URL

CANOPY_<SVC>__OIDC_INTERNAL_URL (oidc_internal_url), one per service — the per-service key was kept, not replaced.

CANOPY_IDENTITY_AUDIENCE

No key. Service tokens carry aud=canopy-internal-service; receivers accept the BROAD_AUDIENCES set (crates/canopy-auth/src/policy.rs) and, when CANOPY_<SVC>__ACCEPT_OWN_AUDIENCE=true, their own name (the ADR-043 receiver contract).

CANOPY_IDENTITY_ROLES_CLAIM_PATH, CANOPY_IDENTITY_SERVICE_ROLE_PREFIX

Retired (Amendment 2): the roles sources and the service marker’s wire prefix are [identity.claims] roles / service_prefix in the jurisdiction’s idp.toml, and SERVICE_ROLE_PREFIX (crates/canopy-auth/src/claims.rs) is the in-process form projection rewrites it to.

CANOPY_<SERVICE>_CLIENT_ID

CANOPY_<SVC>__OIDC_SERVICE_CLIENT_ID (oidc_service_client_id).

CANOPY_<SERVICE>_CLIENT_SECRET

CANOPY_<SVC>__OIDC_SERVICE_CLIENT_SECRET (oidc_service_client_secret), SOPS-supplied per ADR-017.

The only CANOPY_IDENTITY_* names any code reads are the two secret inputs of cargo xtask identity verify (CANOPY_IDENTITY_EXCHANGER_SECRET, CANOPY_IDENTITY_PORTAL_SECRET, xtask/src/cmd/identity.rs) — tool inputs, not service configuration.

2026-10-12: the OIDC_* keys and both tool inputs are gone; each service reads IDENTITY_ISSUER and IDENTITY_INTERNAL_URL. See Amendment 3.

Context

Service-to-service calls in canopy currently pass the worker’s JWT end-to-end. canopy-web extracts the worker’s bearer token from the inbound HTTP request and attaches it to the outbound call to canopy-eligibility, which attaches it to canopy-snap, which attaches it to canopy-rules. Three observed problems:

  1. Per-endpoint role gates pile up at every internal boundary. E0.5 (#429) had to add Claims::require_any_role(&["caseworker","supervisor","admin"]) to POST /v1/evaluate on canopy-rules — an internal endpoint that should never be reachable by anything other than program services. The role check protects against the bad case where a worker JWT does reach canopy-rules, but the bad case shouldn’t be possible in the first place. Every internal service grows a cargo-culted set of these checks; missing one is a vulnerability (canopy-rules went unprotected for months).

  2. Worker JWT lifetime bounds service-to-service calls. The token expires when the worker session does (8h sliding for canopy-web). A long-running orchestrator dispatch or a deferred outbox-drainer publish can outlive that token. Today this is masked because most calls are synchronous and complete in seconds, but canopy-eligibility::orchestrator already times out individual program calls at 5–30 s, and any drift toward longer-running flows walks straight into expired-token-mid-flight failures.

  3. Service-to-service calls have no caller-service identity in audit logs. The audit_events chain (ADR-014) records actor_user = sub from the JWT. When canopy-eligibility calls canopy-snap, the audit row says "actor=worker:jane.doe" — true at the top of the call chain, but useless for "which service initiated this read of FTI?" because the answer is always the same: the worker. Reviewer noted on the 2026-05-07 audit that we cannot distinguish "worker invoked SNAP determination directly" from "worker invoked eligibility orchestration which fanned out to SNAP" without parsing logs.

The architectural endpoint is service identity — each canopy-* service authenticates as itself to other canopy-* services. Worker identity, when relevant for audit or eligibility decisions, travels alongside as an explicit "on-behalf-of" assertion, not as the credential itself.

Constraints

  • Per-jurisdiction, not multi-tenant SaaS. Each jurisdiction runs its own canopy stack. Architectural simplicity per stack is what matters.

  • Operators choose any IAM backend. Per idp-integration.adoc, deployers run whatever they have — Keycloak, Okta, Auth0, Azure AD / Entra ID, Authentik, ForgeRock, PingFederate, on-prem AD with ADFS or LDAP. Canopy must not lock anyone into a specific backend.

  • Canopy is not in the ops business. xtask is dev/CI tooling. Production identity-backend lifecycle (provisioning, secret rotation, access-review) is the deployer’s responsibility via their existing IaC and operations practices. Canopy supplies contract, conformance test, and reference templates — nothing that mutates production infrastructure.

Relationship to CRAIG

CRAIG (the sibling CCWIS project) has converged on three principles for worker authentication:

  • CRAIG ADR-011 — Published JWT contract; any RFC 6749 + OIDC-discovery IdP works; configurable role claim path; no IdP admin API dependency.

  • CRAIG ADR-021 — Per-service aud enforcement, azp/scope/typ validation.

  • CRAIG ADR-026 — worker_identities table populated lazily from observed JWT claims; no calls to IdP admin APIs to map preferred_username → sub.

Canopy adopts these worker-auth patterns as-is. Same contract, same enforcement, same identity-normalization approach. Where canopy is currently ahead of CRAIG (canopy-auth already uses OIDC discovery and OIDC_ISSUER env var convention; CRAIG’s ADR-011 says it should but the code still has Keycloak-specific paths), CRAIG should catch up.

Where canopy genuinely diverges from CRAIG: internal service identity. CRAIG’s call graph is dominated by RabbitMQ async messaging (CRAIG ADR-003); canopy’s orchestrator pattern produces ~30 synchronous service-to-service calls per worker action, each currently passing the worker JWT. CRAIG can defer service-identity work until they hit the same scale; canopy cannot.

Options considered

  1. OAuth2 client_credentials directly against the operator’s IdP, no canopy-side abstraction. Each canopy service registered as a client in the deployer’s IdP. Major IdPs all support this; bare AD/SAML-only deployers must run their own federator (Keycloak/Dex/etc.) outside canopy. Considered. Loses the "single integration point per service" property — every canopy service ends up with operator-IdP-specific config (claim paths, audience values, token endpoints) duplicated.

  2. Self-signed service JWTs with canopy-signing as trust root. Every service self-signs its own service token; canopy-signing publishes an aggregated JWKS. Builds a parallel auth system inside canopy. Confuses canopy-signing’s existing role (signed determinations per ADR-002) with auth identity. Forces every service to validate two kinds of tokens. Rejected.

  3. Build a canopy-identity proxy service that wraps backends. New canopy-* service container that sits between canopy services and the actual IAM backend. Adds latency, a SPOF, and operational footprint. Most of what such a proxy would do is already done by OIDC discovery. Rejected.

  4. Define canopy-identity as an interface contract; backends fulfill it directly. No new service container. canopy services depend on CANOPY_IDENTITY_ISSUER (an OIDC issuer URL); operators point that at any compliant backend. Selected.

Decision

canopy-identity is a contract, not a service container. Every canopy-* service depends on the canopy-identity contract URL — an OIDC issuer that satisfies the requirements below. No new service is introduced. Operators choose any compliant backend (Keycloak by default in the dev stack; Dex, Authentik, Okta, Entra, ForgeRock, or custom in production). Canopy ships the contract definition, a conformance test, and reference IaC templates — but does not own production identity-backend lifecycle.

The canopy-identity contract

Required environment variables

Variable Meaning

CANOPY_IDENTITY_ISSUER

OIDC issuer URL. Used for iss claim validation and to discover the well-known endpoints. Example: https://idp.example.gov/realms/canopy.

CANOPY_IDENTITY_INTERNAL_URL

Optional override of the issuer URL for in-cluster traffic (Docker network, Kubernetes service DNS). Same content, different network locator. Replaces the existing per-service CANOPY_*__OIDC_INTERNAL_URL.

CANOPY_IDENTITY_AUDIENCE

Audience claim canopy services validate against. canopy-internal-service for service-to-service tokens; per-service for worker-facing endpoints (canopy-ui, canopy-api, etc., per CRAIG ADR-021).

CANOPY_IDENTITY_ROLES_CLAIM_PATH

JSON-pointer-style path to the roles array in the JWT. Default realm_access.roles (Keycloak). Operators with backends that emit roles elsewhere (Okta groups, Azure AD roles, custom) override.

CANOPY_IDENTITY_SERVICE_ROLE_PREFIX

Prefix marking a role as a service identity. Default service:. A claim like service:canopy-eligibility in the configured roles path identifies the caller as canopy-eligibility’s service principal.

CANOPY_<SERVICE>_CLIENT_ID

The OAuth2 client_id this service uses for its own client_credentials grant. Example: CANOPY_ELIGIBILITY_CLIENT_ID=canopy-eligibility.

CANOPY_<SERVICE>_CLIENT_SECRET

Secret for the OAuth2 client. Encrypted via SOPS per ADR-017 in secrets/dev.yaml; per-jurisdiction encrypted-config repos in production.

Required OIDC discovery endpoints

The issuer’s /.well-known/openid-configuration document MUST advertise:

  • authorization_endpoint — for worker authorization_code + PKCE flows from the BFFs.

  • token_endpoint — supporting grant_type=client_credentials (services) and grant_type=authorization_code (workers).

  • jwks_uri — for JWT signature verification.

  • end_session_endpoint — RP-initiated logout from the BFFs (recommended; not required).

Required token shape

Service tokens (issued via client_credentials):

  • iss matches CANOPY_IDENTITY_ISSUER.

  • sub is stable across the service principal’s lifetime.

  • azp (or client_id claim) identifies the calling service.

  • aud includes canopy-internal-service.

  • exp, iat standard.

  • The roles claim (at CANOPY_IDENTITY_ROLES_CLAIM_PATH) contains an entry starting with CANOPY_IDENTITY_SERVICE_ROLE_PREFIX. Default: service:canopy-<name>.

Worker tokens (issued via authorization_code to a BFF client):

  • iss matches CANOPY_IDENTITY_ISSUER.

  • sub is the worker’s stable identifier.

  • aud is the requesting BFF client (canopy-ui, canopy-api, etc.).

  • preferred_username, email standard OIDC.

  • Roles claim contains worker roles (no service:* entries). Per-jurisdiction role taxonomy (per idp-integration.adoc).

Canopy Claims deserialization tolerates either string or array aud (per CRAIG ADR-021’s aud_or_vec deserializer). Roles are looked up via the configured path with a default-Keycloak fallback.

Conformance: cargo xtask identity verify

A read-only conformance check that points at any candidate backend and confirms it satisfies the contract. Behavior:

  1. Hits <issuer>/.well-known/openid-configuration. Verifies the four required endpoints are present.

  2. Fetches jwks_uri. Confirms it parses, contains usable signing keys.

  3. Performs a client_credentials grant using a test service principal (configured in the same env vars as a real canopy service). Validates the response token against the contract: iss, aud, exp, role claim shape, audience.

  4. Performs an authorization_code flow with PKCE against a test worker principal (when test credentials are available). Validates the resulting token similarly.

  5. Reports per-check pass/fail with diagnostic detail.

cargo xtask identity verify --issuer <url> is safe to run anywhere — dev, CI, production deployment-gating. It does not mutate the backend. Production deployers run it as part of their canopy rollout pipeline; CI runs it against the devstack Keycloak as a regression check.

Reference templates: cargo xtask identity render

Pure code generation. Emits IaC fragments for backends canopy provides adapters for:

  • cargo xtask identity render --backend keycloak [--out realm.json] — emits a Keycloak realm definition with the worker realm + 13 service-account clients + audience mappers + service:canopy-* realm roles. Operators merge it into their Keycloak Operator CR / Helm chart / Terraform Keycloak provider config.

  • cargo xtask identity render --backend authentik [--out blueprint.yaml] — emits an Authentik blueprint covering the same shape.

  • cargo xtask identity render --backend dex [--out dex.yaml] — emits a Dex static-clients + connector-config template.

Backends without a render adapter (Okta, Entra, ForgeRock, PingFederate, custom) require operator-side configuration in whatever tooling the operator already uses. The contract definition above + the conformance test give them the spec they need.

Lifecycle ownership

Canopy ships:

  • The contract (this ADR + env-var schema in canopy-common config).

  • The conformance test (cargo xtask identity verify).

  • Reference IaC templates (cargo xtask identity render --backend …).

  • Devstack provisioning (cargo xtask dev identity provision — namespaced under dev so the dev-only intent is unmistakable; mutates the devstack Keycloak admin API to install the canopy realm).

  • Client-side code in canopy-auth that consumes the contract (token sources, JWT validators, claims extensions).

Canopy does not ship:

  • Production provisioning that mutates a deployer’s IAM backend.

  • Production secret rotation tooling.

  • A canopy-identity service container.

The application requires service client credentials to exist; it does not own their lifecycle. Production deployments provision them through the deployer’s existing operations stack (Terraform with the relevant IAM provider, Helm/Kustomize values, Ansible, Vault scripts, Authentik blueprints in gitops, Keycloak Operator CRs, or human admin-console clicks) and validate them with cargo xtask identity verify before rolling out canopy services.

On-behalf-of: X-Canopy-Actor

When a service makes an outbound call on behalf of a worker (e.g., canopy-eligibility orchestrating a SNAP determination requested by worker:jane.doe), the bearer token is the calling service’s client_credentials-issued token. Worker identity propagates via an X-Canopy-Actor header carrying a service-signed JWT:

{
  "iss": "canopy-eligibility",
  "sub": "<worker-sub>",
  "preferred_username": "jane.doe",
  "<roles-claim-path>": ["caseworker"],
  "aud": "canopy-internal-actor",
  "exp": <now + 600>,
  "iat": <now>,
  "act_for": "canopy-eligibility"
}

The actor JWT is signed by the calling service’s existing canopy-signing keypair (the same key used for ADR-002 signed determinations). Different aud namespace (canopy-internal-actor) separates the two uses — a leaked determination JWS doesn’t grant actor authority and vice versa. The actor JWT validates against canopy-signing’s JWKS (separate from canopy-identity’s JWKS).

Two JWKS to validate per request when X-Canopy-Actor is present is by design. The bearer is canopy-identity-issued (operator backend); the actor is canopy-signing-issued (canopy-internal). Conflating them would put canopy in the IdP business; keeping them separate keeps the operator’s IAM backend the single source of truth for who and canopy-signing the source of truth for which canopy service signed this assertion.

This pattern works regardless of whether the operator’s backend supports RFC 8693 token-exchange (most don’t, today). Operators with token-exchange-capable backends could in principle use backend-issued actor tokens; canopy doesn’t require it.

Receiving-side validation

canopy-auth::middleware:

  1. Extract Authorization: Bearer <token>. Validate against canopy-identity’s JWKS (cached at startup, refreshed on kid cache miss). Validate aud matches per-endpoint expectation: canopy-internal-service for internal endpoints, the BFF client for worker-facing entry points. Validate exp, iss.

  2. Look up the configured roles claim path. If any entry starts with CANOPY_IDENTITY_SERVICE_ROLE_PREFIX, mark Claims::is_service() == true.

  3. If the request also carries X-Canopy-Actor, validate the actor JWT against canopy-signing’s JWKS, check aud == "canopy-internal-actor", set claims.actor = Some(Box::new(actor_claims)).

  4. Reject if either validation fails. Never silently drop.

Claims API

impl Claims {
    pub fn is_service(&self) -> bool {
        self.roles().iter().any(|r| r.starts_with(SERVICE_ROLE_PREFIX))
    }

    pub fn service_id(&self) -> Option<&str> {
        self.roles().iter()
            .find_map(|r| r.strip_prefix(SERVICE_ROLE_PREFIX))
            .or(self.azp.as_deref())
    }

    pub fn require_service_caller(&self) -> Result<(), ApiError> {
        if self.is_service() { Ok(()) } else { Err(ApiError::Forbidden) }
    }

    pub fn actor(&self) -> Option<&Claims> { self.actor.as_deref() }
}

Claims::roles() reads from the configured path (default realm_access.roles).

NOTE

As built (2026-09-11, #1848). No Claims::roles() accessor was ever built. Roles are read straight from the realm_access.roles claim: Claims::has_role — and require_role / require_any_role / the require_*_or_above bars layered on it, plus the is_service / service_id helpers shown above — all iterate that field (crates/canopy-auth/src/claims.rs). CANOPY_IDENTITY_ROLES_CLAIM_PATH (listed among the required environment variables above) is read by no code today; the deserializer expects the Keycloak shape, and the configurable roles-claim path remains a follow-up, tracked by #515 (multi-IdP claim-shape support — roles_claim_path + validation mode), which owns claim-shape configurability repo-wide. The paragraph above is preserved as the historical design record.

Consequences

Positive

  • Single integration point per service. Every canopy-* service depends on one URL (CANOPY_IDENTITY_ISSUER). No per-service operator-IdP integration. No per-service per-IdP claim-mapper hand-coding.

  • Genuine backend pluggability. Services don’t know the backend type because they only consume OIDC discovery + JWKS + standard JWT claims. Keycloak, Dex, Authentik, Okta, Entra, ForgeRock, or a custom Rust binary all work as long as xtask identity verify passes.

  • No new service container. Zero net deployment-surface increase. canopy-auth (existing crate) gains client-side helpers; everything else is reference templates and a verifier.

  • Production identity lifecycle stays with the deployer. Canopy doesn’t claim ownership of secrets, client registrations, or rotation schedules. Operators use their existing IaC.

  • Per-endpoint role gates collapse. Internal endpoints check claims.is_service(). The role-gates added in #429 become claims.require_service_caller() — one line per endpoint.

  • Audit log gains caller-service. audit_events.actor_service = claims.service_id() (always present on service tokens). actor_user = claims.actor.as_ref().map(|a| &a.sub) (when X-Canopy-Actor is present). The reviewer’s "did the worker invoke SNAP directly or via orchestrator" question now has a definitive per-row answer.

  • Service token lifetime decoupled from worker session. Service tokens refresh on the service’s schedule. Long-running flows don’t fail mid-flight on session expiry.

  • Aligns canopy with CRAIG on worker auth. CRAIG ADR-011/021/026 patterns adopted verbatim. Canopy is ahead on implementation; this ADR codifies the shared direction.

Negative

  • Two JWKS to validate per request when X-Canopy-Actor is present. Bearer validates against canopy-identity JWKS; actor validates against canopy-signing JWKS. Mitigated by caching: canopy-auth caches verified JWTs for 30 s, with separate cache hits for bearer and actor tokens.

  • Operators must configure 13 service-account clients in their IAM backend. This is real work, but it’s a one-time per-stack cost (canopy is per-jurisdiction, not multi-tenant SaaS) and xtask identity render provides a starting template for the supported backends.

  • Reference templates can drift from canopy’s expectations. Mitigated by xtask identity verify — operators run it post-provisioning to confirm their backend matches canopy’s contract.

  • Secrets rotation is the deployer’s job. Canopy-side caching survives a rotation event up to the cached service-token TTL (1h default); after that, services need a fresh client_credentials grant. Operators document their rotation procedure; canopy doesn’t ship rotation tooling.

Mitigations

  • JWKS staleness: OIDC discovery + JWKS endpoints publish with sensible cache headers; canopy-auth refreshes on kid cache miss.

  • Per-stack trust isolation: Each canopy stack uses its own canopy-identity issuer URL. Tokens from stack A don’t validate against stack B because the JWKS keys differ.

  • Per-endpoint role gates from #429: Removed during the cutover MR (Phase 3). require_service_caller is the structural replacement.

Migration: hard cutover (pre-1.0)

Pre-1.0 with no production users. Three implementation MRs after the ADR lands:

Phase Behavior

MR 1 — ADR + contract docs

This ADR lands standalone. Plus updates to idp-integration.adoc documenting the contract. No code change.

MR 2 — Foundations

Claims API extensions. ServiceTokenSource (canopy-auth client_credentials wrapper). ActorTokenIssuer (canopy-signing). Auth middleware actor extraction. Outbound helpers (with_service_identity, with_actor). Bootstrap wiring. xtask identity verify + xtask identity render --backend keycloak + xtask dev identity provision. devstack canopy-realm.json extended with 13 service-account clients (placeholder secrets; dev identity provision populates real values). secrets/dev.yaml gains 13 entries. Worker JWTs still accepted at every endpoint.

MR 3 — Outbound flip + cutover

Every canopy-eligibility orchestrator + canopy-web outbound call switches from forwarding worker JWT to with_service_identity + with_actor. Internal-only endpoints flip to require_service_caller. #429 role gates removed. Audit log writers gain actor_service + actor_user_sub columns + writes. End-to-end actor-propagation regression test pins the contract.

Worker-facing entry points (canopy-web, canopy-portal, canopy-applications intake, canopy-eligibility’s /v1/eligibility/determine worker entry, canopy-enrollment caseworker actions, canopy-renewals, canopy-appeals) keep accepting worker JWTs validated against canopy-identity’s JWKS — same JWKS, different aud. That’s the steady state.

Out of scope

  • mTLS between services. Could layer on top of this design. Not a substitute.

  • Token-binding (RFC 8473). Not necessary at canopy’s threat model.

  • Per-service token audience. Single aud: canopy-internal-service is sufficient.

  • Replacing canopy-signing. canopy-signing keeps its existing role (signed determinations, ADR-002) plus a small extension (signed actor JWTs, distinct aud namespace).

  • Worker on-behalf-of without going through a BFF / determine entry. Worker tokens are validated once at the front door; thereafter worker identity travels as actor JWTs. There is no "worker calls canopy-rules directly" path — that was never supposed to be possible and is now structurally prevented.

  • Service catalog, multi-tenancy, projects/domains, quotas, endpoint registry. OpenStack Keystone provides these; canopy doesn’t need them.

  • Production provisioning tooling. Canopy ships dev provisioning + reference templates + a conformance test. Production lifecycle is the deployer’s responsibility.

References

Amendment 1 (2026-09-17) — as built

Status unchanged. This amendment records where the shipped service-identity half differs from the text above; the Decision and Consequences are not edited. The on-behalf-of half is covered by the retirement banner and ADR-043.

  • actor_service was never built. No .rs or .sql file in the tree names an actor_service or actor_user_sub column. The audit envelope carries source_service — the publishing service (canopy_mq::envelope; audit_events.source_service in services/canopy-security/migrations/20260326000000_create_security_tables.sql) — not the calling service. The caller’s identity is available on a service token as Claims::service_id() (crates/canopy-auth/src/claims.rs) but is not persisted as an audit column. The "Audit log gains caller-service" consequence and the MR 3 row "Audit log writers gain actor_service + actor_user_sub columns" are therefore not as built.

  • Environment keys. See the banner table: the contract is carried by the per-service CANOPY_<SVC>__OIDC_* keys under ADR-012 layering, so the "single URL per service" consequence reads as-built as one OIDC_ISSUER / OIDC_INTERNAL_URL pair per service, sourced from each service’s YAML tier.

  • cargo xtask identity render ships Keycloak only. The Backend enum in xtask/src/cmd/identity.rs has the single variant Keycloak; no Authentik blueprint or Dex template renderer was built.

  • cargo xtask dev identity provision does not exist. The module documentation of xtask/src/cmd/identity.rs records provision as deliberately absent; the devstack realm is imported from devstack/keycloak/canopy-realm.json through Keycloak’s --import-realm. cargo xtask identity verify exists (Subcommand::Verify) and is the conformance check the Decision describes.

  • ADR-037. The service-token acquisition half is amended by ADR-037: the holder of a cached client_credentials token revalidates it against a bounded-freshness JWKS and re-mints when its signing key has been deleted.

Amendment 2 (2026-09-26, #515, ADR-048) — one trusted issuer, a declared claim contract

Status unchanged. ADR-048 corrects this ADR’s provider claims. The Decision and Consequences are not edited.

  • Supported backends. The Decision’s "Dex, Authentik, Okta, Entra, ForgeRock, or custom in production", the Context’s backend list and the Consequences' "all work as long as xtask identity verify passes" are not as built. canopy trusts exactly one issuer. The jurisdiction declares that issuer’s claim layout in the [identity] table of rulesets/<jurisdiction>/idp.toml (canopy_auth::IdentityConfig), with two presets: keycloak and oidc-generic. Keycloak 26.2+ is the verified broker. Authentik and ZITADEL are recorded as incompatible with canopy’s exchange topology. A backend works when it meets the claim contract and the topology. cargo xtask identity verify --issuer <url> --jurisdiction <slug> --check-exchange checks the contract’s projection of a service token and one single-audience exchange; it does not exercise hop 1’s two-audience mint or the hop-2 chained exchange, which only exchanging through both hops against that issuer proves (ADR-048 decision 5). SAML, LDAP and AD sources federate into the trusted issuer; canopy terminates none of them.

  • The roles path and the service prefix are retired, not revived. CANOPY_IDENTITY_ROLES_CLAIM_PATH and CANOPY_IDENTITY_SERVICE_ROLE_PREFIX stay unread. Their job is done by [identity.claims]:

    • roles is one or more RFC 6901 pointer sources (array or object_keys), unioned;

    • service_prefix is the service marker’s wire prefix (default service:). Projection rewrites a kept marker to the in-process SERVICE_ROLE_PREFIX, so Claims::is_service and Claims::service_id never depend on the issuer’s spelling.

  • Claims::roles() exists. The #1848 note under "Claims API" records that it was never built; #515 built it. Every validated token is projected through ClaimContract::project (crates/canopy-auth/src/claim_contract.rs), and roles() returns the projected set: the ROLE_VOCABULARY roles and the service markers, nothing else. realm_access is gone from Claims.

  • azp or client_id. The token-shape rule "azp (or client_id claim) identifies the calling service" is as built since #515: projection takes azp, else client_id (RFC 9068), and refuses a token carrying both with different values.

Amendment 3 (2026-10-12, #2883, ADR-049) — canopy-identity is canopy’s issuer

Status unchanged. ADR-049 supersedes this ADR’s Decision in part, and its plan I3g made that effective. The Decision and Consequences are not edited.

  • A module of canopy-security, not a contract. The Decision’s "canopy-identity is a contract, not a service container" and the rejection of options 2 and 3 are superseded (ADR-049 D1, D2). canopy-identity is canopy’s own OAuth 2.0 issuer, a module of canopy-security, and every receiver trusts only it. No operator IdP issues a token a service accepts: the upstream IdP only signs workers in at canopy-web (ADR-048 Amendment 1). Still no new container ships.

  • Service identity becomes system tokens. A service authenticates as itself with a system token: one audience, its purpose’s scope, at most 600 s, minted only for a compiled System or Both call-graph edge (ADR-049 Amendments 3, 4 and 16). It is obtained by private_key_jwt with the service’s own key (D10), not by client_credentials with a secret. service:* roles and the canopy-internal-service audience are gone, which also ends Out of scope’s single shared audience. A receiver refuses a system token whose client has no edge to it (Amendment 14, L3), and a handler admits the caller by the route’s named Admission (principal.admit), which replaces require_service_caller.

  • On-behalf-of becomes onward delegation. The retired X-Canopy-Actor header is refused with 400 actor_header_retired (Amendment 14, L4). A call inside a worker’s request carries a delegation token: the worker’s canopy subject as sub, and an RFC 8693 act chain naming each hop (D3). A service delegates onward from the token addressed to it, never widening (Amendment 7, G9). The Context’s three problems are answered by structure:

    • a worker’s token reaches only a route whose admission admits its roles, from any actor or only through the actors it lists;

    • background work takes a system token, which no worker session bounds;

    • the act chain names the calling service on every delegated call.

    canopy-cli’s delegation reaches services directly, canopy-rules included, under each route’s admission (ADR-007 Amendment 4).

  • Attribution. A system caller’s recorded actor is its client id, and a delegated call records the worker’s canopy subject (Principal::actor and attribution_sub; ADR-049 Amendment 3, A4). The actor_service column remains unbuilt (Amendment 1).

  • Configuration. Each service reads the required IDENTITY_ISSUER and IDENTITY_INTERNAL_URL (ServiceSettings). A service that calls another holds its client key as a reserved secret (ADR-017 Amendment 3). The OIDC_* keys, the service client id and secret, the exchanger pair and accept_own_audience are gone.

  • Tooling. cargo xtask identity verify and identity render are gone. cargo xtask identity check is canopy-identity’s deploy gate (ADR-049 Amendment 23, O8), and identity conformance runs an upstream IdP’s conformance lane. Production lifecycle stays the deployer’s: a deployment registers each client’s public keys in canopy-security’s identity-clients.yaml and provisions the private keys through its secret provider.

  • ADR-037. The cached-token revalidation Amendment 1 cites is superseded too (ADR-037 Amendment 2).

Edit this page · default