title: How to return the whole user in successfulAuthentication method?
body: <p>I want to return the user in the response body after sucessful login.
  My code:</p>
  
  <pre><code>  @Override
      protected void successfulAuthentication(HttpServletRequest req,
                                              HttpServletResponse res,
                                              FilterChain chain,
                                              Authentication auth) throws IOException, ServletException {
  
          String token = JWT.create()
                  .withSubject(((User) auth.getPrincipal()).getUsername())
                  .withExpiresAt(new Date(System.currentTimeMillis() + expirationTime))
                  .sign(HMAC512(secret.getBytes()));
          res.addHeader(headerString, tokenPrefix + token);
  
          UsersEntity dbUser = new UsersEntity();
          dbUser = userRepository.findByUserLogin(((User) auth.getPrincipal()).getUsername());
  
          String json = new ObjectMapper().writeValueAsString(dbUser);
          res.getWriter().write(json);
          res.flushBuffer();
  
      }
  </code></pre>
  
  <p>But seems like it doesn't allow to extract the user from DB by username.
  I followed the guide: <a href="https://auth0.com/blog/implementing-jwt-authentication-on-spring-boot/" rel="nofollow noreferrer">Guide link</a></p>