You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "MikeThomsen (via GitHub)" <gi...@apache.org> on 2023/08/15 19:03:56 UTC

[GitHub] [nifi] MikeThomsen commented on a diff in pull request #7609: NIFI-11912 Add Proxy Configuration Service property to StandardOauth2AccessTokenProvider

MikeThomsen commented on code in PR #7609:
URL: https://github.com/apache/nifi/pull/7609#discussion_r1294953067


##########
nifi-nar-bundles/nifi-standard-services/nifi-oauth2-provider-bundle/nifi-oauth2-provider-service/src/main/java/org/apache/nifi/oauth2/StandardOauth2AccessTokenProvider.java:
##########
@@ -315,6 +323,21 @@ protected OkHttpClient createHttpClient(ConfigurationContext context) {
             clientBuilder.sslSocketFactory(sslContext.getSocketFactory(), trustManager);
         }
 
+        final ProxyConfiguration proxyConfig = ProxyConfiguration.getConfiguration(context);
+
+        final Proxy proxy = proxyConfig.createProxy();
+        if (!Proxy.Type.DIRECT.equals(proxy.type())) {
+            clientBuilder.proxy(proxy);
+            if (proxyConfig.hasCredential()) {
+                clientBuilder.proxyAuthenticator((route, response) -> {
+                    final String credential= Credentials.basic(proxyConfig.getProxyUserName(), proxyConfig.getProxyUserPassword());
+                    return response.request().newBuilder()
+                                   .header("Proxy-Authorization", credential)

Review Comment:
   Is `Proxy-Authorization` a standard header for this use case?



-- 
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