Repository navigation
docs: mandatory OIDC token exchange (BYOT federation) design - #240
Conversation
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>
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
🔵 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>
There was a problem hiding this comment.
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` | ||
|
|
There was a problem hiding this comment.
🔵 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>
Adds the design doc for mandatory OIDC token exchange (BYOT federation): wrapping the existing auth providers (PAT / M2M / U2M) with a
FederationProviderthat exchanges a foreign-issuer JWT for an in-house Databricks token at<host>/oidc/v1/tokenbefore use, following the BYOT spec and the ADBC wire contract.The doc covers the decorator approach (vs. the reserved
OAuthFederationvariant), 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.