This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 9fadc20c1b953b2dadee04d49bb1dc01ae4482c0 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Sep 19 14:59:04 2024 +0100 Don't overwrite valid Principal from password callback will null --- .../apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java | 4 +++- webapps/docs/changelog.xml | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java b/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java index b725ffe047..d9eedd3735 100644 --- a/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java +++ b/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java @@ -68,7 +68,9 @@ public class CallbackHandlerImpl implements CallbackHandler, Contained { if (callback instanceof CallerPrincipalCallback) { CallerPrincipalCallback cpc = (CallerPrincipalCallback) callback; name = cpc.getName(); - principal = cpc.getPrincipal(); + if (cpc.getPrincipal() != null) { + principal = cpc.getPrincipal(); + } subject = cpc.getSubject(); } else if (callback instanceof GroupPrincipalCallback) { GroupPrincipalCallback gpc = (GroupPrincipalCallback) callback; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 671f1f36d1..5b2db7db84 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -127,6 +127,12 @@ associated with persisting the Jakarta Authentication provider configuration. (markt) </fix> + <fix> + When processing Jakarta Authentication callbacks, don't overwrite a + Principal obtained from the <code>PasswordValidationCallback</code> with + <code>null</code> if the <code>CallerPrincipalCallback</code> does not + provide a Principal. (markt) + </fix> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org