Hello,

 

   I am using struts 2.0.6.  I wrote an interceptor to use with Acegi
security to place the UserDetails object on the request so I could
access it on my JSP page.  However when I tried to access the object on
the page, it was not found.  

 

I then instead placed it on the session using the following which
worked:

 

[code]

final ActionContext context = invocation.getInvocationContext();

HttpServletRequest request = (HttpServletRequest)
context.get(HTTP_REQUEST);

HttpSession session = request.getSession();

 

Authentication auth =
SecurityContextHolder.getContext().getAuthentication();

if(auth != null)

{

    if(auth.getPrincipal() instanceof UserDetails)

    {

           IrUser user = (IrUser)auth.getPrincipal();

           session.setAttribute("user", user);

     }

}

return invocation.invoke(); 

[/code]

 

I was wondering is there any way to place this information on the
request in an interceptor.

 

Thanks for the help.

-Nate

Reply via email to