From 39d6c677a159ea70e93bd769934535d6e67466da Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 13 Dec 2023 08:25:27 -0700 Subject: [PATCH] Do not add blank Bearer token (#588) 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() {