Issue #2721 new

Add a www-authenticate header to our response (BB-1692)

Shuji Watanabe
created an issue

Authentication failed. Java 1.6 httpcore-4.1.jar * httpclient-4.1.1.jar

Server require an authentication and return 401 status code. But server dont tell client to which authentication scheme is needed.

Sample Code {{{


DefaultHttpClient httpclient = new DefaultHttpClient(); try { HttpGet httpget = new HttpGet(""); httpclient.getCredentialsProvider().setCredentials(new AuthScope("", 443), new UsernamePasswordCredentials("shuji.w6e", "**")); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); System.out.println(response.getStatusLine()); if (entity != null) { System.out.println("Response content length: " + entity.getContentLength()); } EntityUtils.consume(entity); } finally { httpclient.getConnectionManager().shutdown(); } }}} Server response is not contains "WWW-Authenticate" header. Please append a header suche as "WWW-Authenticate: Basic realm="Authentication required".