Skip to content

Commit ccd4560

Browse files
committed
nit
1 parent bc55edf commit ccd4560

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcOAuthUtility.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,6 @@ static GoogleCredentials getCredentials(
295295
throw new IllegalStateException(OAUTH_TYPE_ERROR_MESSAGE);
296296
}
297297

298-
if (reqGoogleDriveScopeBool) {
299-
credentials = credentials.createScoped(BIGQUERY_WITH_DRIVE_SCOPES);
300-
LOG.fine("Added Google Drive read-only scope centrally to GoogleCredentials.");
301-
}
302-
303298
return getServiceAccountImpersonatedCredentials(
304299
credentials, reqGoogleDriveScopeBool, authProperties);
305300
}
@@ -616,7 +611,6 @@ private static GoogleCredentials getExternalAccountAuthCredentials(
616611
}
617612
}
618613

619-
GoogleCredentials credentials;
620614
if (credentialsPath != null) {
621615
return ExternalAccountCredentials.fromStream(
622616
Files.newInputStream(Paths.get(credentialsPath)));
@@ -644,6 +638,10 @@ private static GoogleCredentials getServiceAccountImpersonatedCredentials(
644638
String impersonationEmail =
645639
authProperties.get(BigQueryJdbcUrlUtility.OAUTH_SA_IMPERSONATION_EMAIL_PROPERTY_NAME);
646640
if (impersonationEmail == null || impersonationEmail.isEmpty()) {
641+
if (reqGoogleDriveScopeBool) {
642+
credentials = credentials.createScoped(BIGQUERY_WITH_DRIVE_SCOPES);
643+
LOG.fine("Added Google Drive read-only scope to GoogleCredentials.");
644+
}
647645
return credentials;
648646
}
649647

0 commit comments

Comments
 (0)