File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Security Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Security" Watch "Security" New topic


Amir Ghahrai
Ranch Hand

Joined: Jun 19, 2002
Posts: 110
Hey guys,
I have a question related to web security with Java.
Currently, I'm reading the chapter on security issues for the scwcd exam.
My quesion is what is the best way to develop a website with login feature?
I always thought that when users register with a website, their username and password are stored in a database and then anytime they login, their username and password will be matched with the ones in the database. So, now that I'm reading topics about security and the elements of web.xml descriptor, I'm getting confused. How does this add extra security to a website, than just merely using a database to identify users?
Could someone please clarify this.

Nicholas Turner
Ranch Hand

Joined: May 24, 2003
Posts: 126
I use apache so if you configure your tomcat-users.xml to allow the users with roles then your login form executes against those
Philip Shanks
Ranch Hand

Joined: Oct 15, 2002
Posts: 189
Perhaps you are tripping over type of authentication vs. credential storage. The web.xml file has elements that let you specify not only the authentication realm, but what authentication type to use. This means that you specify where the username and password store is (realm), and how to go about collecting the user's credentials (type).
The authentication types are basic, digest, form-based and client-certificate. Form-based with an SSL connection is probably most common.
For realm, I would prefer to use a directory based lookup, but if your application allows new users to sign themselves up, this may not be feasible (the app would have to bind to the LDAP server with write privileges). The uid's and passwords can be kept in a database, and accessed via JDBC, which is what you were referring to. Least preferred is a file-based store.
Hope this helps!

Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!
I agree. Here's the link:
subject: Security
It's not a secret anymore!