Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Tomcat BASIC Authentication Problem.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I'm new to Tomcat, and I am having an issue with setting up basic authentication for my app. I have the last Tomcat installed (6.0.32) and it is serving out a web application called Geoportal. To add an extra level of security I wanted to apply Basic authentication for this app and I successfully did so, the authentication login screen opens when I go to http://localhost:8080/geoportal/. However, after successfully signing into the page once I click to go to a new page in the app I makes me login once again.

What am I missing, I feel that once I sign in at the beginning it should retain my information in the memory so I don't have to re-authenticate. Could someone please help me with this or point me to a resource that could answer my question?

Thank,
Nick
 
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nicholas Jackson wrote: I wanted to apply Basic authentication for this app and I successfully did so



It looks like not very successfully How did you do it exactly?

 
Nicholas Jackson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah I guess not exactly successful

But below is the code that I placed in the server.xml, tomcat-users.xml, and the webapp web.xml

server.xml


tomcat-users.xml


Webapp web.xml


Like I stated before it does allow me to login to the first page but when I try to go to any of the other pages, I get the login screen again.

Thanks in advance for any help.

Nick
 
Saloon Keeper
Posts: 24551
168
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
BASIC authentication doesn't use a login screen. Typically, the user's browser will pop up a modal dialog.

You didn't provide a lot of details, but I suspect that you wrote your own login code in the webapp. The security system in web.xml doesn't work with user-supplied login code, it employs login code that's part of the server itself (Tomcat). If you try and mix the 2 different types of security, unpredictable things can happen, but having a login that doesn't really log you in (as far as Tomcat is concerned) is not uncommon. And if Tomcat doesn't think you're logged in, it will continue to send login requests back to the user until you either attempt to access a non-secured resource (URL) or you log in properly.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic