Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > User authentication in Tomcat -- best practices?

Reply
Thread Tools

User authentication in Tomcat -- best practices?

 
 
Eduardo
Guest
Posts: n/a
 
      08-29-2004
Hello, I would like to know what do people use for
user authentication in Tomcat.

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.

Number 1) seems the easiest solution, but I wonder how
many people use it? It doesn't seem too portable to
other non-Tomcat platforms... Anybody using it for
your apps?

Finally, is there any Number 3) option that I am missing?

Thanks in advance for the help!

Eduardo
 
Reply With Quote
 
 
 
 
Sudsy
Guest
Posts: n/a
 
      08-29-2004
Eduardo wrote:
<snip>
> 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.
>
> Number 1) seems the easiest solution, but I wonder how
> many people use it? It doesn't seem too portable to
> other non-Tomcat platforms... Anybody using it for
> your apps?
>
> Finally, is there any Number 3) option that I am missing?

<snip>

I use a variant of option 2, redirecting users to a SECURE login
page if they're not currently logged-in. Save the URL they
originally requested and forward them upon success.
There should be lots of freely-available code showing how to do
this, BTW. You can also use filters so that your JSP authors
don't have to worry about what's happening "under the covers".
Again, documentation should abound.

 
Reply With Quote
 
 
 
 
Oscar kind
Guest
Posts: n/a
 
      08-30-2004
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
 
Reply With Quote
 
Eduardo
Guest
Posts: n/a
 
      08-31-2004
Thanks for the responses everybody!

(Eduardo) wrote in message news:< om>...
> Hello, I would like to know what do people use for
> user authentication in Tomcat.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
J2EE module / library for user management, authentication, ACL etcwith Tomcat? Ramon Java 5 03-25-2010 12:47 PM
Best practices for using forms authentication and security in a hosted env (was: Re: Using a Forms authentication in a shared hosting environment) JEFF ASP .Net 1 11-12-2007 07:00 PM
802.11 X port-level authentication or user-level authentication zillah Wireless Networking 0 11-09-2006 10:00 AM
Apache Tomcat 4.1.24: problem with Tomcat Administration link Christos Gravvanis Java 0 07-07-2004 05:21 PM
[TOMCAT] Tomcat crashes %=zerointeractive.it% Java 1 01-22-2004 12:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57