[jboss-user] [Security & JAAS/JBoss] - Re: Forcing redirection to a specific page with j_security_c

lost_traveller do-not-reply at jboss.com
Tue Dec 5 08:03:58 EST 2006


I needed this too and after searching the forums it appears lots of people ask this question, the answer is that there is no neat solution, your best solution is to write a javax.servlet.Filter for every page that sets some session attribute when the user is logged in, e.g.


  |            public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
  |                 throws IOException, ServletException
  |             {
  | 
  |         HttpSession session = ((HttpServletRequest)request).getSession();
  |         if(session.getAttribute("login_flag") == null)
  |         {
  |               session.setAttribute("login_flag", "1");
  |               servletContext.getRequestDispatcher(welcomePage).forward(request, response);
  |         }
  |         else
  |         {
  |              chain.doFilter(request, response);
  |         }
  | 
  |             }
  | 
Its not nice but it works.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991269#3991269

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991269



More information about the jboss-user mailing list