Make presto jdbc driver support Google OAuth private key handling
package com.facebook.presto.jdbc;
import com.facebook.presto.client.ClientException;
+import com.facebook.presto.client.GCSOAuthInterceptor;
+import com.facebook.presto.client.OkHttpUtil;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
@@ -193,6 +195,10 @@ final class PrestoDriverUri
.orElseGet(() -> defaultCredentialCachePath().map(File::new).orElse(null))));
}
+ Map<String, String> extraCredentials = EXTRA_CREDENTIALS.getValue(properties).orElse(ImmutableMap.of());
+ Optional.ofNullable(extraCredentials.get(GCSOAuthInterceptor.GCS_CREDENTIALS_PATH_KEY))
+ .ifPresent(credentialPath -> OkHttpUtil.setupGCSOauth(builder, credentialPath));
+
if (ACCESS_TOKEN.getValue(properties).isPresent()) {
if (!useSecureConnection) {
throw new SQLException("Authentication using an access token requires SSL to be enabled");
