vert-x3 / vertx-web

HTTP web applications for Vert.x
Apache License 2.0
1.11k stars 535 forks source link

Fix for nested ChainAuthHandlers of type "any" #2644

Closed tsegismont closed 2 months ago

tsegismont commented 2 months ago

See #2641

ChainAuthHandlerImpl maintains, for instances of type "any", an index indicating which handler in the list succeeded to authenticate the user.

This index is used in the postAuthentication method to determine which handler int he list should have its postAuthentication method invoked.

When "any" ChainAuthHandlers were nested, the index computed in the top level ChainAuthHandler was used to choose the handlers in the list of nested ChainAuthHandler.

This caused either the wrong handler to be peeked or IndexOutOfBoundsException to be thrown.

With this change, the value put in the RoutingContext is specific to a ChainAuthHandler instance.