Skip to content

Commit 7532f9d

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 ba7f750 commit 7532f9d

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
@@ -802,6 +802,8 @@ private boolean authenticateJaspic(Request request, Response response, JaspicSta
802802
authStatus = state.serverAuthContext.validateRequest(state.messageInfo, client, null);
803803
} catch (AuthException e) {
804804
log.debug(sm.getString("authenticator.loginFail"), e);
805+
// Need to explicitly set the return code as the ServerAuthContext may not have done.
806+
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
805807
return false;
806808
}
807809

webapps/docs/changelog.xml

+5
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@
112112
creates one <code>GenericPrincipal</code> in the <code>Subject</code>.
113113
(markt)
114114
</fix>
115+
<fix>
116+
If the Jakarta Authentication process fails with an Exception,
117+
explicitly set the HTTP response status to 500 as the
118+
<code>ServerAuthContext</code> may not have set it. (markt)
119+
</fix>
115120
</changelog>
116121
</subsection>
117122
</section>

0 commit comments

Comments
 (0)