Skip to content

Commit

Permalink
Merge pull request #37361 from sberyozkin/skip_disabled_oidc_client_f…
Browse files Browse the repository at this point in the history
…ilter

Do not fail the request in OidcClient filters if OidcClient is disabled
  • Loading branch information
sberyozkin authored Nov 29, 2023
2 parents a81dd3a + ec9c312 commit 6b6d9e1
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 6b6d9e1

Please sign in to comment.