Get windows client login user name in a servlet/JSP
<p>I am having one servlet where I am trying to get windows user name. I am getting the correct host name but unable to get the correct user name for different machines. I have tried to deploy that servlet in my machine and sharing the URL to different folks, when they are hitting that URL, I am getting my machine user name (windows), not others. 
I have tried with below codes:</p>

<pre><code>String userName = new com.sun.security.auth.module.NTSystem().getName();
</code></pre>

<p>and</p>

<pre><code>String userName = System.getProperty(“username”);
</code></pre>

<p>and</p>

<pre><code>System.getProperty("user.name");
</code></pre>

<p>In my servlet I am trying to check it, I am sharing my URL to different person but always I am getting same user name like it’s my user name but the host name I am getting correct one.</p>

<p>Can you please suggest me.</p>