Skip to content

Commit f974941

Browse files
authored
Merge pull request quarkusio#35987 from sberyozkin/improve_http_authorizer_exception_log_message
Improve the way HTTP authorizer logs exceptions
2 parents 4de127f + 40b4739 commit f974941

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/AbstractHttpAuthorizer.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.jboss.logging.Logger;
1111

1212
import io.quarkus.security.AuthenticationFailedException;
13+
import io.quarkus.security.AuthenticationRedirectException;
1314
import io.quarkus.security.ForbiddenException;
1415
import io.quarkus.security.identity.IdentityProviderManager;
1516
import io.quarkus.security.identity.SecurityIdentity;
@@ -120,10 +121,15 @@ public void accept(Throwable throwable) {
120121
// the exception twice;at this point, the exception could be failed by the default auth failure handler
121122
if (!routingContext.response().ended() && !throwable.equals(routingContext.failure())) {
122123
routingContext.fail(throwable);
123-
} else if (!(throwable instanceof AuthenticationFailedException)) {
124-
//don't log auth failure
124+
} else if (throwable instanceof AuthenticationFailedException) {
125+
log.debug("Authentication challenge is required");
126+
} else if (throwable instanceof AuthenticationRedirectException) {
127+
log.debugf("Completing authentication with a redirect to %s",
128+
((AuthenticationRedirectException) throwable).getRedirectUri());
129+
} else {
125130
log.error("Exception occurred during authorization", throwable);
126131
}
132+
127133
}
128134
});
129135
}

0 commit comments

Comments
 (0)