[GitHub] nifi pull request #2704: NIFI-4199: Consistent proxy support across componen...
Github user asfgit closed the pull request at: https://github.com/apache/nifi/pull/2704 ---
[GitHub] nifi pull request #2704: NIFI-4199: Consistent proxy support across componen...
Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2704#discussion_r189200480 --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java --- @@ -92,6 +94,23 @@ .addValidator(StandardValidators.PORT_VALIDATOR) .build(); +public static final PropertyDescriptor PROXY_USERNAME = new PropertyDescriptor.Builder() +.name("Proxy Username") +.description("Proxy username") +.expressionLanguageSupported(true) +.required(false) +.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) +.build(); + +public static final PropertyDescriptor PROXY_PASSWORD = new PropertyDescriptor.Builder() +.name("Proxy Password") --- End diff -- I will update it. ---
[GitHub] nifi pull request #2704: NIFI-4199: Consistent proxy support across componen...
Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2704#discussion_r189200370 --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestListS3.java --- @@ -311,5 +312,10 @@ public void testGetPropertyDescriptors() throws Exception { assertTrue(pd.contains(ListS3.PREFIX)); assertTrue(pd.contains(ListS3.USE_VERSIONS)); assertTrue(pd.contains(ListS3.MIN_AGE)); + assertTrue(pd.contains(ProxyConfigurationService.PROXY_CONFIGURATION_SERVICE)); +assertTrue(pd.contains(ListS3.PROXY_HOST)); --- End diff -- @jvwing Good catch, thanks. I removed the duplicated PROXY_HOST and PROXY_HOST_PORT. The missing one was LIST_TYPE. So, 17 + 3 = 20. 3 additions are PROXY_USER, PROXY_PASS and LIST_TYPE. ---
[GitHub] nifi pull request #2704: NIFI-4199: Consistent proxy support across componen...
Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2704#discussion_r189200453 --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java --- @@ -92,6 +94,23 @@ .addValidator(StandardValidators.PORT_VALIDATOR) .build(); +public static final PropertyDescriptor PROXY_USERNAME = new PropertyDescriptor.Builder() +.name("Proxy Username") --- End diff -- I will update it. ---
[GitHub] nifi pull request #2704: NIFI-4199: Consistent proxy support across componen...
Github user jvwing commented on a diff in the pull request: https://github.com/apache/nifi/pull/2704#discussion_r189164826 --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestListS3.java --- @@ -311,5 +312,10 @@ public void testGetPropertyDescriptors() throws Exception { assertTrue(pd.contains(ListS3.PREFIX)); assertTrue(pd.contains(ListS3.USE_VERSIONS)); assertTrue(pd.contains(ListS3.MIN_AGE)); + assertTrue(pd.contains(ProxyConfigurationService.PROXY_CONFIGURATION_SERVICE)); +assertTrue(pd.contains(ListS3.PROXY_HOST)); --- End diff -- Minor tweak: The check for PROXY_HOST and PROXY_HOST_PORT duplicates checks above on lines 309-310. I believe this is why we add 5 lines of new assertions, but the count of property descriptors only goes up by 3 from 17 to 20. It doesn't make any difference, really, but the math was bothering me. ---
[GitHub] nifi pull request #2704: NIFI-4199: Consistent proxy support across componen...
Github user jvwing commented on a diff in the pull request: https://github.com/apache/nifi/pull/2704#discussion_r189164994 --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java --- @@ -92,6 +94,23 @@ .addValidator(StandardValidators.PORT_VALIDATOR) .build(); +public static final PropertyDescriptor PROXY_USERNAME = new PropertyDescriptor.Builder() +.name("Proxy Username") +.description("Proxy username") +.expressionLanguageSupported(true) +.required(false) +.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) +.build(); + +public static final PropertyDescriptor PROXY_PASSWORD = new PropertyDescriptor.Builder() +.name("Proxy Password") --- End diff -- I recommend a separate `name` vs `displayName` for PROXY_PASSWORD. ---
[GitHub] nifi pull request #2704: NIFI-4199: Consistent proxy support across componen...
Github user jvwing commented on a diff in the pull request: https://github.com/apache/nifi/pull/2704#discussion_r189164964 --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java --- @@ -92,6 +94,23 @@ .addValidator(StandardValidators.PORT_VALIDATOR) .build(); +public static final PropertyDescriptor PROXY_USERNAME = new PropertyDescriptor.Builder() +.name("Proxy Username") --- End diff -- I recommend a separate `name` vs `displayName` for PROXY_USERNAME. ---
[GitHub] nifi pull request #2704: NIFI-4199: Consistent proxy support across componen...
Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2704#discussion_r188823744 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java --- @@ -418,6 +424,23 @@ protected ChannelSftp getChannel(final FlowFile flowFile) throws IOException { ctx.getProperty(HOSTNAME).evaluateAttributeExpressions(flowFile).getValue(), ctx.getProperty(PORT).evaluateAttributeExpressions(flowFile).asInteger().intValue()); +final ProxyConfiguration proxyConfig = ProxyConfiguration.getConfiguration(ctx, createComponentProxyConfigSupplier(ctx)); +switch (proxyConfig.getProxyType()) { +case HTTP: +final ProxyHTTP proxyHTTP = new ProxyHTTP(proxyConfig.getProxyServerHost(), proxyConfig.getProxyServerPort()); +// Check if Username is set and populate the proxy accordingly +if (proxyConfig.hasCredential()) { + proxyHTTP.setUserPasswd(proxyConfig.getProxyUserName(), proxyConfig.getProxyUserPassword()); +} +session.setProxy(proxyHTTP); +break; +case SOCKS: +final ProxySOCKS5 proxySOCKS5 = new ProxySOCKS5(proxyConfig.getProxyServerHost(), proxyConfig.getProxyServerPort()); +session.setProxy(proxySOCKS5); --- End diff -- @jugi92 Thanks! I actually didn't know SOCKS protocol supports user authentication.. It seems SFTP processors (thanks to the underlying jsch) support that. I've added your suggestion and confirmed with Dante SOCKS server with authentication. https://gist.github.com/ijokarumawak/b3a31378bdc0a6c6b9922a138e9ec9c1 I will update this PR shortly. ---
[GitHub] nifi pull request #2704: NIFI-4199: Consistent proxy support across componen...
Github user jugi92 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2704#discussion_r188536236 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java --- @@ -418,6 +424,23 @@ protected ChannelSftp getChannel(final FlowFile flowFile) throws IOException { ctx.getProperty(HOSTNAME).evaluateAttributeExpressions(flowFile).getValue(), ctx.getProperty(PORT).evaluateAttributeExpressions(flowFile).asInteger().intValue()); +final ProxyConfiguration proxyConfig = ProxyConfiguration.getConfiguration(ctx, createComponentProxyConfigSupplier(ctx)); +switch (proxyConfig.getProxyType()) { +case HTTP: +final ProxyHTTP proxyHTTP = new ProxyHTTP(proxyConfig.getProxyServerHost(), proxyConfig.getProxyServerPort()); +// Check if Username is set and populate the proxy accordingly +if (proxyConfig.hasCredential()) { + proxyHTTP.setUserPasswd(proxyConfig.getProxyUserName(), proxyConfig.getProxyUserPassword()); +} +session.setProxy(proxyHTTP); +break; +case SOCKS: +final ProxySOCKS5 proxySOCKS5 = new ProxySOCKS5(proxyConfig.getProxyServerHost(), proxyConfig.getProxyServerPort()); +session.setProxy(proxySOCKS5); --- End diff -- can we add: ` if (proxyConfig.hasCredential()) { socksProxy.setUserPasswd(proxyConfig.getProxyUserName(), proxyConfig.getProxyUserPassword()); } ` ---
[GitHub] nifi pull request #2704: NIFI-4199: Consistent proxy support across componen...
GitHub user ijokarumawak opened a pull request: https://github.com/apache/nifi/pull/2704 NIFI-4199: Consistent proxy support across components - Added ProxyConfigurationService to manage centralized proxy configurations - Adopt ProxyConfigurationService at FTP and HTTP processors Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Is your initial contribution a single, squashed commit? ### For code changes: - [x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [x] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [x] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/ijokarumawak/nifi nifi-4199 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2704.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2704 commit 7c890e97977b5f956d53a48e19dbd3e580a8f664 Author: Koji Kawamura Date: 2018-05-15T05:52:39Z NIFI-4199: Consistent proxy support across components - Added ProxyConfigurationService to manage centralized proxy configurations - Adopt ProxyConfigurationService at FTP and HTTP processors ---