I've configured my webapp to use BASIC authentication.
When attempting to access http://localhost:8080/DBTest/ I do get a popup asking for user/pwd.
On submitting the user/pwd as role1/password, it is not accepted and the popup keeps reappearing.
Below are the web.xml and tomcat-users.xml
You have to select a security Realm in your tomcat conf/server.xml file.
The sample that's provided for tomcat-users.xml is the MemoryRealm, and as shipped it's commented out.
You must uncomment the realm definition in server.xml to make it work.
Note that tomcat-users.xml is simply the (default) name of a file that the MemoryRealm uses. Most production Tomcat servers use a Realm that employs a database or LDAP/Active Directory server to maintain user account information.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
I guess its too late to reply to this post , but since i figured out the problem I think its my duty to post the solution.
I was using a WTP enabled eclipse and running the tomcat through the eclipse. Eclipse had created a server directory and was using the tomcat-users.xml file from the location ~/MyWorkspace/MyProject/Servers/Tomcat v6.0 Server at localhost-config/tomcat-users.xml. I too had directly modified the $CATALINA_HOME/conf/tomcat-users.xml
After editing the right config file i was able to run the authentication as expected
sksumit kumar wrote:I guess its too late to reply to this post , but since i figured out the problem I think its my duty to post the solution.
I was using a WTP enabled eclipse and running the tomcat through the eclipse. Eclipse had created a server directory and was using the tomcat-users.xml file from the location ~/MyWorkspace/MyProject/Servers/Tomcat v6.0 Server at localhost-config/tomcat-users.xml. I too had directly modified the $CATALINA_HOME/conf/tomcat-users.xml
After editing the right config file i was able to run the authentication as expected
This is why I loathe and despise WTP (and use sysdeo instead). In addition to the conditions you've noted, WTP's copying of the tomcat config is selective, based on what they think the Tomcat configuration is, and if you stray from that model, you'll discover - painfully - that your extended configurations are not supported.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
Gift giving made easy with the permaculture playing cards