From 17ee6eaf5e554d408ff8c11b05eef740ae55b24b Mon Sep 17 00:00:00 2001 From: Lukas Forer Date: Wed, 3 Jul 2024 16:21:13 +0200 Subject: [PATCH 1/2] Update micronaut to 4.5.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8774e88a..6ee56981 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ io.micronaut.platform micronaut-parent - 4.1.6 + 4.5.0 Cloudgene From 36373a306bae9fec522841e73fb6c70a4a2f7c3b Mon Sep 17 00:00:00 2001 From: Lukas Forer Date: Thu, 4 Jul 2024 10:12:09 +0200 Subject: [PATCH 2/2] Fix issues with blocking publisher --- .../cloudgene/mapred/server/auth/AuthenticationService.java | 4 ++-- .../mapred/server/controller/ApiTokenController.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/cloudgene/mapred/server/auth/AuthenticationService.java b/src/main/java/cloudgene/mapred/server/auth/AuthenticationService.java index 8157a447..20e1a1af 100644 --- a/src/main/java/cloudgene/mapred/server/auth/AuthenticationService.java +++ b/src/main/java/cloudgene/mapred/server/auth/AuthenticationService.java @@ -118,7 +118,7 @@ public ApiToken createApiToken(User user, int lifetime) { } - public ValidatedApiTokenResponse validateApiToken(String token) { + public Mono validateApiToken(String token) { Publisher authentication = validator.validateToken(token, null); @@ -164,7 +164,7 @@ public void onSubscribe(Subscription subscription) { } }); - }).block(); + }).single(); } diff --git a/src/main/java/cloudgene/mapred/server/controller/ApiTokenController.java b/src/main/java/cloudgene/mapred/server/controller/ApiTokenController.java index 1817b607..a61cb9b8 100644 --- a/src/main/java/cloudgene/mapred/server/controller/ApiTokenController.java +++ b/src/main/java/cloudgene/mapred/server/controller/ApiTokenController.java @@ -23,6 +23,7 @@ import io.micronaut.security.authentication.Authentication; import io.micronaut.security.rules.SecurityRule; import jakarta.inject.Inject; +import reactor.core.publisher.Mono; @Controller public class ApiTokenController { @@ -107,7 +108,7 @@ public HttpResponse revoke(String username, Authentication auth @Post("/api/v2/tokens/verify") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Secured(SecurityRule.IS_ANONYMOUS) - public HttpResponse verify(String token) { + public HttpResponse> verify(String token) { return HttpResponse.ok(authenticationService.validateApiToken(token));