Skip to content

Commit acc2f01

Browse files
committed
If the Jakarta Authentication fails with an exception, set a 500 status
Depending on what fails where, the status may not be set or may be set incorrectly.
1 parent 7a8756b commit acc2f01

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

java/org/apache/catalina/authenticator/AuthenticatorBase.java

+2
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,8 @@ private boolean authenticateJaspic(Request request, Response response, JaspicSta
803803
authStatus = state.serverAuthContext.validateRequest(state.messageInfo, client, null);
804804
} catch (AuthException e) {
805805
log.debug(sm.getString("authenticator.loginFail"), e);
806+
// Need to explicitly set the return code as the ServerAuthContext may not have done.
807+
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
806808
return false;
807809
}
808810

webapps/docs/changelog.xml

+5
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@
117117
creates one <code>GenericPrincipal</code> in the <code>Subject</code>.
118118
(markt)
119119
</fix>
120+
<fix>
121+
If the Jakarta Authentication process fails with an Exception,
122+
explicitly set the HTTP response status to 500 as the
123+
<code>ServerAuthContext</code> may not have set it. (markt)
124+
</fix>
120125
</changelog>
121126
</subsection>
122127
</section>

0 commit comments

Comments
 (0)