This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 17ca7505d2 As per JASPIC specification, failure in secureResponse()
should mean 500
17ca7505d2 is described below
commit 17ca7505d29257d47eda998c28aa0b4b2ac117c6
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Oct 26 15:07:39 2026 +0000
As per JASPIC specification, failure in secureResponse() should mean 500
---
java/org/apache/catalina/authenticator/AuthenticatorBase.java | 8 ++++++--
webapps/docs/changelog.xml | 6 ++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
index 2cb7d73e00..a2def933a3 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -784,21 +784,25 @@ public abstract class AuthenticatorBase extends ValveBase
implements Authenticat
boolean result = authenticateJaspic(request, response,
jaspicRequestState, true);
- secureResponseJaspic(request, response, jaspicRequestState);
+ // '&' is deliberate since short-cut is not appropriate here -
secureResponseJaspic() always needs to run.
+ result = result & secureResponseJaspic(request, response,
jaspicRequestState);
return result;
}
}
- private void secureResponseJaspic(Request request, Response response,
JaspicRequestState state) {
+ private boolean secureResponseJaspic(Request request, Response response,
JaspicRequestState state) throws IOException {
try {
state.serverAuthContext.secureResponse(state.messageInfo, null);
request.setRequest((HttpServletRequest)
state.messageInfo.getRequestMessage());
response.setResponse((HttpServletResponse)
state.messageInfo.getResponseMessage());
} catch (AuthException e) {
log.warn(sm.getString("authenticator.jaspicSecureResponseFail"),
e);
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return false;
}
+ return true;
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3bcc5e4a6c..58bcb6dc8b 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -328,6 +328,12 @@
Use RequestDispatcher target rather than source when looking up
<code>security-role-ref</code>s for the current Servlet. (markt)
</fix>
+ <fix>
+ As per the Jakarta Authentication specification, an
+ <code>AuthException</code> during
+ <code>serverAuthContext.secureResponse()</code> should result in an
+ internal server error (500) response. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]