• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

BASIC authentication not working

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
------------------------------
 
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should work. Perhaps you could post complete web.xml and tomcat-users.xml files.
 
Saloon Keeper
Posts: 28325
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 28325
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
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
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic