[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15856355#comment-15856355 ] Karthik Narayanan commented on NIFI-2162: - I am encountering this issue. looks there has not been an updated on okhttp-digest. The first message with digest auth succeeds and the subsequent ones fail. Looks the line that causes the issue is this https://github.com/rburgst/okhttp-digest/blob/master/src/main/java/com/burgstaller/okhttp/AuthenticationCacheInterceptor.java#L51 I think we can do a quick duck tape fix to this by implementing the AuthenticationCacheInterceptor right inside invokehttp , basically a copy of the code in the version above - the platform.get().log() line. I have a feeling thats all it needs. thoughts? > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15856936#comment-15856936 ] Joseph Percivall commented on NIFI-2162: This issue has been fixed in okhttp-digest but in order to utilize it, we'd have to upgrade OkHttp to version 3. Since it's a major release (v2 -> v3) they changed up the API a bit so it's a bit more in-depth than just incrementing the version. > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16079188#comment-16079188 ] Bill Oates commented on NIFI-2162: -- Hello - can I upvote this issue please? I've invested massively in a set of NiFi workflows (I had to do a serious sales-pitch to my boss) that have reached a stopping point due to this bug! Thanks! > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16080557#comment-16080557 ] Joseph Percivall commented on NIFI-2162: Hello [~wpoates1], yeah we should have fixed this already. I'll have a PR submitted by next Monday > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16085097#comment-16085097 ] ASF GitHub Bot commented on NIFI-2162: -- GitHub user JPercivall opened a pull request: https://github.com/apache/nifi/pull/2004 NIFI-2162 Updating OkHttp to 3.8.1 and OkHttp-Digest to 1.13 and refa… …ctoring InvokeHttp to adjust for changes 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? - [X] 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)? - [X] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [X] 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: - [X] 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/JPercivall/nifi NIFI-2162 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2004.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 #2004 commit b67ca1532765e8296442e78e7d6a781bed1167d9 Author: Joe Percivall Date: 2017-07-13T03:16:15Z NIFI-2162 Updating OkHttp to 3.8.1 and OkHttp-Digest to 1.13 and refactoring InvokeHttp to adjust for changes > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16086362#comment-16086362 ] ASF GitHub Bot commented on NIFI-2162: -- Github user trkurc commented on the issue: https://github.com/apache/nifi/pull/2004 started reviewing this one > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16086665#comment-16086665 ] ASF GitHub Bot commented on NIFI-2162: -- Github user trkurc commented on a diff in the pull request: https://github.com/apache/nifi/pull/2004#discussion_r127366226 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/ProxyAuthenticator.java --- @@ -16,35 +16,28 @@ */ package org.apache.nifi.processors.standard.util; +import okhttp3.Authenticator; +import okhttp3.Credentials; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.Route; + +import javax.annotation.Nullable; import java.io.IOException; -import java.net.Proxy; -import java.util.HashMap; -import java.util.Map; -import com.burgstaller.okhttp.DispatchingAuthenticator; -import com.squareup.okhttp.Authenticator; -import com.squareup.okhttp.Credentials; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; +public class ProxyAuthenticator implements Authenticator { --- End diff -- You're changing a public class with this refactor - what version of NiFi is this targeting? I think this class is debatably part of the public API (https://cwiki.apache.org/confluence/display/NIFI/Version+Scheme+and+API+Compatibility) > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16086694#comment-16086694 ] ASF GitHub Bot commented on NIFI-2162: -- Github user trkurc commented on a diff in the pull request: https://github.com/apache/nifi/pull/2004#discussion_r127367937 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java --- @@ -500,48 +512,88 @@ public void onPropertyModified(final PropertyDescriptor descriptor, final String } @OnScheduled -public void setUpClient(final ProcessContext context) throws IOException { +public void setUpClient(final ProcessContext context) throws IOException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { okHttpClientAtomicReference.set(null); -OkHttpClient okHttpClient = new OkHttpClient(); +OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient().newBuilder(); // Add a proxy if set final String proxyHost = context.getProperty(PROP_PROXY_HOST).getValue(); final Integer proxyPort = context.getProperty(PROP_PROXY_PORT).asInteger(); if (proxyHost != null && proxyPort != null) { final Proxy proxy = new Proxy(Type.HTTP, new InetSocketAddress(proxyHost, proxyPort)); -okHttpClient.setProxy(proxy); +okHttpClientBuilder.proxy(proxy); } // Set timeouts - okHttpClient.setConnectTimeout((context.getProperty(PROP_CONNECT_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue()), TimeUnit.MILLISECONDS); - okHttpClient.setReadTimeout(context.getProperty(PROP_READ_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue(), TimeUnit.MILLISECONDS); + okHttpClientBuilder.connectTimeout((context.getProperty(PROP_CONNECT_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue()), TimeUnit.MILLISECONDS); + okHttpClientBuilder.readTimeout(context.getProperty(PROP_READ_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue(), TimeUnit.MILLISECONDS); // Set whether to follow redirects - okHttpClient.setFollowRedirects(context.getProperty(PROP_FOLLOW_REDIRECTS).asBoolean()); + okHttpClientBuilder.followRedirects(context.getProperty(PROP_FOLLOW_REDIRECTS).asBoolean()); final SSLContextService sslService = context.getProperty(PROP_SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); final SSLContext sslContext = sslService == null ? null : sslService.createSSLContext(ClientAuth.NONE); // check if the ssl context is set and add the factory if so if (sslContext != null) { - okHttpClient.setSslSocketFactory(sslContext.getSocketFactory()); +setSslSocketFactory(okHttpClientBuilder, sslService, sslContext); } // check the trusted hostname property and override the HostnameVerifier String trustedHostname = trimToEmpty(context.getProperty(PROP_TRUSTED_HOSTNAME).getValue()); if (!trustedHostname.isEmpty()) { -okHttpClient.setHostnameVerifier(new OverrideHostnameVerifier(trustedHostname, okHttpClient.getHostnameVerifier())); +okHttpClientBuilder.hostnameVerifier(new OverrideHostnameVerifier(trustedHostname, OkHostnameVerifier.INSTANCE)); } -setAuthenticator(okHttpClient, context); +setAuthenticator(okHttpClientBuilder, context); useChunked = context.getProperty(PROP_USE_CHUNKED_ENCODING).asBoolean(); -okHttpClientAtomicReference.set(okHttpClient); +okHttpClientAtomicReference.set(okHttpClientBuilder.build()); +} + +private void setSslSocketFactory(OkHttpClient.Builder okHttpClientBuilder, SSLContextService sslService, SSLContext sslContext) +throws IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException { +final String keystoreLocation = sslService.getKeyStoreFile(); +final String keystorePass = sslService.getKeyStorePassword(); +final String keystoreType = sslService.getKeyStoreType(); + +// prepare the keystore +final KeyStore keyStore = KeyStore.getInstance(keystoreType); + +try (FileInputStream keyStoreStream = new FileInputStream(keystoreLocation)) { +keyStore.load(keyStoreStream, keystorePass.toCharArray()); +} + +final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16096074#comment-16096074 ] Bill Oates commented on NIFI-2162: -- Thanks for taking a look [~JPercivall] - appreciate it. I deployed from the released version, so will need to work out how to update with the code that you've changed, but looking forward to giving it a go. Thanks! > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16120718#comment-16120718 ] ASF GitHub Bot commented on NIFI-2162: -- Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi/pull/2004#discussion_r132318357 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/ProxyAuthenticator.java --- @@ -16,35 +16,28 @@ */ package org.apache.nifi.processors.standard.util; +import okhttp3.Authenticator; +import okhttp3.Credentials; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.Route; + +import javax.annotation.Nullable; import java.io.IOException; -import java.net.Proxy; -import java.util.HashMap; -import java.util.Map; -import com.burgstaller.okhttp.DispatchingAuthenticator; -import com.squareup.okhttp.Authenticator; -import com.squareup.okhttp.Credentials; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; +public class ProxyAuthenticator implements Authenticator { --- End diff -- I was targeting 1.4.0 I understand that it's a public class but I wouldn't consider it part of the public API. Looking at the items explicitly listed that fall under the public API, the closest one I see is "Any extension such as Processor, Controller Service, Reporting Task." I see it falling outside of that though since it's not a component itself. In what way do you see it falling under the items listed as our public API? > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16120719#comment-16120719 ] ASF GitHub Bot commented on NIFI-2162: -- Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi/pull/2004#discussion_r132318693 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java --- @@ -500,48 +512,88 @@ public void onPropertyModified(final PropertyDescriptor descriptor, final String } @OnScheduled -public void setUpClient(final ProcessContext context) throws IOException { +public void setUpClient(final ProcessContext context) throws IOException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { okHttpClientAtomicReference.set(null); -OkHttpClient okHttpClient = new OkHttpClient(); +OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient().newBuilder(); // Add a proxy if set final String proxyHost = context.getProperty(PROP_PROXY_HOST).getValue(); final Integer proxyPort = context.getProperty(PROP_PROXY_PORT).asInteger(); if (proxyHost != null && proxyPort != null) { final Proxy proxy = new Proxy(Type.HTTP, new InetSocketAddress(proxyHost, proxyPort)); -okHttpClient.setProxy(proxy); +okHttpClientBuilder.proxy(proxy); } // Set timeouts - okHttpClient.setConnectTimeout((context.getProperty(PROP_CONNECT_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue()), TimeUnit.MILLISECONDS); - okHttpClient.setReadTimeout(context.getProperty(PROP_READ_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue(), TimeUnit.MILLISECONDS); + okHttpClientBuilder.connectTimeout((context.getProperty(PROP_CONNECT_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue()), TimeUnit.MILLISECONDS); + okHttpClientBuilder.readTimeout(context.getProperty(PROP_READ_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue(), TimeUnit.MILLISECONDS); // Set whether to follow redirects - okHttpClient.setFollowRedirects(context.getProperty(PROP_FOLLOW_REDIRECTS).asBoolean()); + okHttpClientBuilder.followRedirects(context.getProperty(PROP_FOLLOW_REDIRECTS).asBoolean()); final SSLContextService sslService = context.getProperty(PROP_SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); final SSLContext sslContext = sslService == null ? null : sslService.createSSLContext(ClientAuth.NONE); // check if the ssl context is set and add the factory if so if (sslContext != null) { - okHttpClient.setSslSocketFactory(sslContext.getSocketFactory()); +setSslSocketFactory(okHttpClientBuilder, sslService, sslContext); } // check the trusted hostname property and override the HostnameVerifier String trustedHostname = trimToEmpty(context.getProperty(PROP_TRUSTED_HOSTNAME).getValue()); if (!trustedHostname.isEmpty()) { -okHttpClient.setHostnameVerifier(new OverrideHostnameVerifier(trustedHostname, okHttpClient.getHostnameVerifier())); +okHttpClientBuilder.hostnameVerifier(new OverrideHostnameVerifier(trustedHostname, OkHostnameVerifier.INSTANCE)); } -setAuthenticator(okHttpClient, context); +setAuthenticator(okHttpClientBuilder, context); useChunked = context.getProperty(PROP_USE_CHUNKED_ENCODING).asBoolean(); -okHttpClientAtomicReference.set(okHttpClient); +okHttpClientAtomicReference.set(okHttpClientBuilder.build()); +} + +private void setSslSocketFactory(OkHttpClient.Builder okHttpClientBuilder, SSLContextService sslService, SSLContext sslContext) +throws IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException { +final String keystoreLocation = sslService.getKeyStoreFile(); +final String keystorePass = sslService.getKeyStorePassword(); +final String keystoreType = sslService.getKeyStoreType(); + +// prepare the keystore +final KeyStore keyStore = KeyStore.getInstance(keystoreType); + +try (FileInputStream keyStoreStream = new FileInputStream(keystoreLocation)) { +keyStore.load(keyStoreStream, keystorePass.toCharArray()); +} + +final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInst
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16120720#comment-16120720 ] ASF GitHub Bot commented on NIFI-2162: -- Github user JPercivall commented on the issue: https://github.com/apache/nifi/pull/2004 Thanks for the review @trkurc and sorry for the delay in my responses. > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16160200#comment-16160200 ] ASF GitHub Bot commented on NIFI-2162: -- Github user JPercivall commented on the issue: https://github.com/apache/nifi/pull/2004 @trkurc finally got around to adding comments. I also rebased to the latest master > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16160311#comment-16160311 ] ASF GitHub Bot commented on NIFI-2162: -- Github user trkurc commented on the issue: https://github.com/apache/nifi/pull/2004 I will review today > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16160592#comment-16160592 ] ASF GitHub Bot commented on NIFI-2162: -- Github user trkurc commented on the issue: https://github.com/apache/nifi/pull/2004 Build cleanly and ran some test flows without issue. I'll merge these in. > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16160593#comment-16160593 ] ASF subversion and git services commented on NIFI-2162: --- Commit 9367c280645b6a8f29a4905537ac6c3db03c6737 in nifi's branch refs/heads/master from Joe Percivall [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=9367c28 ] NIFI-2162 Updating OkHttp to 3.8.1 and OkHttp-Digest to 1.13 and refactoring InvokeHttp to adjust for changes This closes #2004 Signed-off-by: Tony Kurc > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16160594#comment-16160594 ] ASF GitHub Bot commented on NIFI-2162: -- Github user asfgit closed the pull request at: https://github.com/apache/nifi/pull/2004 > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug >Reporter: Joseph Percivall >Assignee: Joseph Percivall > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-2162) InvokeHttp's underlying library for Digest Auth uses the Android logger
[ https://issues.apache.org/jira/browse/NIFI-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16160627#comment-16160627 ] ASF GitHub Bot commented on NIFI-2162: -- Github user JPercivall commented on the issue: https://github.com/apache/nifi/pull/2004 Thanks for the review @trkurc, sorry it took me so long. > InvokeHttp's underlying library for Digest Auth uses the Android logger > --- > > Key: NIFI-2162 > URL: https://issues.apache.org/jira/browse/NIFI-2162 > Project: Apache NiFi > Issue Type: Bug > Components: Extensions >Affects Versions: 1.3.0 >Reporter: Joseph Percivall >Assignee: Joseph Percivall > Fix For: 1.4.0 > > > A user emailed the User mailing list with an issue that InvokeHttp was > failing due to not being able to find "android/util/Log"[1]. InvokeHttp uses > OkHttp and the library they recommend for digest authentication is > okhttp-digest[2]. Currently okhttp-digest assumes it's running on an Android > device and has access to the Android logger (OkHttp does not assume it's on > an Android device). > I raised an issue about it on the project's github page[3] and the creator > said he "Will change this soonish." > Once that is addressed, InvokeHttp will need to update the versions of OkHttp > and okhttp-digest. > [1] http://mail-archives.apache.org/mod_mbox/nifi-users/201606.mbox/browser > [2] https://github.com/square/okhttp/issues/205 > [3] https://github.com/rburgst/okhttp-digest/issues/13 -- This message was sent by Atlassian JIRA (v6.4.14#64029)