You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2020/04/05 10:50:32 UTC

[httpcomponents-client] branch HTTPCLIENT-2073 created (now 1fe5179)

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a change to branch HTTPCLIENT-2073
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git.


      at 1fe5179  HTTPCLIENT-2073: (regression) WindowsNegotiateScheme incorrectly rejects empty NTLM challenge

This branch includes the following new commits:

     new 9ea79c6  Minor tweaks to auth execution logging
     new 1fe5179  HTTPCLIENT-2073: (regression) WindowsNegotiateScheme incorrectly rejects empty NTLM challenge

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[httpcomponents-client] 02/02: HTTPCLIENT-2073: (regression) WindowsNegotiateScheme incorrectly rejects empty NTLM challenge

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch HTTPCLIENT-2073
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit 1fe517918a7eda73c24561b17d22c977796107fb
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sun Apr 5 12:46:53 2020 +0200

    HTTPCLIENT-2073: (regression) WindowsNegotiateScheme incorrectly rejects empty NTLM challenge
---
 .../hc/client5/http/impl/win/WindowsNegotiateScheme.java  |  3 ---
 .../client5/http/impl/auth/TestAuthChallengeParser.java   | 15 ++++++++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/httpclient5-win/src/main/java/org/apache/hc/client5/http/impl/win/WindowsNegotiateScheme.java b/httpclient5-win/src/main/java/org/apache/hc/client5/http/impl/win/WindowsNegotiateScheme.java
index b269fa3..96894b3 100644
--- a/httpclient5-win/src/main/java/org/apache/hc/client5/http/impl/win/WindowsNegotiateScheme.java
+++ b/httpclient5-win/src/main/java/org/apache/hc/client5/http/impl/win/WindowsNegotiateScheme.java
@@ -133,9 +133,6 @@ public class WindowsNegotiateScheme implements AuthScheme {
             final AuthChallenge authChallenge,
             final HttpContext context) throws MalformedChallengeException {
         Args.notNull(authChallenge, "AuthChallenge");
-        if (authChallenge.getValue() == null) {
-            throw new MalformedChallengeException("Missing auth challenge");
-        }
         challengeType = authChallenge.getChallengeType();
         challenge = authChallenge.getValue();
         if (challenge.isEmpty()) {
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestAuthChallengeParser.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestAuthChallengeParser.java
index 12506ac..95fbe1a 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestAuthChallengeParser.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestAuthChallengeParser.java
@@ -29,8 +29,8 @@ package org.apache.hc.client5.http.impl.auth;
 import java.util.List;
 
 import org.apache.hc.client5.http.auth.AuthChallenge;
-import org.apache.hc.client5.http.auth.StandardAuthScheme;
 import org.apache.hc.client5.http.auth.ChallengeType;
+import org.apache.hc.client5.http.auth.StandardAuthScheme;
 import org.apache.hc.core5.http.NameValuePair;
 import org.apache.hc.core5.http.ParseException;
 import org.apache.hc.core5.http.message.BasicNameValuePair;
@@ -308,6 +308,19 @@ public class TestAuthChallengeParser {
         assertNameValuePair(new BasicNameValuePair("blah", null), params1.get(1));
     }
 
+    @Test
+    public void testParseNTLMAuthChallenge() throws Exception {
+        final CharArrayBuffer buffer = new CharArrayBuffer(64);
+        buffer.append(StandardAuthScheme.NTLM);
+        final ParserCursor cursor = new ParserCursor(0, buffer.length());
+        final List<AuthChallenge> challenges = parser.parse(ChallengeType.TARGET, buffer, cursor);
+        Assert.assertNotNull(challenges);
+        Assert.assertEquals(1, challenges.size());
+        final AuthChallenge challenge1 = challenges.get(0);
+        Assert.assertEquals(StandardAuthScheme.NTLM, challenge1.getSchemeName());
+        Assert.assertEquals(null, challenge1.getValue());
+    }
+
     private static void assertNameValuePair (
             final NameValuePair expected,
             final NameValuePair result) {


[httpcomponents-client] 01/02: Minor tweaks to auth execution logging

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch HTTPCLIENT-2073
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit 9ea79c68c5d1626ed75b37d3a989a9d6abc13274
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sun Apr 5 12:43:26 2020 +0200

    Minor tweaks to auth execution logging
---
 .../java/org/apache/hc/client5/http/impl/auth/HttpAuthenticator.java    | 1 +
 .../main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/HttpAuthenticator.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/HttpAuthenticator.java
index 8bcd124..219c4e8 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/HttpAuthenticator.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/HttpAuthenticator.java
@@ -257,6 +257,7 @@ public final class HttpAuthenticator {
         }
 
         final Queue<AuthScheme> authOptions = new LinkedList<>();
+        this.log.debug("Selecting authentication options");
         for (final AuthScheme authScheme: preferredSchemes) {
             try {
                 final String schemeName = authScheme.getName();
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
index 756f9bd..50aee86 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
@@ -96,7 +96,7 @@ public final class ProtocolExec implements ExecChainHandler {
         this.httpProcessor = Args.notNull(httpProcessor, "HTTP protocol processor");
         this.targetAuthStrategy = Args.notNull(targetAuthStrategy, "Target authentication strategy");
         this.proxyAuthStrategy = Args.notNull(proxyAuthStrategy, "Proxy authentication strategy");
-        this.authenticator = new HttpAuthenticator(log);
+        this.authenticator = new HttpAuthenticator();
     }
 
     @Override