Caso de uso - obtendo usuário logado

AuthService

protected User authenticated() {
  try {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    Jwt jwtPrincipal = (Jwt) authentication.getPrincipal();
    String username = jwtPrincipal.getClaim("username");
    return userRepository.findByEmail(username);
  }
  catch (Exception e) {
    throw new UsernameNotFoundException("Invalid user");
  }
}

UserService

UserController

Postman

Tem que ter bearerToken.

GET {{host}}/users/me

Atualizado