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

XML Login

davidb
Greenhorn

Joined: Nov 16, 2003
Posts: 2
Hi,

I a mtrying to right a servlet that will take a username and password that has been [osted to it from a form and then use that to check against a xml document to see if the username and password are valid.

If they are valid then it should direct the user to a welcome page.

can anyone help, i'm not really sure where to start?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Apache Tomcat already does all of this. If you use FORM based authentication, it allows you to pass in the username and password, and the default location for authentication details is the tomcat-users.xml file in the <tomcat_home>/conf directory.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"homer homer"
We're a friendly bunch here at the ranch, but we take display names very seriously.

We require display names to be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and fix your display name.

thanks,
Dave.
davidb
Greenhorn

Joined: Nov 16, 2003
Posts: 2
Does anyone have an example of how you could use that?

The XML user/login stuff that is?
[ March 10, 2006: Message edited by: davidb ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"davidb", please read my request more closely.
I appreciate you changing your diaply name, but display names must be two words: your first name, a space then your last name.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

You can check out the config for the tomcat-users.xml file here, I'll need to go find a link for configuring the FORM based authentication, although it's just config settings in the web.xml file and therefore standard J2EE.
Thanh Cute
Greenhorn

Joined: Mar 15, 2006
Posts: 2
Or you can write your own custom realm, and parse your XML document yourself, I guess. Check out the security section of the J2EE Tutorial. Howerver, I think using JDBCRealm of Tomcat is easier and more convenient when you already have an existing database that includes usernames, pass, and roles..

cheers,
[ March 15, 2006: Message edited by: Thanh Cute ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML Login