-
Notifications
You must be signed in to change notification settings - Fork 28
Description
this.userDetailsService.loadUserByUsername is called with a username (jwtService.extractUsername(jwt) extracts the username, not the email), and later UserDetails userDetails = this.userDetailsService.loadUserByUsername(userEmail); is called. This function comes from applicationConfiguration.java, where userDetailsService is implemented with userRepository.findByEmail(username). As emails aren't usernames, these functions cause a UsernameNotFoundException to be thrown when attempting to do any request to the server with valid authorization tokens.
If you change userRepository.findByEmail to userRepository.findByUsername in ApplicationConfiguration.java and add Optional<UserKoko> findByUsername(String username); in UserRepository.java, this problem is fixed, and the code works as intended.
Thanks!