This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new d1f921a79a As per JASPIC specification, failure in secureResponse()
should mean 500 # Conflicts: # webapps/docs/changelog.xml # Conflicts: #
webapps/docs/changelog.xml # Conflicts: # webapps/docs/changelog.xml #
Conflicts: # webapps/docs/changelog.xml
d1f921a79a is described below
commit d1f921a79aec7d45a9d9c9dc5e297cfb6d005f5c
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Oct 26 15:07:39 2026 +0000
As per JASPIC specification, failure in secureResponse() should mean 500
# Conflicts:
# webapps/docs/changelog.xml
# Conflicts:
# webapps/docs/changelog.xml
# Conflicts:
# webapps/docs/changelog.xml
# Conflicts:
# webapps/docs/changelog.xml
---
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 d5d038881c..f88019a6d5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -504,6 +504,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]