Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not fail the request in OidcClient filters if OidcClient is disabled #37361

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading