Eduardo <> wrote:
> I am developing a small application with servlets and
> JSP where I want:
>
> - users log in before being able to do anything
> - if the user is not logged in and tries to access
> any other page, he gets the login page instead
> - the usernames and passwords live in a database
>
> As I see it, there are two main options for achieving
> this:
>
> 1) Use JDBC realm to authenticate against the database
>
> 2) Add code at the top of all the pages to verify that
> the user is logged in, etc.
>
> Finally, is there any Number 3) option that I am missing?
J2EE security:
- Associate a security role with all pages but the login page and error
pages (they don't contain any business functionality)
- Each user that isn't logged in is redirected by the container (Tomcat
for example) to the login page.
- Configure the container to do one of the following:
- Execute your code to authenticate a user (for example using JAAS)
- Go to the database itself
- ... (see the container documentation for more possibilities)
--
Oscar Kind
http://home.hccnet.nl/okind/
Software Developer for contact information, see website
PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2