Revanth14 opened a new pull request, #2433:
URL: https://github.com/apache/iceberg-go/pull/2433

   ## Problem
   
   `Oauth2AuthManager` handles token caching, refresh and OAuth error mapping, 
but it can only be created internally, so callers with their own 
`oauth2.TokenSource` have to reimplement it. Google's BigLake REST catalog is 
the motivating case: it needs Application Default Credentials or 
service-account tokens, which the client-credentials flow can't produce.
   
   ## Fix
   
   Export `NewOauth2AuthManager(ts oauth2.TokenSource)`. Like 
`oauth2.NewClient`, it wraps `ts` in `oauth2.ReuseTokenSource`, so `ts` is 
called only when the cached token is missing or expired, and it panics on a nil 
source. The doc comment covers how refreshes through an external source are 
bounded, and `configuration.md` gets a BigLake example using 
`google.DefaultTokenSource` and the `x-goog-user-project` header from #921.
   
   ## Testing
   
   Unit tests cover token reuse and refresh, the header's token type, 
`*oauth2.RetrieveError` mapping to `ErrOAuthError`, a canceled context skipping 
the source, the nil-source panic, and catalog requests authenticated through an 
`httptest` REST server. Not tested end to end against BigLake.
   
   ## Context
   
   Part of #2428. The follow-up, a `GoogleAuthManager` selected by 
`rest.auth.type=google` as in Java and PyIceberg, needs maintainer input on the 
issue first. This supersedes the approach in #703 (closed by its author) with a 
smaller, cloud-neutral change. Related: #532, #921.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to