Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8323292

Improper handling of Proxy-Authorization header

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      In jdk.internal.net.http.common.Utils, the code says:
      public static final BiPredicate<String, String> CONTEXT_RESTRICTED(HttpClient client) {
              return (k, v) -> client.authenticator() == null ||
                      ! (k.equalsIgnoreCase("Authorization")
                              && k.equalsIgnoreCase("Proxy-Authorization"));
          }

      But client.authenticator() returns an Optional and thus cannot be null.
      This has been fixed in master by the following code:
      public static final BiPredicate<String, String> CONTEXT_RESTRICTED(HttpClient client) {
              return (k, v) -> client.authenticator().isEmpty() ||
                      ! (k.equalsIgnoreCase("Authorization")
                              && k.equalsIgnoreCase("Proxy-Authorization"));
          }

      But unfortunately the code hasn't been backported to JDK 11

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Try to implement proxy authentication using JDK 11 HttpClient

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Proxy Authentication should work
      ACTUAL -
      Proxy Authentication doesn't work

            rpallath Rajendrakumar Pallath
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: