You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/05/29 21:59:08 UTC

[GitHub] [iceberg] bryanck commented on a diff in pull request #4896: Core: Add Basic auth for client credentials flow

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:
   It seems like this will put the credential as a basic auth header, but `clientCredentialsRequest()` already puts it in the payload so it is really needed?



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org