Hi, Tomcat devs;
I'm a bit out of my usual neighborhood with httpd... but I'm working
on creating a custom Authenticator for a non-standard auth-method in
Tomcat and noticed there isn't a "stock" method for adding
Authenticators aside from cracking open catalina.jar and messing with
Authenticators.properties. After a bit of poking around I came across
the ContextConfig class and found that I can create an implementation
that allows me to create/assign the Map of customAuthenticators. Sweet -
so I set up a little testing playground in Eclipse, wrote up my classes
and am a bit confused by results.
What I have come to find is that when starting Tomcat normally, the
custom configClass works as expected when setting server.xml up as
detailed below. When starting Tomcat in embedded mode via eclipse,
however, I cannot seem to get the custom class to ever be used. I am not
sure if this is expected behavior based on the way embedded Tomcat works
or if this may actually be a bug.
Thoughts?
--- info below ---
server.xml Host tag:
<Host name="localhost" appBase="webapps"
configClass="ruggeri.daniel.tester.CustomAuthenticatorsContextConfig"
unpackWARs="true" autoDeploy="true">
Snip of JUnit test for embedded mode:
tomcat = new Tomcat();
tomcat.setBaseDir(tempDir.toString());
tomcat.setHostname("localhost");
tomcat.setPort(8080);
tomcat.getHost().setConfigClass(CustomAuthenticatorsContextConfig.class.getCanonicalName());
Context ctx = tomcat.addWebapp(tomcat.getHost(), "/testerApp",
warPath);
tomcat.init();
tomcat.start();
Demonstration class to confirm the class is being used.
CustomAuthenticatorsContextConfig.java:
package ruggeri.daniel.tester;
import org.apache.catalina.startup.ContextConfig;
public class CustomAuthenticatorsContextConfig extends ContextConfig {
public CustomAuthenticatorsContextConfig() {
super();
System.out.println("Custom Authenticators ContextConfig
created!!!");
}
}
--
Daniel Ruggeri
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org