Repository navigation
feat(auth): expose federation client id in bindings - #248
Conversation
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
There was a problem hiding this comment.
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.
| client_id: *const c_char, | ||
| ) -> KernelStatusCode { | ||
| set_on_config(config, |c| { | ||
| c.identity_federation_client_id = Some(required_str(client_id, "client_id")?); |
There was a problem hiding this comment.
🔵 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.
Threads the optional federation client ID through the final
AuthConfig::pat,oauth_m2m, andoauth_u2mconstructor 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.