rdblue commented on code in PR #4896:
URL: https://github.com/apache/iceberg/pull/4896#discussion_r884331728
##########
core/src/main/java/org/apache/iceberg/rest/auth/OAuth2Util.java:
##########
@@ -144,8 +148,19 @@ public static OAuthTokenResponse fetchToken(RESTClient
client, Map<String, Strin
Map<String, String> request = clientCredentialsRequest(
credential, scope != null ? ImmutableList.of(scope) :
ImmutableList.of());
+ Map<String, String> requestHeaders;
+ if (headers.containsKey(AUTHORIZATION_HEADER)) {
+ requestHeaders = headers;
+ } else {
+ String credentialAsBase64 =
Base64.getEncoder().encodeToString(credential.getBytes(StandardCharsets.UTF_8));
+ requestHeaders = ImmutableMap.<String, String>builder()
+ .putAll(headers)
+ .put(AUTHORIZATION_HEADER, BASIC_PREFIX + credentialAsBase64)
Review Comment:
I thought that you said we preferred to use the Basic header, so I added it.
I didn't remove the ID and secret from the payload because it is used in some
cases, like when there is a Bearer token that needs to be passed in
Authorization for the catalog. We can do whatever you think is right here.
--
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]