Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BASIC authentication not working

 
Amar Jee
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

web.xml
-----------------


tomcat-users.xml
------------------------------
 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amar Jee wrote:
On submitting the user/pwd as role1/password, it is not accepted and the popup keeps reappearing.

tomcat-users.xml
------------------------------


Should you submit username/password as role1/tomcat?
 
Amar Jee
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, typo in the post.
I'm trying role1/tomcat as user/pwd (this is not working ).
Using tomcat 6.0.20.
 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should work. Perhaps you could post complete web.xml and tomcat-users.xml files.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18156
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sumit anand kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18156
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic