I am currently redesigning a web application that requires user authentication and has column level security on reporting pages (user can or can't see certain columns of a table).
I have implemented a basic DAOFactory and am using an interceptor much like the one on
http://www.hibernate.org/43.html
Lets say the follwing Action validates a user against the database and returns his/her "session" information (security settings, profile info, etc).
Code:
public class LoginAction extends Action
{
@Override
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
UserDAO dao = new UserDAO();
User u = dao.getUserById("402884af1a97a4ec011a97a511560001");
request.setAttribute("user", u);
return new ActionRedirect(mapping.findForward("success"));
}
}
This problem that i'm having is this is only good for the forward page (in this case index.jsp. My question is, how do I make the user info "persist" across pages for the lifetime of the user (until he closes the webbrowser). I thought to set it in request.getSession() but then i would have to update that anytime a user made changes to their info and saved to the database (hibernate). Am I completely missing it? Is there another way?
Thanks for any help!