isUserInRole Question

Hi All. I've read a chapter on this in a book I have and in the book when you submit the form and the j_security_check action is performed tomcat looks up the tomcat-users.xml file for the users there and authenticates against those. I would like to use this security mechanism but not store the users in an xml file i would like to have them in the database and compare the entered username and password with the values loaded from the database. So how can i overide tomcat to compare the values entered with the values from the database. I know i could use a servlet as the action for the form and in that servlet do the comparisons but if there is a better way i would like to hear about it. Also when i load up my users from the database what kind of object should i create so that i can call isUserInRole correctly. because all i will have is a string username and password. How will i get tomcat to recognise this as a user? Can anyone point me in the right direction.

[982 byte] By [josephquinn80a] at [2007-11-27 2:57:35]
# 1

I don't know about Tomcat, but in hopes that it is like the SUn Java System Application Server, what you need to do is configure a security realm that uses a database to contain its user information, then specify that securit realm in the web.xml deployment descriptor. Find info on configuring security realms in Tomcat at http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html.

summerreflectiona at 2007-7-12 3:36:15 > top of Java-index,Security,Other Security APIs, Tools, and Issues...