bryanck commented on code in PR #4896:
URL: https://github.com/apache/iceberg/pull/4896#discussion_r884344954
##########
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 see, thanks for the context. If you need to keep it in the payload anyway,
then I'd vote to not add the header also. The spec wording seemed more about
avoiding putting it in the payload.
--
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]