Repository: quarkusio/quarkus
Issue: FormAuthenticationMechanism needs to handle exceptions to avoid requests without response.

Exceptions in `io.quarkus.vertx.http.runtime.security.PersistentLoginManager.save()` are not being handled correctly by the caller. This means that if an exception happens, the request will never be fulfilled. You can see this in action in #11768.

`subscribe().with()` callback in `FormAuthenticationMechanism.runFormAuth` needs to check if any exceptions happen and fail the uni if so.

I've got a patch for this already that I'll be sending shortly.

Changed files:
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/FormAuthenticationMechanism.java

diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/FormAuthenticationMechanism.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/FormAuthenticationMechanism.java
index e0b2e65a238..74d6962fb87 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/FormAuthenticationMechanism.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/FormAuthenticationMechanism.java
@@ -74,17 +74,22 @@ public void handle(Void event) {
                                     .subscribe().with(new Consumer<SecurityIdentity>() {
                                         @Override
                                         public void accept(SecurityIdentity identity) {
-                                            loginManager.save(identity, exchange, null);
-                                            if (redirectAfterLogin || exchange.getCookie(locationCookie) != null) {
-                                                handleRedirectBack(exchange);
-                                                //we  have authenticated, but we want to just redirect back to the original page
-                                                //so we don't actually authenticate the current request
-                                                //instead we have just set a cookie so the redirected request will be authenticated
-                                            } else {
-                                                exchange.response().setStatusCode(200);
-                                                exchange.response().end();
+                                            try {
+                                                loginManager.save(identity, exchange, null);
+                                                if (redirectAfterLogin || exchange.getCookie(locationCookie) != null) {
+                                                    handleRedirectBack(exchange);
+                                                    //we  have authenticated, but we want to just redirect back to the original page
+                                                    //so we don't actually authenticate the current request
+                                                    //instead we have just set a cookie so the redirected request will be authenticated
+                                                } else {
+                                                    exchange.response().setStatusCode(200);
+                                                    exchange.response().end();
+                                                }
+                                                uniEmitter.complete(null);
+                                            } catch (Throwable t) {
+                                                log.error("Unable to complete post authentication", t);
+                                                uniEmitter.fail(t);
                                             }
-                                            uniEmitter.complete(null);
                                         }
                                     }, new Consumer<Throwable>() {
                                         @Override