[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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <imaxon@uci.edu>
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 29e04e9..3144489 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.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 @@
} 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) {