Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Post - login processing

 
Wes Hughes
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm stuck on the problem of wanting to perform a specific action (setting a session attribute for display in the UI) after a user has logged in (using JAAS/j_security_check). At first I thought I'd apply a filter to j_security_check. Not supported. Then I decided to just apply a filter to all *.do requests. This works fine except for certain login situations, where j_security_check just forwards to the requested page and my filter is never called. So currently, when the user logs in to certain pages, the first page view is missing the session attribute I want to display and it looks buggy.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Wes Hughes:
Then I decided to just apply a filter to all *.do requests. This works fine except for certain login situations, where j_security_check just forwards to the requested page and my filter is never called.

A filter is definitely the way to go. It sounds like there are some pages that forward directly to JSPs, rather than the Struts action. If that is the case, you need to refactor the design a bit. You can still have the forward to a JSP by adding a level of indirection. Forward to an action path in the Struts config file. It doesn't have to be a full fledged action. Just having it in the struts config file will be enough to go through the ActionServlet. Then your filter will get called.
 
Wes Hughes
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:

A filter is definitely the way to go. It sounds like there are some pages that forward directly to JSPs, rather than the Struts action. If that is the case, you need to refactor the design a bit. You can still have the forward to a JSP by adding a level of indirection. Forward to an action path in the Struts config file. It doesn't have to be a full fledged action. Just having it in the struts config file will be enough to go through the ActionServlet. Then your filter will get called.


Bad terminology on my part, j_security_check is forwarding to the protected resource, in this case a Struts action. Problem was I was doing my work after chain.doFilter(), so it wasn't showing up in page I expected. Anyways, thanks for the help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic