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.


---

Reply via email to