-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
The following section of code accesses the database twice: once to retrieve the UserDetails required by Spring Security, and again to obtain all user data to return in the request. Also, the ResourceNotFoundException is never thrown if the user's email does not exist; the UsernameNotFoundException exception is thrown first when usuarioDetallesService.loadUserByUsername is called.
UserDetails userDetails = usuarioDetallesService.loadUserByUsername(loginDTO.email());
Usuario usuario = usuarioRepository.findByEmail(loginDTO.email())
.orElseThrow(() -> new ResourceNotFoundException(
"No existe ningún usuario con el email proporcionado"
));
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working