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

Improve the way HTTP authorizer logs exceptions #35987

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.jboss.logging.Logger;

import io.quarkus.security.AuthenticationFailedException;
import io.quarkus.security.AuthenticationRedirectException;
import io.quarkus.security.ForbiddenException;
import io.quarkus.security.identity.IdentityProviderManager;
import io.quarkus.security.identity.SecurityIdentity;
Expand Down Expand Up @@ -120,10 +121,15 @@ public void accept(Throwable throwable) {
// the exception twice;at this point, the exception could be failed by the default auth failure handler
if (!routingContext.response().ended() && !throwable.equals(routingContext.failure())) {
routingContext.fail(throwable);
} else if (!(throwable instanceof AuthenticationFailedException)) {
//don't log auth failure
} else if (throwable instanceof AuthenticationFailedException) {
log.debug("Authentication challenge is required");
} else if (throwable instanceof AuthenticationRedirectException) {
log.debugf("Completing authentication with a redirect to %s",
((AuthenticationRedirectException) throwable).getRedirectUri());
} else {
log.error("Exception occurred during authorization", throwable);
}

}
});
}
Expand Down