Created
December 6, 2017 20:35
-
-
Save ugurcemozturk/98c795bd6ac076eb816dfa611f40ef55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class UserDetailsServiceImpl implements UserDetailsService { | |
private DeveloperRepository developerRepository; | |
public UserDetailsServiceImpl(DeveloperRepository developerRepository) { | |
this.developerRepository = developerRepository; | |
} | |
@Override | |
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { | |
Developer developer = developerRepository.findByUsername(username); | |
if (developer == null) { | |
throw new UsernameNotFoundException(username); | |
} | |
return new User(developer.getUsername(), developer.getPassword(), emptyList()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment