Acegi Security may be of interest as it provides the functionality you have described, it's based on the Spring Framework, but will save re-implementing the wheel.
It also includes a
JSP Tag library for protecting links/content on the page.
http://www.acegisecurity.org/ Regards
Jason
[ February 14, 2007: Message edited by: Jason Moors ]