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

NTCredentials for Basic Authentication uses slash instead of backslash

    XMLWordPrintableJSON

Details

    Description

      Basic authentication fails when using NTCredentials because a slash is used instead of a backslash for the DOMAIN USERNAME separator.

      httpClient.getCredentialsProvider().setCredentials(
      new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
      new NTCredentials("USERNAME", "PASSWORD", "", "DOMAIN"));

      produces USERNAME/PASSWORD

      Tested to work using:

      httpClient.getCredentialsProvider().setCredentials(
      new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
      new UsernamePasswordCredentials("DOMAIN
      USERNAME", "PASSWORD"));

      According to:

      http://msdn.microsoft.com/en-us/library/windows/desktop/aa380525%28v=vs.85%29.aspx

      Down-Level Logon Name
      The down-level logon name format is used to specify a domain and a user account in that domain, for example, DOMAIN\UserName. The following table summarizes the parts of a down-level logon name.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jsm174 Jason Millard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: