You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bengali Bengali <be...@gmail.com> on 2005/07/25 10:04:06 UTC

Realm programmatic authentication

Hi,

I would like to use the configured realm to authenticate users but I
don't want to use the standard J2EE mechanism (for many reasons).
Also, my needs for authorisations are not limited to URLs and are more
fine-grained. Since I configured a JNDI realm I wanted to access the
reamù in my webapp but I haven't been able to. I am using Tomcat
5.5.9.


Actually, I had a look at the sources of the manager application and
tried to mimic it. I created a Servlet which implemented the
ContainerServlet interface. Then using the setWrapper callback method
I could access the wrapper and realm to authenticate users:
Principal principal =  wrapper.getRealm().authenticate(username, password);

But i haven't managed to make it work
I faced many issues:
 - catalina classes could not be loaded : I added the catalina.jar in
the common.loader section of the catalina.properties file.
- security exceptions: I had security java.lang.SecurityException
which I have been unable to solve. I added (at least tried) 
permissions to the catalina.policy file for the webapp to be able to
load catalina classes  but it didn't work:
permission java.lang.RuntimePermission 
"accessClassInPackage.org.apache.catalina";
permission java.lang.RuntimePermission 
"accessClassInPackage.org.apache.catalina.*";

Is there a way via JMX or other to access the Realm to authenticate
users manually?

Thanks for your help .

Luc

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