October 2018
Intermediate to advanced
590 pages
15h 5m
English
We will implement UserDetailsService inside the existing UserApplicationServiceImpl and let's change the UserApplicationService interface to extend UserDetailsService, as shown here:
public interface UserApplicationService extends UserDetailsService { ...}
Here is the change to UserApplicationServiceImpl:
...public class UserApplicationServiceImpl implements UserApplicationService { ... @Autowired private UserRepository userRepository; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { if (StringUtils.isEmpty(username)) { throw new UsernameNotFoundException("No user found"); } User user; if (username.contains("@")) { user = userRepository.findByEmailAddress(username); ...Read now
Unlock full access