Skip to content

Commit f17b39c

Browse files
Better log message for oauth2 provider
Signed-off-by: gabriel-farache <[email protected]>
1 parent 20397b8 commit f17b39c

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

client/oidc/src/main/java/io/quarkiverse/openapi/generator/oidc/providers/OAuth2AuthenticationProvider.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public void filter(ClientRequestContext requestContext) throws IOException {
3838

3939
if (this.isTokenPropagation()) {
4040
bearerToken = this.getTokenForPropagation(requestContext.getHeaders());
41+
if (isEmptyOrBlank(bearerToken)) {
42+
LOGGER.debug("Token propagation for OAUTH2 is enabled but the configured propagation header defined by {} is not present",
43+
getHeaderForPropagation(getOpenApiSpecId(), getName()));
44+
}
4145
} else {
4246
Optional<String> optionalBearerToken = this.getCredentialsProvider()
4347
.getOauth2BearerToken(CredentialsContext.builder()
@@ -47,18 +51,19 @@ public void filter(ClientRequestContext requestContext) throws IOException {
4751
.build());
4852
if (optionalBearerToken.isPresent()) {
4953
bearerToken = optionalBearerToken.get();
54+
if (isEmptyOrBlank(bearerToken)) {
55+
LOGGER.debug("The CredentialProvider implementation returned an empty OAUTH2 bearer");
56+
}
5057
} else {
58+
LOGGER.debug("There is no custom CredentialProvider implementation, the {} header will be set using delegate's filter. ",
59+
HttpHeaders.AUTHORIZATION);
5160
delegate.filter(requestContext);
5261
}
5362
}
5463

5564
if (!isEmptyOrBlank(bearerToken)) {
5665
addAuthorizationHeader(requestContext.getHeaders(),
5766
AuthUtils.authTokenOrBearer("Bearer", AbstractAuthProvider.sanitizeBearerToken(bearerToken)));
58-
} else {
59-
LOGGER.debug("Token propagation is not enabled or {} configured propagation header not populated and there is" +
60-
" no custom credential provider implementation. The {} header will be set using delegate's filter. ",
61-
getHeaderForPropagation(getOpenApiSpecId(), getName()), HttpHeaders.AUTHORIZATION);
6267
}
6368
}
6469

docs/modules/ROOT/pages/includes/quarkus-openapi-generator-moqu-wiremock.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ endif::add-copy-button-to-config-props[]
1515

1616
[.description]
1717
--
18-
Path to the Moqu (relative to the project).
18+
Path to the Moqu OpenAPI files, relative to the `src/main/resources` directory.
1919

2020

2121
ifdef::add-copy-button-to-env-var[]

docs/modules/ROOT/pages/includes/quarkus-openapi-generator-moqu-wiremock_quarkus.openapi-generator.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ endif::add-copy-button-to-config-props[]
1515

1616
[.description]
1717
--
18-
Path to the Moqu (relative to the project).
18+
Path to the Moqu OpenAPI files, relative to the `src/main/resources` directory.
1919

2020

2121
ifdef::add-copy-button-to-env-var[]

0 commit comments

Comments
 (0)