diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/service/session/UserDetailServiceImpl.java b/bookstore/src/main/java/com/fjordtek/bookstore/service/session/UserDetailServiceImpl.java index 7213455..b5b4df4 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/service/session/UserDetailServiceImpl.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/service/session/UserDetailServiceImpl.java @@ -67,6 +67,10 @@ public class UserDetailServiceImpl implements UserDetailsService { User currentUser = userRepository.findByUsername(userName); + if (currentUser == null) { + throw new UsernameNotFoundException(""); + } + UserDetails userDetails = new org.springframework.security.core.userdetails.User( userName, currentUser.getPassword(), getUserGrantedAuthorities(userName) );