This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 47cab24799 As per JASPIC specification, failure in secureResponse()
should mean 500
47cab24799 is described below
commit 47cab24799942e36889d6cc0f49a9aba3c691461
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 5338f16661..967138ce8d 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -786,21 +786,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 0beae0aac4..8e8c0fdb8c 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -313,6 +313,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]