title: Convert Wordpress session to user id
body: <p>I am working on a WordPress plugin and I have a problem where I get the WordPress logged-in users id &amp; session and i need to create a comment on this user's behalf from my server. </p>
  
  <p>[Update] What I mean by "my server" is from my own Java server. My comment system creates the comments on the Java server and the Java server needs also to create the same comment on the wordpress PHP server. In order to create the comment on the user account i am sending the session to the Java server so it will as the wordpress to convert the session to the user, so it will be secure.
  [/update]</p>
  
  <p>The problem is that in order to make this operation secure i need to check with WordPress that the session i got is valid and matches the user id. </p>
  
  <p>I couldn't find any API that convert the session into the user id in order to check that it matches.</p>
  
  <p>anyway to do that with WordPress API?</p>