You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2023/06/14 01:18:49 UTC

[asterixdb] 12/14: [NO ISSUE][EXT]: Explicitly set no credentials auth when anonymous auth is used

This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 64d5d66b1c7fa5acb521433cfe9d8ba4eeca754f
Author: Hussain Towaileb <Hu...@couchbase.com>
AuthorDate: Thu Jun 8 20:11:39 2023 +0300

    [NO ISSUE][EXT]: Explicitly set no credentials auth when anonymous auth is used
    
    Change-Id: Id6fc37fb53a8bc944816a782a4119feaf59db725
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17593
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Ian Maxon <im...@uci.edu>
---
 .../java/org/apache/asterix/external/util/ExternalDataUtils.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
index 29e04e9904..31444899ad 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
@@ -150,6 +150,7 @@ import com.azure.storage.file.datalake.models.ListPathsOptions;
 import com.azure.storage.file.datalake.models.PathItem;
 import com.google.api.gax.paging.Page;
 import com.google.auth.oauth2.GoogleCredentials;
+import com.google.cloud.NoCredentials;
 import com.google.cloud.storage.Blob;
 import com.google.cloud.storage.Storage;
 import com.google.cloud.storage.StorageOptions;
@@ -1883,15 +1884,14 @@ public class ExternalDataUtils {
                 } catch (IOException ex) {
                     throw CompilationException.create(EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
                 }
-            }
-
-            // json credentials
-            if (jsonCredentials != null) {
+            } else if (jsonCredentials != null) {
                 try (InputStream credentialsStream = new ByteArrayInputStream(jsonCredentials.getBytes())) {
                     builder.setCredentials(GoogleCredentials.fromStream(credentialsStream));
                 } catch (IOException ex) {
                     throw new CompilationException(EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
                 }
+            } else {
+                builder.setCredentials(NoCredentials.getInstance());
             }
 
             if (endpoint != null) {