appfuse generated basic struts project how to access the logged in user from action

2008-02-12 Thread Prashant Khanal
Hello all, I am working on the appfuse generated basic struts 2 project. It uses acegi as a security framework for authentication and authorization. How can i access the logged in user from the action? To show the logged in user in the header.jsp page i used a jstl tag provided by acegi as:

Re: appfuse generated basic struts project how to access the logged in user from action

2008-02-12 Thread Prashant Khanal
hello all anyway i got the answer but dunno whether or not it is appropriate i wrapped the jsp snippet to hide it if the user is not logged in as authz:authorize ifNotGranted=ROLE_ANONYMOUS div style=float: left; width: 100%; text-align: right;Welcome authz:authentication

Re: appfuse generated basic struts project how to access the logged in user from action

2008-02-12 Thread Jeromy Evans
Prashant Khanal wrote: To get the logged in user from the action i used : SecurityContext ctx = SecurityContextHolder.getContext(); if (ctx != null) { Authentication auth = ctx.getAuthentication(); User loggedInUser = (User) auth.getPrincipal(); }