You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2022/03/08 03:37:51 UTC

[GitHub] [drill] cgivre opened a new pull request #2486: DRILL-8161: Add Global Credentials to HTTP Storage Plugin

cgivre opened a new pull request #2486:
URL: https://github.com/apache/drill/pull/2486


   # [DRILL-8161](https://issues.apache.org/jira/browse/DRILL-8161): Add Global Credentials to HTTP Storage Plugin
   
   ## Description
   Currently, Drill forces to you set username and passwords individually for every API endpoint in a http storage plugin.  This PR allows you to set global credentials which will be used for all endpoints in a given HTTP storage plugin instance.
   
   ## Documentation
   Users can now add a credential provider to an HTTP Storage Plugin configuration and these credentials will be applied to every endpoint in that instance.  However, if credentials are supplied in an endpoint, those credentials override the global credentials. 
   
   ## Testing
   Added assertions to existing unit tests to make sure that the correct credentials are going to the connection. 


-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [drill] cgivre commented on a change in pull request #2486: DRILL-8161: Add Global Credentials to HTTP Storage Plugin

Posted by GitBox <gi...@apache.org>.
cgivre commented on a change in pull request #2486:
URL: https://github.com/apache/drill/pull/2486#discussion_r822716760



##########
File path: exec/java-exec/src/main/java/org/apache/drill/exec/store/security/UsernamePasswordWithProxyCredentials.java
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.drill.exec.store.security;
+
+import org.apache.drill.common.logical.security.CredentialsProvider;
+import org.apache.drill.exec.store.security.oauth.OAuthTokenCredentials;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class UsernamePasswordWithProxyCredentials extends UsernamePasswordCredentials {
+  private final String proxyUsername;
+  private final String proxyPassword;
+
+  public UsernamePasswordWithProxyCredentials(CredentialsProvider credentialsProvider) {
+    super(credentialsProvider);
+    if (credentialsProvider == null) {

Review comment:
       Fixed




-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [drill] luocooong commented on a change in pull request #2486: DRILL-8161: Add Global Credentials to HTTP Storage Plugin

Posted by GitBox <gi...@apache.org>.
luocooong commented on a change in pull request #2486:
URL: https://github.com/apache/drill/pull/2486#discussion_r822702168



##########
File path: exec/java-exec/src/main/java/org/apache/drill/exec/store/security/UsernamePasswordWithProxyCredentials.java
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.drill.exec.store.security;
+
+import org.apache.drill.common.logical.security.CredentialsProvider;
+import org.apache.drill.exec.store.security.oauth.OAuthTokenCredentials;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class UsernamePasswordWithProxyCredentials extends UsernamePasswordCredentials {
+  private final String proxyUsername;
+  private final String proxyPassword;
+
+  public UsernamePasswordWithProxyCredentials(CredentialsProvider credentialsProvider) {
+    super(credentialsProvider);
+    if (credentialsProvider == null) {

Review comment:
       ```suggestion
       if (credentialsProvider == null || credentialsProvider.getCredentials() == null) {
         this.proxyUsername = null;
         this.proxyPassword = null;
       } else {
         this.proxyUsername = credentialsProvider.getCredentials().get(OAuthTokenCredentials.PROXY_USERNAME);
         this.proxyPassword = credentialsProvider.getCredentials().get(OAuthTokenCredentials.PROXY_PASSWORD);
       }
   ```

##########
File path: exec/java-exec/src/main/java/org/apache/drill/exec/store/security/CredentialProviderUtils.java
##########
@@ -65,6 +67,8 @@ public static CredentialsProvider getCredentialsProvider(
     String tokenURI,
     String username,
     String password,
+    String proxyUserName,

Review comment:
       We use `proxyUsername` elsewhere.




-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [drill] cgivre commented on pull request #2486: DRILL-8161: Add Global Credentials to HTTP Storage Plugin

Posted by GitBox <gi...@apache.org>.
cgivre commented on pull request #2486:
URL: https://github.com/apache/drill/pull/2486#issuecomment-1062984407


   > LGTM. +1
   > There are small suggestions above, but will not be blockers.
   
   Thanks @luocooong   I'll make those changes and merge.


-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [drill] cgivre commented on a change in pull request #2486: DRILL-8161: Add Global Credentials to HTTP Storage Plugin

Posted by GitBox <gi...@apache.org>.
cgivre commented on a change in pull request #2486:
URL: https://github.com/apache/drill/pull/2486#discussion_r822715525



##########
File path: exec/java-exec/src/main/java/org/apache/drill/exec/store/security/CredentialProviderUtils.java
##########
@@ -65,6 +67,8 @@ public static CredentialsProvider getCredentialsProvider(
     String tokenURI,
     String username,
     String password,
+    String proxyUserName,

Review comment:
       Fixed.




-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [drill] cgivre merged pull request #2486: DRILL-8161: Add Global Credentials to HTTP Storage Plugin

Posted by GitBox <gi...@apache.org>.
cgivre merged pull request #2486:
URL: https://github.com/apache/drill/pull/2486


   


-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org