hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From micha...@apache.org
Subject svn commit: r1639679 - /httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java
Date Fri, 14 Nov 2014 15:50:01 GMT
Author: michaelo
Date: Fri Nov 14 15:50:01 2014
New Revision: 1639679

URL: http://svn.apache.org/r1639679
Log:
Fixed a regression introduced by HTTPCLIENT-1545

* Initially a SEC_E_DOWNGRADE_DETECTED was thrown but this one is not available on Windows
XP and tests never pass. Rather use SEC_E_TARGET_UNKNOWN.
* Hostnames must be in lower case when a SPN is provided

Modified:
    httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java

Modified: httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java?rev=1639679&r1=1639678&r2=1639679&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java
Fri Nov 14 15:50:01 2014
@@ -91,7 +91,7 @@ public class TestWindowsNegotiateScheme 
         Assume.assumeTrue("Test can only be run on Windows", WinHttpClients.isWinAuthAvailable());
 
         // HTTPCLIENT-1545
-        // If a service principle name (SPN) from outside your Windows domain tree (e.g.,
HTTP/EXAMPLE.COM) is used,
+        // If a service principle name (SPN) from outside your Windows domain tree (e.g.,
HTTP/example.com) is used,
         // InitializeSecurityContext will return SEC_E_DOWNGRADE_DETECTED (decimal: -2146892976,
hex: 0x80090350).
         // Because WindowsNegotiateScheme wasn't setting the completed state correctly when
authentication fails,
         // HttpClient goes into an infinite loop, constantly retrying the negotiate authentication
to kingdom
@@ -101,7 +101,7 @@ public class TestWindowsNegotiateScheme 
         final Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
             .register(AuthSchemes.SPNEGO, new AuthSchemeProvider() {
                 public AuthScheme create(final HttpContext context) {
-                    return new WindowsNegotiateSchemeGetTokenFail(AuthSchemes.SPNEGO, "HTTP/EXAMPLE.COM");
+                    return new WindowsNegotiateSchemeGetTokenFail(AuthSchemes.SPNEGO, "HTTP/example.com");
                 }
             }).build();
         final CredentialsProvider credsProvider =
@@ -129,7 +129,10 @@ public class TestWindowsNegotiateScheme 
         @Override
         String getToken(final CtxtHandle continueCtx, final SecBufferDesc continueToken,
final String targetName) {
             dispose();
-            throw new Win32Exception(WinError.SEC_E_DOWNGRADE_DETECTED);
+            /* We will rather throw SEC_E_TARGET_UNKNOWN because SEC_E_DOWNGRADE_DETECTED
is not
+             * available on Windows XP and this unit test always fails.
+             */
+            throw new Win32Exception(WinError.SEC_E_TARGET_UNKNOWN);
         }
 
     }



Mime
View raw message