[ 
https://issues.apache.org/jira/browse/NIFI-5282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16598618#comment-16598618
 ] 

ASF GitHub Bot commented on NIFI-5282:
--------------------------------------

Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2943#discussion_r214253235
  
    --- Diff: 
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/credentials/factory/strategies/AbstractServiceAccountCredentialsStrategy.java
 ---
    @@ -36,7 +43,24 @@ public AbstractServiceAccountCredentialsStrategy(String 
name, PropertyDescriptor
     
         @Override
         public GoogleCredentials getGoogleCredentials(Map<PropertyDescriptor, 
String> properties) throws IOException {
    -        return 
GoogleCredentials.fromStream(getServiceAccountJson(properties));
    +        final String proxyHost = 
properties.get(CredentialPropertyDescriptors.PROXY_HOST);
    +        final String proxyPortString = 
properties.get(CredentialPropertyDescriptors.PROXY_PORT);
    +        final Integer proxyPort = (proxyPortString != null && 
proxyPortString.matches("-?\\d+")) ?
    +                Integer.parseInt(proxyPortString) : 0;
    +
    +        if (!StringUtils.isBlank(proxyHost) && proxyPort > 0) {
    +            return 
GoogleCredentials.fromStream(getServiceAccountJson(properties),
    +                    new HttpTransportFactory() {
    +                        @Override
    +                        public HttpTransport create() {
    +                            return new NetHttpTransport.Builder()
    +                                    .setProxy(new Proxy(Proxy.Type.HTTP, 
new InetSocketAddress(proxyHost, proxyPort)))
    +                                    .build();
    +                        }
    +                    });
    +        } else {
    +            return 
GoogleCredentials.fromStream(getServiceAccountJson(properties));
    +        }
    --- End diff --
    
    I'd implement these proxy related code at higher abstraction layer. Will 
update it at the new PR.


> GCPProcessor with HTTP Proxy with Authentication
> ------------------------------------------------
>
>                 Key: NIFI-5282
>                 URL: https://issues.apache.org/jira/browse/NIFI-5282
>             Project: Apache NiFi
>          Issue Type: Improvement
>    Affects Versions: 1.6.0
>            Reporter: Julian Gimbel
>            Assignee: Sivaprasanna Sethuraman
>            Priority: Minor
>
> The [AbstractGCPProcessor 
> |https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/AbstractGCPProcessor.java]
>  already accepts http proxy settings but it but be even better if it accepts 
> authenticated proxies with user and password aswell.
> In the best case it would support the ProxyService introduced in 
> [NIFI-4199|https://issues.apache.org/jira/projects/NIFI/issues/NIFI-4199] and 
> all of its options.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to