You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Reed <dr...@yahoo.com> on 2003/03/05 22:46:31 UTC

remember password HOW-TO?

Hi,

I am a relative newbie to servlet programming and I'm
not really sure how to best solve a problem I am
having.  I am trying to implement a "save my password"
feature on my web site.  I am using Tomcat 4.1.18.  I
am using form-based authentication and I am using the
Tomcat provided userdatabase to store my usernames,
passwords and roles.  The authentication part works
fine.  I would like to be able to provide the user an
option to save their password in a client cookie so as
to not require them to login every time they go to my
site.  I have some specific questions:

1. Can the form-login-page tag in the web.xml file
reference a servlet instead of a web page?  If so
would this be an appropriate place to trap the login
and check if the user has a pre-saved cookie?

2. Is there a tag in the web.xml that would allow me
to specifiy a custom authentication class?

I would assume that this is a very common feature
that's required on public web sites.  I would be
interested in any opinions on how this is typically
addressed by servlet developers.

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: remember password HOW-TO?

Posted by David Reed <dr...@yahoo.com>.
Thanks Will,  I'm beginning to understand I think.  If
I were to subclass the
org.apache.catalina.authenticator.FormAuthenticator
class where would I declare that class?  Would it be
somewhere in the web.xml or somewhere in the
server.xml or somewhere else?


--- Will Hartung <wi...@msoft.com> wrote:
> > From: "David Reed" <dr...@yahoo.com>
> > Sent: Wednesday, March 05, 2003 2:10 PM
> > Subject: Re: remember password HOW-TO?
> 
> 
> > Thanks Will,  So what are my alternatives to
> container
> > based authentication?
> 
> Common wisdom today would be to use Filters, as
> they're pretty much ideal
> for this depending on how your app is set up (i.e.
> if your app is fairly
> straightforward).
> 
> The real problem is that you can't mix and match.
> You either have to use
> Your Way entirely, or the Container Way. So, all of
> your code relying on the
> Servlet API for Roles and what not have to be
> changed, which is invasive and
> quite the drag.
> 
> If you're willing to beat on Tomcat, then you can
> probably more easily tweak
> the
> org.apache.catalina.authenticator.FormAuthenticator
> class, or subclass
> it which would be safer. Tweaking that to support a
> "remember me" function
> would be a lot less code for you to write than
> implementing your own entire
> system, plus you'll not have to change any of your
> interior security
> checking code.
> 
> Of course, this isn't portable to another container.
> 
> Someone else may have a pointer to a plug in
> Servlet/Filter based security
> system that's available on the web, I haven't looked
> myself.
> 
> Regards,
> 
> Will Hartung
> (willh@msoft.com)
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: remember password HOW-TO?

Posted by Will Hartung <wi...@msoft.com>.
> From: "David Reed" <dr...@yahoo.com>
> Sent: Wednesday, March 05, 2003 2:10 PM
> Subject: Re: remember password HOW-TO?


> Thanks Will,  So what are my alternatives to container
> based authentication?

Common wisdom today would be to use Filters, as they're pretty much ideal
for this depending on how your app is set up (i.e. if your app is fairly
straightforward).

The real problem is that you can't mix and match. You either have to use
Your Way entirely, or the Container Way. So, all of your code relying on the
Servlet API for Roles and what not have to be changed, which is invasive and
quite the drag.

If you're willing to beat on Tomcat, then you can probably more easily tweak
the org.apache.catalina.authenticator.FormAuthenticator class, or subclass
it which would be safer. Tweaking that to support a "remember me" function
would be a lot less code for you to write than implementing your own entire
system, plus you'll not have to change any of your interior security
checking code.

Of course, this isn't portable to another container.

Someone else may have a pointer to a plug in Servlet/Filter based security
system that's available on the web, I haven't looked myself.

Regards,

Will Hartung
(willh@msoft.com)




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: remember password HOW-TO?

Posted by Dan Tran <da...@hotmail.com>.
http://securityfilter.sourceforge.net/

----- Original Message ----- 
From: "David Reed" <dr...@yahoo.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, March 05, 2003 2:10 PM
Subject: Re: remember password HOW-TO?


> Thanks Will,  So what are my alternatives to container
> based authentication?  
> 
> --- Will Hartung <wi...@msoft.com> wrote:
> > > From: "David Reed" <dr...@yahoo.com>
> > > Sent: Wednesday, March 05, 2003 1:46 PM
> > > Subject: remember password HOW-TO?
> > 
> > > I am a relative newbie to servlet programming and
> > I'm
> > > not really sure how to best solve a problem I am
> > > having.  I am trying to implement a "save my
> > password"
> > > feature on my web site.  I am using Tomcat 4.1.18.
> >  I
> > > am using form-based authentication and I am using
> > the
> > > Tomcat provided userdatabase to store my
> > usernames,
> > > passwords and roles.
> > 
> > If you're using container based authentication
> > (which you are), then you can
> > not implement a "remember me" facility within the
> > Servlet API, there's
> > simply no mechanism for it exposed by the container.
> > 
> > Of course, you're welcome to beat on Tomcat itself
> > to provide this
> > non-portable functionality, but there's no way to do
> > it solely within your
> > web app.
> > 
> > The only other solution is to implement all security
> > using standard
> > mechanisms with Servlets et al, but that's a big
> > wheel to re carve out of
> > stone.
> > 
> > Regards,
> > 
> > Will Hartung
> > (willh@msoft.com)
> > 
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: remember password HOW-TO?

Posted by Mike Jackson <mj...@cdi-hq.com>.
You can write your own security.  It's really not that hard, you setup a
servlet or something that intercepts all page requests and validates the
user.  If they don't have permission, or aren't logged in you display a
login screen.  If they are you give them access.  If you want persistant
logins, you need to probably use a cookie (persistant cookie, not a
non-persistant one).

--mikej
-=-----
mike jackson
mjackson@cdi-hq.com

> -----Original Message-----
> From: David Reed [mailto:dreed47@yahoo.com]
> Sent: Wednesday, March 05, 2003 2:10 PM
> To: Tomcat Users List
> Subject: Re: remember password HOW-TO?
>
>
> Thanks Will,  So what are my alternatives to container
> based authentication?
>
> --- Will Hartung <wi...@msoft.com> wrote:
> > > From: "David Reed" <dr...@yahoo.com>
> > > Sent: Wednesday, March 05, 2003 1:46 PM
> > > Subject: remember password HOW-TO?
> >
> > > I am a relative newbie to servlet programming and
> > I'm
> > > not really sure how to best solve a problem I am
> > > having.  I am trying to implement a "save my
> > password"
> > > feature on my web site.  I am using Tomcat 4.1.18.
> >  I
> > > am using form-based authentication and I am using
> > the
> > > Tomcat provided userdatabase to store my
> > usernames,
> > > passwords and roles.
> >
> > If you're using container based authentication
> > (which you are), then you can
> > not implement a "remember me" facility within the
> > Servlet API, there's
> > simply no mechanism for it exposed by the container.
> >
> > Of course, you're welcome to beat on Tomcat itself
> > to provide this
> > non-portable functionality, but there's no way to do
> > it solely within your
> > web app.
> >
> > The only other solution is to implement all security
> > using standard
> > mechanisms with Servlets et al, but that's a big
> > wheel to re carve out of
> > stone.
> >
> > Regards,
> >
> > Will Hartung
> > (willh@msoft.com)
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: remember password HOW-TO?

Posted by David Reed <dr...@yahoo.com>.
Thanks Will,  So what are my alternatives to container
based authentication?  

--- Will Hartung <wi...@msoft.com> wrote:
> > From: "David Reed" <dr...@yahoo.com>
> > Sent: Wednesday, March 05, 2003 1:46 PM
> > Subject: remember password HOW-TO?
> 
> > I am a relative newbie to servlet programming and
> I'm
> > not really sure how to best solve a problem I am
> > having.  I am trying to implement a "save my
> password"
> > feature on my web site.  I am using Tomcat 4.1.18.
>  I
> > am using form-based authentication and I am using
> the
> > Tomcat provided userdatabase to store my
> usernames,
> > passwords and roles.
> 
> If you're using container based authentication
> (which you are), then you can
> not implement a "remember me" facility within the
> Servlet API, there's
> simply no mechanism for it exposed by the container.
> 
> Of course, you're welcome to beat on Tomcat itself
> to provide this
> non-portable functionality, but there's no way to do
> it solely within your
> web app.
> 
> The only other solution is to implement all security
> using standard
> mechanisms with Servlets et al, but that's a big
> wheel to re carve out of
> stone.
> 
> Regards,
> 
> Will Hartung
> (willh@msoft.com)
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: remember password HOW-TO?

Posted by Will Hartung <wi...@msoft.com>.
> From: "David Reed" <dr...@yahoo.com>
> Sent: Wednesday, March 05, 2003 1:46 PM
> Subject: remember password HOW-TO?

> I am a relative newbie to servlet programming and I'm
> not really sure how to best solve a problem I am
> having.  I am trying to implement a "save my password"
> feature on my web site.  I am using Tomcat 4.1.18.  I
> am using form-based authentication and I am using the
> Tomcat provided userdatabase to store my usernames,
> passwords and roles.

If you're using container based authentication (which you are), then you can
not implement a "remember me" facility within the Servlet API, there's
simply no mechanism for it exposed by the container.

Of course, you're welcome to beat on Tomcat itself to provide this
non-portable functionality, but there's no way to do it solely within your
web app.

The only other solution is to implement all security using standard
mechanisms with Servlets et al, but that's a big wheel to re carve out of
stone.

Regards,

Will Hartung
(willh@msoft.com)




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org