Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1067

Cross realm authentication doesn't work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 4.1 Final
    • None
    • HttpClient (classic)

    Description

      Cross realm authentication doesn't work because of incomplete server SPN passed into GSS-API.

      Class Name: NegotiateScheme
      Line # 205 (GSSName serverName = manager.createName("HTTP/" + authServer, null)

      This piece of code doesn't append the server realm while creating name. Because of null server realm, jdk always append default realm by reading krb5.conf file. but there can be case where server realm is different than default realm configured in krb5.conf file.

      Modified code:
      ----------------------------------------------------------------------------------------------------------------------------------------
      String strServerName = Krb5Utility.mapDomainToRealm(authServer);
      strServerName = strServerName == null ? "" : ("@" + strServerName);
      GSSName serverName = manager.createName("HTTP/" + authServer + strServerName, null);
      ----------------------------------------------------------------------------------------------------------------------------------------

      Krb5Utility.mapDomainToRealm method code
      ----------------------------------------------------------------------------------------------------------------------------------------
      public static String mapDomainToRealm(String name) {
      String result = null;
      try {
      String subname = null;
      Config c = Config.getInstance();
      if ((result = c.getDefault(name, "domain_realm")) != null)
      return result;
      else {
      for (int i = 1; i < name.length(); i++) {
      // mapping could be .ibm.com = AUSTIN.IBM.COM
      if ((name.charAt == '.') && (i != name.length() - 1)) {
      subname = name.substring;
      result = c.getDefault(subname, "domain_realm");
      if (result != null)

      { break; }

      else {
      // or mapping could be ibm.com = AUSTIN.IBM.COM
      subname = name.substring(i + 1);
      result = c.getDefault(subname, "domain_realm");
      if (result != null)

      { break; }

      }
      }
      }
      }
      } catch (KrbException e) {
      }
      return result;
      }
      ----------------------------------------------------------------------------------------------------------------------------------------

      Attachments

        1. NegotiateScheme.java
          12 kB
          Gaurav Singhal

        Activity

          People

            Unassigned Unassigned
            gausi Gaurav Singhal
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: