Skip to content

[PureGo] Add UC OAuth token provider with per-table caching#496

Draft
zlata-stefanovic-db wants to merge 1 commit into
purego-auth-cachefrom
purego-oauth-provider
Draft

[PureGo] Add UC OAuth token provider with per-table caching#496
zlata-stefanovic-db wants to merge 1 commit into
purego-auth-cachefrom
purego-oauth-provider

Conversation

@zlata-stefanovic-db

@zlata-stefanovic-db zlata-stefanovic-db commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Third of a 3-PR stack. Stacked on #495 (base branch purego-auth-cache).

Adds the Unity Catalog OAuth 2.0 provider:

  • OAuthTokenProvider — client-credentials flow minting downscoped per-table tokens, with proactive refresh and endpoint/table validation. Concrete type (no interface), mirroring the Rust SDK's DefaultTokenFactory.
  • OAuthHeadersProvider — wraps OAuthTokenProvider and emits the Zerobus metadata headers, satisfying the transport headers-provider hook (from [PureGo] Add custom auth-header hook to transport #494).
  • Treats all 4xx token responses (including 429/408) as non-retryable and anchors cached token TTL at response receipt, matching the Rust SDK.

Stack

  1. [PureGo] Add custom auth-header hook to transport #494 — transport header hook
  2. [PureGo] Add auth provider interfaces and per-table token cache #495 — auth HeadersProvider + token cache
  3. this PR — UC OAuth provider

Test plan

  • go build ./... and go test ./internal/... pass.

Note

OAuthHeadersProvider lives in headers_provider.go alongside HeadersProvider/StaticHeadersProvider (added in #495), since it depends on oauth.go in this PR. Rebased on the updated #495/#494, which dropped StreamParams.Token and the unused TokenProvider layer; the README's transport blurb describes auth coming from StreamParams.HeadersProvider.

@zlata-stefanovic-db zlata-stefanovic-db self-assigned this Jul 13, 2026
@zlata-stefanovic-db zlata-stefanovic-db force-pushed the purego-auth-cache branch 2 times, most recently from 1be9430 to 91838e1 Compare July 13, 2026 10:33
@zlata-stefanovic-db zlata-stefanovic-db force-pushed the purego-oauth-provider branch 2 times, most recently from 393067d to d680b28 Compare July 13, 2026 15:49
@zlata-stefanovic-db zlata-stefanovic-db force-pushed the purego-auth-cache branch 2 times, most recently from 39031f4 to 5c701b0 Compare July 14, 2026 09:46
@zlata-stefanovic-db zlata-stefanovic-db force-pushed the purego-oauth-provider branch 3 times, most recently from acbbfea to 194d670 Compare July 14, 2026 12:43
@zlata-stefanovic-db zlata-stefanovic-db force-pushed the purego-oauth-provider branch 2 times, most recently from f4295e7 to 3fa080c Compare July 15, 2026 08:12
Add OAuthTokenProvider (Unity Catalog OAuth 2.0 client-credentials flow with
downscoped per-table tokens, proactive refresh, and endpoint/table validation)
and OAuthHeadersProvider bridging it to the transport headers-provider hook.
Treat all 4xx token responses as non-retryable and anchor cached TTL at
response receipt, matching the Rust SDK.

Signed-off-by: Zlata Stefanovic <zlata.stefanovic@databricks.com>
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.

1 participant