Removing references to UserDetailsManager
We need to remove the code we added in DefaultCalendarService that used UserDetailsManager to synchronize the Spring Security o.s.s.core.userdetails.User interface and CalendarUser. First, the code is not necessary, since Spring Security now refers to CalendarUserDetailsService. Second, since we removed the inMemoryAuthentication() method, there is no UserDetailsManager object defined in our Spring configuration. Go ahead and remove all references to UserDetailsManager found in DefaultCalendarService. The updates will look similar to the following sample snippets:
//src/main/java/com/packtpub/springsecurity/service/
DefaultCalendarService.java
public class DefaultCalendarService implements CalendarService {
private final EventDao eventDao;
private final CalendarUserDao userDao;
@Autowired
public DefaultCalendarService(EventDao eventDao,CalendarUserDao userDao) {
this.eventDao = eventDao;
this.userDao = userDao;
}
...
public int createUser(CalendarUser user) {
return userDao.createUser(user);
}
}
Start up the application and see that Spring Security's in-memory UserDetailsManager object is no longer necessary (we removed it from our SecurityConfig.java file).
Your code should now look like chapter03.03-calendar.