httpcomponents-client
httpcomponents-client copied to clipboard
Demo for Java 22+ Async SPNEGO breakage
Work in progress Needs JDK 25 installed and configured in maven toolchains
Run
mvn clean verify -Pdocker -Drat.skip -Dcheckstyle.skip -Dit.test=ApacheHTTPDSquidCompatibilityIT\* -Dsurefire.failIfNoSpecifiedTests=false -Dtest=foo
to demonstrate the problem. The test fails when running the test with Java 25, but passes with 17.
@stoty Is this how the problem manifests itself?
[ERROR] Tests run: 6, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.076 s <<< FAILURE! -- in org.apache.hc.client5.testing.compatibility.ApacheHTTPDSquidCompatibilityIT$AsyncDirectHttp1SpnegoDoAs
[ERROR] org.apache.hc.client5.testing.compatibility.ApacheHTTPDSquidCompatibilityIT$AsyncDirectHttp1SpnegoDoAs.test_auth_success -- Time elapsed: 0.013 s <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <200> but was: <401>
at org.apache.hc.client5.testing.compatibility.async.HttpAsyncClientCompatibilityTest.lambda$test_auth_success$3(HttpAsyncClientCompatibilityTest.java:268)
at java.base/jdk.internal.vm.ScopedValueContainer.callWithoutScope(ScopedValueContainer.java:162)
at java.base/jdk.internal.vm.ScopedValueContainer.call(ScopedValueContainer.java:147)
at java.base/java.lang.ScopedValue$Carrier.call(ScopedValue.java:419)
at java.base/javax.security.auth.Subject.callAs(Subject.java:331)
at org.apache.hc.client5.testing.util.SecurityUtils.callAs(SecurityUtils.java:191)
at org.apache.hc.client5.testing.compatibility.async.HttpAsyncClientCompatibilityTest.test_auth_success(HttpAsyncClientCompatibilityTest.java:258)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
Yes, @ok2c .
AsyncDirectHttp1Spnego still succeeds, because it doesn't rely on getting the Subject from the Thread JAAS Scope.
So SPNEGO in general still works with Async as long the Principal is explicitly set.