Skip to content

docs: mandatory OIDC token exchange (BYOT federation) design - #240

Merged
vuanhphung merged 3 commits into
mainfrom
docs/token-federation-design
Aug 11, 2026
Merged

vuanhphung merged 3 commits into
mainfrom
docs/token-federation-design

Conversation

@vuanhphung

Copy link
Copy Markdown
Collaborator

Adds the design doc for mandatory OIDC token exchange (BYOT federation): wrapping the existing auth providers (PAT / M2M / U2M) with a FederationProvider that exchanges a foreign-issuer JWT for an in-house Databricks token at <host>/oidc/v1/token before use, following the BYOT spec and the ADBC wire contract.

The doc covers the decorator approach (vs. the reserved OAuthFederation variant), the wire contract and its deliberate divergence from JDBC, the sync-trait-over-async bridge, the single-slot cache / no-lock-across-network concurrency model, the per-boundary config surface (identity_federation_client_id), and the test plan.

Docs-only — no code changes. The implementation is tracked separately.

This pull request and its description were written by Isaac.

Add the design doc for wrapping the existing auth providers with a
FederationProvider that exchanges foreign-issuer JWTs for in-house
Databricks tokens at /oidc/v1/token, following the BYOT spec and the
ADBC wire contract. Documents the decorator approach, the wire contract
and its divergence from JDBC, the sync-trait-over-async bridge, the
single-slot cache / no-lock-across-network concurrency model, the
per-boundary config surface, and the test plan.

Co-authored-by: Isaac
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Low

Looks good — a thorough, accurate design doc for BYOT token federation whose code/API references all verify against the current checkout (block_on_in_runtime, execute_without_auth/AuthTokenRequest, the reserved OAuthFederation arm, OAuthToken::is_expired, the 30s/3-retry Auth budget). Two low/nit design notes around the swallow-and-fall-back path; no blocking concerns.

Comment thread docs/designs/token-federation-design.md Outdated
captured runtime is current-thread, skip the exchange and fall back — see below.)
5. **Success** → store `(source, OAuthToken)` (from `expires_in`), return
`Bearer <new token>`.
**Failure** → log at `warn!`, store the original token (short TTL) to avoid

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low — The failure path swallows the exchange error entirely (warn! log + return the original foreign token). For the scenarios where the exchange genuinely produces a different token (SP-wide WIF, AAD-on-AWS), a failed exchange means the un-exchanged foreign token is then used on the Databricks API and rejected downstream with a generic 401. Because the exchange error is only in a warn! line and never propagated, the operator sees an opaque unauthenticated at the call site with no signal that token exchange was attempted-and-failed — the actual root cause. Consider whether the design should at least attach the exchange failure as a source/context on the eventual downstream auth error (or emit a structured telemetry event), so a failed mandatory exchange is diagnosable rather than presenting as a plain auth rejection. The non-breaking fallback posture itself is reasonable and spec-aligned; this is about observability of the failure.

Bring the doc-only branch in line with the implementation: describe the
single-flight coalescing model (AtomicBool leader election + sleep-poll
followers, mirroring TokenStore and Go's CachedTokenProvider), update the
struct sketch, resolver steps, test matrix, and ADBC-delta note.

Co-authored-by: Isaac
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Low

Looks good — a well-researched design doc whose claims about the existing kernel (block_on_in_runtime/block_in_place semantics, the reserved OAuthFederation variant, execute_without_auth + AuthTokenRequest, and the 30s/3-retry Auth budget) I verified as accurate. One low: the retry-code characterization is narrower than the actual idempotent retry set. Docs-only, no code impact.

Add `pub mod jwt;` and `pub mod federation;`; re-export `FederationProvider`.

### `src/config.rs`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low — The doc characterizes the Auth-category ladder as "exponential backoff on 408/502/503/504 and timeouts." That enumeration understates the actual behavior: AuthTokenRequest is classified idempotent (retry.rs:83, idempotency()), and the idempotent strategy retries every status code except the fixed IDEMPOTENT_NON_RETRYABLE set (400,401,403,404,405,409,410,411,412,413,414,415,416). So the exchange will also retry 500 and 429, not just the four codes listed. This matters for the implementer/test author: the test plan's "Exchange 500 → fallback" case relies on max_retries = 0 to avoid real backoff, but a reader trusting the "408/502/503/504" list might assume 500 short-circuits without retry. Consider rewording to "all 5xx/429/408/timeouts except the non-retryable 4xx set" to match is_retryable_status.

AuthTokenRequest is classified idempotent, so the ladder retries all
5xx/429/408/timeouts except the fixed non-retryable 4xx set — not just
408/502/503/504 as previously written (which understated it and could
mislead a reader into thinking 500 short-circuits without retry).

Co-authored-by: Isaac
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No issues identified by the review bot.

@vuanhphung
vuanhphung added this pull request to the merge queue Aug 11, 2026
Merged via the queue into main with commit 0ecc09c Aug 11, 2026
15 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — df89bb27 Deployed Aug 11, 2026 by vuanhphung via followup #276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants