javaservletsjaas

JAAS with servlet


I am trying to use JAAS for my servlet application. I could get a basic JAAS simple authentication (non-servlet) working.

But with the servlet where to i set this variable? -Djava.security.auth.login.config=test_jaas.config

I also tried exporting JVM_OPTS to this as per this page http://www.kopz.org/public/documents/tomcat/jaasintomcat.html

But I still keep getting, "No LoginModules configured" while creating LoginContex.

Any help is appreciated.


Solution

  • It depends on the servlet container. If you're using Tomcat you have to configure a JAAS realm. See the Tomcat configuration documentation under Realms.