• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

Authentication and re-Authentication for authorization on Tomcat 4.1.24

Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

response.setStatus(response.SC_UNAUTHORIZED); // Ie 401

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.

Thanks so much
I would challenge you to a battle of wits, but I see you are unarmed - shakespear. Unarmed tiny ad:
Enterprise-grade Excel API for Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!