Skip to content

feat(auth): expose federation client id in bindings - #248

Merged
vuanhphung merged 2 commits into
mainfrom
feature/auth-config-federation-constructors
Aug 14, 2026
Merged

vuanhphung merged 2 commits into
mainfrom
feature/auth-config-federation-constructors

Conversation

@vuanhphung

Copy link
Copy Markdown
Collaborator

Threads the optional federation client ID through the final AuthConfig::pat, oauth_m2m, and oauth_u2m constructor signatures, then exposes it through the Node, Python, and C boundaries. Omitting it continues to select BYOT / account-wide WIF.

This intentionally changes the Rust constructor arities after databricks-driver-test#1268 moved that caller to explicit variants. A follow-up will move driver-test back to the final constructors.

Tested with kernel and pyo3 tests; kernel, pyo3, and napi Clippy; formatting; the N-API drift guard; and driver-test compile/Clippy against this branch.


This PR was created with GitHub MCP.

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.

@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 — clean, well-tested threading of the optional federation client id through all three bindings. Verified argument order matches the updated AuthConfig::pat / oauth_m2m / oauth_u2m signatures at every call site (config, napi, pyo3, C ABI), with matching test coverage per variant. One low-severity note about empty-string handling in the new C ABI setter vs. the documented "unset ⇒ BYOT" contract.

Comment thread src/c_abi/session.rs
client_id: *const c_char,
) -> KernelStatusCode {
set_on_config(config, |c| {
c.identity_federation_client_id = Some(required_str(client_id, "client_id")?);

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 — required_str rejects only null / non-UTF-8 pointers, not empty strings, so a C caller passing "" records Some("") here. Downstream in FederationProvider::exchange the match ... .as_deref() treats any Some(_) — including Some("") — as SP-wide WIF and sends identity_federation_client_id= (empty) on the wire instead of the return_original_token_if_authenticated=true BYOT fallback. The doc comment says "Leaving it unset selects BYOT / account-wide WIF," but an empty string is not "unset" and silently selects the other branch with an empty client id (likely an opaque server-side error). Consider rejecting empty here (or filtering it to None) for parity with the documented contract. Minor: only reachable via an explicit empty-string call, and the napi/pyo3 bindings share the same non-filtering behavior.

@vuanhphung
vuanhphung added this pull request to the merge queue Aug 14, 2026
Merged via the queue into main with commit eff8950 Aug 14, 2026
27 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — 0cc26ff0 Deployed Aug 14, 2026 by oss-reviewer-bot[bot] via followup #345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants