From 4db085417b5221c9fdd74f0c1ff704e1a827b193 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Thu, 17 Dec 2020 18:10:51 +0100 Subject: Work around authentication check blocking-call bug in Quarkus 1.10.x. A bug causes authentication checks to fail when performed from inside a reactive operation: https://github.com/quarkusio/quarkus/issues/13835 To avoid such a reactive operation, we now render the HTML template eagerly even in NewsletterResource#register, which is otherwise a reactive implementation. Change-Id: I26d6c1cc76eaa041a04c106b7cf06f024a0cded3 --- .../java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/java/eu') diff --git a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java index a46ee32..85af008 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java @@ -40,14 +40,14 @@ public class NewsletterResource { @POST @Path("register") @Transactional - public CompletionStage register(@FormParam("email") String email) { + public CompletionStage register(@FormParam("email") String email) { var existingSubscription = NewsletterSubscription.find("email = ?1", email) .singleResultOptional(); if (existingSubscription.isPresent()) { // If a subscription already exists, act as if we had created it. This provides better // privacy to users than an error message does. - return CompletableFuture.completedStage(Templates.completeRegistration()); + return CompletableFuture.completedStage(Templates.completeRegistration().render()); } var subscription = new NewsletterSubscription(); @@ -56,7 +56,8 @@ public class NewsletterResource { var mailText = Templates.registrationMail(subscription.registrationKey); var sendJob = mailText.subject("MulkCMS newsletter registration").to(email).send(); - return sendJob.thenApply((x) -> Templates.completeRegistration()); + var page = Templates.completeRegistration().render(); + return sendJob.thenApply((x) -> page); } @GET -- cgit v1.2.3