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();
}
As an alternative, your action may implement PrincipalAware
http://struts.apache.org/2.x/docs/servlet-config-interceptor.html
The advantage of PrincipalAware over the static call above is that it's
easier to unit-test your action outside of the servlet context and it's
clear to other developers that the action requires the principal.
regards,
Jeromy Evans
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]