The UserDetailsService object
Let’s take a look at the following steps to add the UserDetailsService object:
- Now, we need to add a new implementation of the
UserDetailsServiceobject; we will use ourCalendarUserRepositoryinterface to authenticate and authorize users again, with the same underlying RDBMS, but using our new JPA implementation, as follows://com/packtpub/springsecurity/service/ CalendarUserDetailsService.java @Component public class CalendarUserDetailsService implements UserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { CalendarUser user = calendarUserDao.findUserByEmail(username); if (user == null) { throw new UsernameNotFoundException("Invalid username/password."); } return new CalendarUserDetails(user); } } - Now, we have to configure...