steveloughran commented on a change in pull request #1419: DRILL-6662: Access 
AWS access key ID and secret access key using Cred…
URL: https://github.com/apache/drill/pull/1419#discussion_r207686889
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
 ##########
 @@ -104,6 +108,31 @@ public FileSystemPlugin(FileSystemConfig config, 
DrillbitContext context, String
     }
   }
 
+  private boolean isS3() {
+    java.net.URI uri = FileSystem.getDefaultUri(fsConf);
+    return uri.getScheme().equals("s3a");
+  }
+
+  /**
+   * Retrieve secret and access keys from configured (with
+   * {@link 
org.apache.hadoop.security.alias.CredentialProviderFactory#CREDENTIAL_PROVIDER_PATH}
 property)
+   * credential providers and set it into {@link #fsConf}. If provider path is 
not configured or credential
+   * is absent in providers, it will conditionally fallback to configuration 
setting. The fallback will occur unless
+   * {@link 
org.apache.hadoop.security.alias.CredentialProvider#CLEAR_TEXT_FALLBACK} is set 
to false.
+   * @throws IOException thrown if a credential cannot be retrieved from 
provider
+   */
+  private void handleS3Credentials() throws IOException {
+    final String[] credentialKeys = {"fs.s3a.secret.key", "fs.s3a.access.key"};
+    for (String key : credentialKeys) {
+      char[] credentialChars = fsConf.getPassword(key);
+      if (credentialChars != null) {
+        fsConf.set(key, String.valueOf(credentialChars));
 
 Review comment:
   s3a connector actually calls trim() on the created string, so that you can 
have some whitespace around any inline declaration. Worth retaining for 
consistency

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to