adutra commented on issue #18880:
URL: https://github.com/apache/iceberg/issues/18880#issuecomment-6859778119

   Thanks for the detailed write-up @Simanchal-Liveramp! The use case makes 
sense, but how to achieve it depends on where you want the token exchange to 
happen. 
   
   Two setups can be considered:
   
   1. The exchange happens outside Iceberg: use `rest.auth.type=bearer`. A 
producer (e.g. a sidecar) performs the RFC 8693 exchange and writes the access 
token to a file, which Iceberg re-reads periodically. The producer owns the 
refresh schedule and writes a new token ahead of expiry, which is the whole 
point of this design. If the catalog validates the projected service account 
token directly, that file can even be used as is, without any exchange. 
Otherwise, you could write a small sidecar that reads the projected service 
account token file, does the exchange, and writes the resulting token to 
another file.
   2. The exchange happens inside Iceberg: ideally, use 
`rest.auth.type=oauth2`. Fetching a token, refreshing it based on its expiry 
and retrying are exactly what an OAuth2 client does. The bearer manager 
deliberately never contacts an authorization server or performs an OAuth2 
grant. Unfortunately, this is not possible today, but sounds like a good 
enhancement for the new OAuth2 manager v2 (#18756), once it lands.
   
   I'd rather not add a pluggable token provider API at this point.
   
   As for reacting to a 401, that needs a hook in AuthSession that doesn't 
exist yet. It's proposed in #14241, and would benefit all auth managers.
   
   If you go with option 1 above, the Bearer AuthManager is all you need.
   
   If you'd rather have option 2, would you be OK with reframing this issue as 
"OAuth2: support token exchange with a subject token file (workload identity)"?


-- 
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