[Java][Go] Add first-class external-IdP (Entra ID) token federation

Aperta
#1,069 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, java, rust

Direzione di ricerca

Read the Rust core’s FederatedTokenProvider and IdpTokenSupplier implementation from #760, then trace the Java JNI and Go cgo binding layers. Add callback bridging and supplier identity handling in both bindings, with tests for account and workload federation, caching, invalidation, and callback errors. Done means both SDKs pass those unit tests and include a README section and example; live gRPC validation against a real workspace is also in the testing plan.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

SDK

Java and Go

Description

Summary

Follow-up to #740: extend first-class external-IdP (for example Microsoft Entra ID)
token federation to the Java and Go (cgo) SDKs. The feature shipped in Rust
2.11.0 and Python 1.10.0 (#760), and these two SDKs are next by usage. The native
Pure Go SDK (purego/) is out of scope here: it has its own OAuth stack, so it
would need a separate implementation.

Same feature as #740: the caller supplies a callback that returns the current
external IdP token. The SDK exchanges it for a Zerobus-scoped Databricks token
using the RFC 8693 token-exchange grant, then caches and refreshes it the same way
the existing OAuth client-credentials path does. The Zerobus service does not change.

Motivation

Enterprise customers who can't use Databricks-managed OAuth secrets today work
around it on Java and Go by hand-rolling the exchange inside a custom
HeadersProvider. That means each team re-implements the request shaping (the
zerobusDirectWriteApi resource and table-scoped authorization_details), the
caching and the refresh. Rust and Python callers no longer have to do this, and
Java and Go callers shouldn't have to either.

Both modes from #740 are in scope:

  1. Account-level federation:
    no client_id. The subject resolves to the SCIM-synced identity.
  2. Workload identity federation:
    a service principal client_id with no secret, and a federation policy attached.

Design

Both SDKs wrap the Rust core: Java through JNI and Go (cgo) through the C FFI. So
the token exchange, request shaping, token cache, proactive refresh and
invalidate() handling are reused from the Rust core as-is (the
FederatedTokenProvider / IdpTokenSupplier from #760). This work is mostly
binding-layer work:

  • Rust JNI / FFI layers: expose the federated provider, with a language
    callback bridged as the IdP token supplier. Errors raised in the callback
    propagate back as SDK auth errors.
  • Supplier identity: keep the stable identity-string cache key design from
    #760, keyed on (client_id-or-none, table) plus supplier identity. Do not key
    on callback pointers or handles, because addresses can be reused after
    release.
  • Callback, not a bare token (same reasoning as #740): IdP tokens are
    short-lived, so a static token would strand the stream when it expires. Callers
    that hold a static token can wrap it in a trivial callback.

Backward compatibility

Purely additive and opt-in, same as #740.

Testing plan

  • Unit tests in each binding: both modes, the callback is called only on a cache
    miss or refresh, invalidate(), callback-error propagation, and independent
    caching per mode and per service principal.
  • Live end-to-end validation of both modes on gRPC against a real workspace
    (Entra ID), including a run over a full token lifetime to show auto-refresh.
  • README section and an example per SDK.

Related

  • #740 (design and tracking issue for Rust/Python), #760 (implementation)
  • Public docs: Zerobus federation section (already published)

I will proceed to open the PR(s) against this issue.

Proposed Solution

Java: a FederatedToken auth option on the stream builder that takes a
callback (Supplier<String>, plus an async Supplier<CompletableFuture<String>>
variant) and an optional clientId.

Go: an option on stream creation that takes
func(ctx context.Context) (string, error) and an optional client ID.

The existing client-credentials and custom HeadersProvider paths are
unchanged.
The above is open for discussion once the PR is created

Additional Context

No response

Lingua principale
Rust
Stelle
95
Fork
36
Merge medio
4g 7h
PR unite (30g)
46

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di databricks/zerobus-sdk

Tutte le issue di databricks/zerobus-sdk

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.