November 2017
Intermediate to advanced
542 pages
14h 24m
English
We will now update the AccountController object to use the LdapDetailsUserDetailsService interface to look up the user that it displays:
//src/main/java/com/packtpub/springsecurity/web/controllers/AccountController.java @Controller public class AccountController { private final UserDetailsService userDetailsService; @Autowired public AccountController(UserDetailsService userDetailsService) { this.userDetailsService = userDetailsService; } @RequestMapping("/accounts/my") public String view(Model model) { Authentication authentication = SecurityContextHolder. getContext().getAuthentication(); // null check omitted String principalName = authentication.getName(); Object principal = userDetailsService. ...Read now
Unlock full access