You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/09/15 16:34:59 UTC

[GitHub] [nifi] exceptionfactory commented on a diff in pull request #6401: NIFI-10444 FetchDropbox

exceptionfactory commented on code in PR #6401:
URL: https://github.com/apache/nifi/pull/6401#discussion_r972208934


##########
nifi-nar-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/main/java/org/apache/nifi/processors/dropbox/DropboxTrait.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.nifi.processors.dropbox;
+
+import com.dropbox.core.DbxRequestConfig;
+import com.dropbox.core.http.StandardHttpRequestor;
+import com.dropbox.core.oauth.DbxCredential;
+import com.dropbox.core.v2.DbxClientV2;
+import java.net.Proxy;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.dropbox.credentials.service.DropboxCredentialDetails;
+import org.apache.nifi.dropbox.credentials.service.DropboxCredentialService;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.proxy.ProxyConfiguration;
+
+public interface DropboxTrait {
+
+    PropertyDescriptor CREDENTIAL_SERVICE = new PropertyDescriptor.Builder()
+            .name("dropbox-credential-service")
+            .displayName("Dropbox Credential Service")
+            .description("Controller Service used to obtain Dropbox credentials." +
+                    " See controller service's usage documentation for more details.")
+            .identifiesControllerService(DropboxCredentialService.class)
+            .required(true)
+            .build();
+
+    default DbxClientV2 getDropboxApiClient(ProcessContext context, ProxyConfiguration proxyConfiguration, String clientId) {
+        Proxy proxy = proxyConfiguration.createProxy();
+        StandardHttpRequestor.Config requesterConfig = StandardHttpRequestor.Config.builder()
+                .withProxy(proxy)

Review Comment:
   The `StandardHttpRequestor` relies on the Java `HttpURLConnection`, which does not support parameterized Proxy Authorization, as @turcsanyip noted.
   
   It might be better to go forward without proxy support for now, but follow up in a separate issue that leverages a different DropBox `HttpRequestor` implementation. There is an implementation based on OkHttp 3, but this might be an opportunity to leverage the NiFi `WebClientServiceProvider` Controller Service and create an `HttpRequestor` based on that approach. That would have the advantage of incorporating and abstracting custom TLS and Proxy configuration.



-- 
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: issues-unsubscribe@nifi.apache.org

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