bryanck commented on code in PR #4896:
URL: https://github.com/apache/iceberg/pull/4896#discussion_r884329312
##########
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:
This will put the credential as a basic auth header, but
`clientCredentialsRequest()` already puts it in the payload so it is really
needed here? We just need it in one or the other per the spec IIRC.
--
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]