Let's take a look at the following steps to add the UserDetailsService object:
- Now, we need to add a new implementation of the UserDetailsService object, we will use our CalendarUserRepository interface to authenticate and authorize users again, with the same underlying RDBMS, but using our new JPA implementation as follows:
//com/packtpub/springsecurity/service/UserDetailsServiceImpl.java
package com.packtpub.springsecurity.service;
... omitted for brevity ...
@Service
public class UserDetailsServiceImpl
implements UserDetailsService {
@Autowired
private CalendarUserRepository userRepository;
@Override
@Transactional(readOnly = true)
public UserDetails loadUserByUsername(final String username)
throws UsernameNotFoundException {
...