Code example for Principal

Methods: getName

0
	@Autowired 
	private ChefService chefService;
 
	@RequestMapping(value = "/show", method = RequestMethod.GET) 
	public String showProfile(@RequestParam(value = "error", required = false) boolean error, Principal principal, Model model) {
		final String username = principal.getName();
		 
		model.addAttribute("new_chef",chefService.loadChefByUsername(username));
		model.addAttribute("accessLevel", Role.values());
		return "new_chef"; 
	} 
}