lovromazgon commented on code in PR #801:
URL: https://github.com/apache/iceberg-go/pull/801#discussion_r2955575572


##########
catalog/rest/auth.go:
##########
@@ -32,12 +36,68 @@ type AuthManager interface {
        AuthHeader() (string, string, error)
 }
 
+// AuthHeaderContext is an optional interface that an AuthManager may
+// implement to support context-aware auth header retrieval. When the
+// session transport calls AuthHeader, it will prefer this method if
+// available, passing the request context so that token fetches can
+// be cancelled.
+type AuthHeaderContext interface {
+       AuthHeaderCtx(ctx context.Context) (string, string, error)
+}
+
+// AuthRefresher is an optional interface that an AuthManager may implement
+// to support refreshing credentials when authentication fails. When the
+// session transport receives a 401, 403, or 419 response and the auth
+// manager implements this interface, it will call RefreshAuth and retry
+// the request once with the new credentials.
+type AuthRefresher interface {
+       // RefreshAuth forces a credential refresh, discarding any cached
+       // tokens. After a successful refresh, AuthHeader will return the
+       // new credentials.
+       RefreshAuth(ctx context.Context) error
+}

Review Comment:
   Note that the `AuthHeaderContext` and `AuthRefresher` interfaces were added 
simply to keep `AuthManager` backward compatible. However, if the maintainers 
are open to changing `AuthManager` I could collapse the other interfaces into 
it and simplify the code a bit.



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