Browse Source

Properly handle events when user is not found

Signed-off-by: Pekka Helenius <fincer89@hotmail.com>
v0.0.3-alpha
Pekka Helenius 4 years ago
parent
commit
71476ab1db
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      bookstore/src/main/java/com/fjordtek/bookstore/service/session/UserDetailServiceImpl.java

+ 4
- 0
bookstore/src/main/java/com/fjordtek/bookstore/service/session/UserDetailServiceImpl.java View File

@ -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)
);


Loading…
Cancel
Save