joyhaldar commented on code in PR #14447:
URL: https://github.com/apache/iceberg/pull/14447#discussion_r2631048986


##########
bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreClientImpl.java:
##########
@@ -127,9 +128,21 @@ public BigQueryMetastoreClientImpl(BigQueryOptions options)
       throws IOException, GeneralSecurityException {
     // Initialize client that will be used to send requests. This client only 
needs to be created
     // once, and can be reused for multiple requests
-    HttpCredentialsAdapter httpCredentialsAdapter =
-        new HttpCredentialsAdapter(
-            
GoogleCredentials.getApplicationDefault().createScoped(BigqueryScopes.all()));
+
+    // Get credentials from options, or use application default
+    GoogleCredentials credentials =
+        (options.getCredentials() instanceof GoogleCredentials)
+            ? (GoogleCredentials) options.getCredentials()
+            : GoogleCredentials.getApplicationDefault();
+
+    // Scope credentials unless already scoped (e.g., ImpersonatedCredentials)
+    GoogleCredentials scopedCredentials =
+        (credentials instanceof ImpersonatedCredentials)
+            ? credentials
+            : credentials.createScoped(BigqueryScopes.all());

Review Comment:
   I have moved scoping logic to BigQueryProperties.metastoreOptions().
   



-- 
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]

Reply via email to