I\'m using Spring Security 3 and Spring MVC 3.05.
I would like to print username of currently logged in user,how can I fetch UserDetails in my Controller?
Let Spring 3 injection take care of this.
Thanks to tsunade21 the easiest way is:
@RequestMapping(method = RequestMethod.GET) public ModelAndView anyMethodNameGoesHere(Principal principal) { final String loggedInUserName = principal.getName(); }