The old implementation of HttpServletRequest.authenticate() would just
assume that a challenge was set up in the exchange. For Undertow 1.1,
again, take a look at HttpServletRequestImpl.java lines 411-416. The
problem is that my challenge did not commit the request and line 411 is
returning false. I tried to fix it by calling
HttpServerExchange.endExchange(), got success, but got the stack trace
shown earlier....
If you *really* want to look the code it is here:
https://github.com/keycloak/keycloak/tree/master/integration/undertow
Its a bit of a mess mainly because we have common adapter code that is
shared between Undertow, Tomcat 6-8, Jetty 8-9, and JBossWeb.
If you pull the whole project and bring it up in an IDE, you can try the
test:
org.keycloak.testsuite.adapter.AdapterTest#testAuthenticated()
"master" uses 1.0.15 of Undertow. Just change it to use 1.1.0.Final (in
the master pom.xml) and you'll see the failure.
On 11/25/2014 2:19 PM, Stuart Douglas wrote:
Is the code up on Github anywhere? If so I can take a look.
Stuart
----- Original Message -----
> From: "Bill Burke" <bburke(a)redhat.com>
> To: undertow-dev(a)lists.jboss.org
> Sent: Wednesday, 26 November, 2014 3:30:41 AM
> Subject: [undertow-dev] req.authenticate() problems 1.1.0
>
> When upgrading from Undertow 1.0.15 to 1.1.0 our
> HttpServleRequest.authenticate() unit test is failing. An exception is
> being thrown in HttpServletRequestImpl.authenticate() line 416.
>
> Our auth mechanism is being called correctly. It sets the status code
> (302) and the Location header within a challenge object. It looks like
> exchange.isResponseStarted() is returning false even though my challenge
> object is setting up the resposne correctly. Am I supposed to call
> exchange.endExchange() or something within my Challenge object? I tried
> doing that, but Undertow is now spitting out exception messages:
>
> java.lang.IllegalStateException: UT000002: The response has already been
> started
> at
> io.undertow.server.HttpServerExchange.setResponseCode(HttpServerExchange.java:1246)
> at
>
io.undertow.security.impl.SecurityContextImpl$ChallengeSender.transition(SecurityContextImpl.java:355)
> at
>
io.undertow.security.impl.SecurityContextImpl$ChallengeSender.transition(SecurityContextImpl.java:349)
> at
>
io.undertow.security.impl.SecurityContextImpl$ChallengeSender.transition(SecurityContextImpl.java:349)
> at
>
io.undertow.security.impl.SecurityContextImpl$ChallengeSender.access$300(SecurityContextImpl.java:314)
> at
>
io.undertow.security.impl.SecurityContextImpl.sendChallenges(SecurityContextImpl.java:135)
> at
>
io.undertow.security.impl.SecurityContextImpl.authTransition(SecurityContextImpl.java:109)
> at
>
io.undertow.security.impl.SecurityContextImpl.authenticate(SecurityContextImpl.java:99)
> at
>
io.undertow.servlet.spec.HttpServletRequestImpl.authenticate(HttpServletRequestImpl.java:404)
>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
>
http://bill.burkecentral.com
> _______________________________________________
> undertow-dev mailing list
> undertow-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/undertow-dev
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com