You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2026/09/30 08:30:44 UTC

(tomcat) 03/07: Load statically configured ServerAuthModule classes via the thread context (web application) class loader first, matching the pattern used for AuthConfigProvider classes, so modules packaged in WEB-INF/lib are found

This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 148faa4e1ef991395e9caf4f8964cc853221f6bb
Author: opencode <re...@apache.org>
AuthorDate: Wed Sep 30 10:20:47 2026 +0200

    Load statically configured ServerAuthModule classes via the thread context (web application) class loader first, matching the pattern used for AuthConfigProvider classes, so modules packaged in WEB-INF/lib are found
---
 .../catalina/authenticator/jaspic/SimpleServerAuthConfig.java | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java b/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java
index 78a6c56f6a..27c8eca20b 100644
--- a/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java
+++ b/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java
@@ -141,7 +141,16 @@ public class SimpleServerAuthConfig implements ServerAuthConfig {
                     Object moduleClassName = mergedProperties.get(key);
                     while (moduleClassName instanceof String) {
                         try {
-                            Class<?> clazz = Class.forName((String) moduleClassName);
+                            Class<?> clazz = null;
+                            try {
+                                clazz = Class.forName((String) moduleClassName, true,
+                                        Thread.currentThread().getContextClassLoader());
+                            } catch (ClassNotFoundException ignore) {
+                                // Ignore so the re-try below can proceed
+                            }
+                            if (clazz == null) {
+                                clazz = Class.forName((String) moduleClassName);
+                            }
                             ServerAuthModule module = (ServerAuthModule) clazz.getConstructor().newInstance();
                             module.initialize(null, null, handler, mergedProperties);
                             modules.add(module);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org