adutra commented on code in PR #12415:
URL: https://github.com/apache/iceberg/pull/12415#discussion_r1974012751
##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -258,7 +258,9 @@ public void initialize(String name, Map<String, String>
unresolved) {
config = fetchConfig(initClient, authHeaders, props);
} else {
authResponse = null;
- config = fetchConfig(initClient, initHeaders, props);
+ Map<String, String> authHeaders =
Review Comment:
Hmm actually, I'm not sure I agree that there is an error here.
The init session is created with the the `initToken`:
```java
DefaultAuthSession initSession =
DefaultAuthSession.of(HTTPHeaders.of(OAuth2Util.authHeaders(initToken))
```
Then the `initClient` is created with the `initSession`:
```java
RESTClient initClient =
clientBuilder.apply(props).withAuthSession(initSession)
```
So when you arrive at line 261, the `initClient` already contains the
authorization header with `initToken`:
```java
config = fetchConfig(initClient, initHeaders, props);
```
This is being tested e.g. in
`org.apache.iceberg.rest.TestRESTCatalog#testCatalogBasicBearerToken`: you can
easily observe with a debug breakpoint that `initHeaders` is indeed empty, but
when the request is executed, the `Authorization` header is added by the
`AuthSession`.
Do you have a simple reproducer for the bug you are seeing?
--
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]