From 120e3e7d68afd8b42c72f1a349d73e8e04c38c64 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:43:34 -0300 Subject: [PATCH] Do not add blank Bearer token (#588) (#591) Co-authored-by: Martin Co-authored-by: Martin Glass --- .../generator/providers/BearerAuthenticationProvider.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/BearerAuthenticationProvider.java b/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/BearerAuthenticationProvider.java index 227372d6..739f3b85 100644 --- a/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/BearerAuthenticationProvider.java +++ b/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/BearerAuthenticationProvider.java @@ -34,8 +34,10 @@ public void filter(ClientRequestContext requestContext) throws IOException { } else { bearerToken = getBearerToken(); } - requestContext.getHeaders().add(HttpHeaders.AUTHORIZATION, - AuthUtils.authTokenOrBearer(this.scheme, bearerToken)); + if (!bearerToken.isBlank()) { + requestContext.getHeaders().add(HttpHeaders.AUTHORIZATION, + AuthUtils.authTokenOrBearer(this.scheme, bearerToken)); + } } private String getBearerToken() {