This week's book giveaway is in the Testing forum. We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line! See this thread for details.
Authentication and re-Authentication for authorization on Tomcat 4.1.24
posted 11 years ago
In my server.xml, I have a JNDI realm which works for authenticating every user against Microsoft Active Directory.
The user requests a URL which I have set up as an alias in my web.xml for a servlet which authenticates the user against the active directory and then does a dispatcher.forward(request,response) to what is essentially an opening page for the user. (A menu of links to specific programs.)
I am trying to implement further authorization for certain programs for administrators.
If a person tries to open (I�m only testing 1 page at the moment) the protected page, before doing the dispatcher.forward(request,response), I rewrite the http header to be basic authentication in an effort to trick Tomcat into re-authenticating for this page.
I have set up a context fragment similar to tomcat_home/webapps/application.xml trying to set up the additional basic authentication.
It wants to use the user database, and in fact, it does pop up the basic login window after the user has cleared the jndi authentication. However, after 3 attempts to login, it neither gives me a �bad password� message, nor a �successful� message, instead after the 3 attempts, it just allows the already authenticated user access whether or not they have been assigned the appropriate role in the tomcat-users.xml.
Any ideas why it doesn�t seem to be actually using the tomcat-users.xml? It�s a miracle that it�s this close to working. I�m feeling my way through this, I�m not very experienced at Tomcat or Java or Jndi, I only touch on them occasionally. So, please answer in full, rich answers.