Skip to content

Commit

Permalink
Do not fail the request in OidcClient filters if OidcClient is disabled
Browse files Browse the repository at this point in the history
(cherry picked from commit ec9c312)
  • Loading branch information
sberyozkin authored and gsmet committed Nov 30, 2023
1 parent e164f6f commit 3b6724d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public void filter(ClientRequestContext requestContext) throws IOException {
final String accessToken = getAccessToken();
requestContext.getHeaders().add(HttpHeaders.AUTHORIZATION, BEARER_SCHEME_WITH_SPACE + accessToken);
} catch (DisabledOidcClientException ex) {
LOG.debug("Client is disabled, aborting the request");
throw ex;
LOG.debug("Client is disabled, acquiring and propagating the token is not necessary");
return;
} catch (Exception ex) {
LOG.debugf("Access token is not available, cause: %s, aborting the request", ex.getMessage());
throw (ex instanceof RuntimeException) ? (RuntimeException) ex : new RuntimeException(ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ public void accept(Tokens tokens) {
@Override
public void accept(Throwable t) {
if (t instanceof DisabledOidcClientException) {
LOG.debug("Client is disabled, aborting the request");
LOG.debug("Client is disabled, acquiring and propagating the token is not necessary");
requestContext.resume();
} else {
LOG.debugf("Access token is not available, cause: %s, aborting the request", t.getMessage());
requestContext.resume((t instanceof RuntimeException) ? t : new RuntimeException(t));
}
requestContext.resume((t instanceof RuntimeException) ? t : new RuntimeException(t));
}
});
}
Expand Down

0 comments on commit 3b6724d

Please sign in to comment.