File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Need Help with FORM Based Authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Need Help with FORM Based Authentication" Watch "Need Help with FORM Based Authentication" New topic
Author

Need Help with FORM Based Authentication

K DeLucia
Ranch Hand

Joined: Apr 11, 2008
Posts: 68
I'm trying to get Tomcat FORM based authentication to work and I'm not having any luck. I'm sure it's something stupid I'm missing, but I haven't been able to figure it out.

I have the following in my <tomcatRoot>\webapps\RFS7\WEB-INF\web-xml


I have the following in my <tomcatRoot>\webapps\RFS7\WEB-INF\rfs7.xml (I want this login/security to only apply to this application, at least for now)


I have the following in the <TomcatRoot>\conf\tomcat-users.xml file:


And my login form contains (among other things) this:


When I bring up the application at this url: http://localhost/RFS7/request.jsp the page comes up perfectly, but I'm not prompted to login like I expected. What am I doing wrong?

Do I need to edit the server.xml at all? Any pointers or help are much appreciated. Thanks!

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41104
    
  45
<url-pattern>/RFS7/*</url-pattern>

URL patterns are relative to the web app root; try "/*" instead.

I have the following in my <tomcatRoot>\webapps\RFS7\WEB-INF\rfs7.xml

What's the significance of this file?

I have the following in the <TomcatRoot>\conf\tomcat-users.xml file:

That file should contain the users and their password and roles; I'm surprised this doesn't cause an exception.


Ping & DNS - my free Android networking tools app
K DeLucia
Ranch Hand

Joined: Apr 11, 2008
Posts: 68
Thank you! It's working now. The main problem was the url-pattern.

The rfs7.xml was something I added as I tried to work through this. Somewhere I found information about adding an xml file specific to the application, but I'll just forget all about that. ;-) I deleted it.

And my tomcat-users did contain users, passwords and roles. I mistakenly posted the wrong file contents.

In any case, thank you very much for the help!
Karen
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Help with FORM Based Authentication
 
Similar Threads
Problem with Form Based Security - Login Brings up CSS Page
Declarative Security with Java EE (Glassfish)
getting error when deploying web app in weblogic 10.0
he doesn't ask for authenticate
java.lang.RuntimeException: Cannot find FacesContext