title: How to get the remote user's username in java
body: <p>I am working on application which doesn't have any login mechanism, any user in my organization can use that. But I want to pick the username of the remote users who will use my tool. I have a button clicking on that I want to get their usernames.</p>
  
  <p>I tried <code>request.getRemoteUser</code> got <code>null</code>. tried <code>System.getenv("USERNAME")</code> getting the logged in user of the localhost where the server resides. Tried <code>getHostName</code>, <code>System.getProperty</code> got the localhost name. Tried this also - <code>new com.sun.security.auth.module.NTSystem().getName()</code> but same result.</p>
  
  <p>I am using java6, windows server and glassfish3 server.</p>
  
  <p>Please suggest something as I don't want to use any external link and tool.</p>