-2

When the user (client) tries to get into the application by typing the URL, i need to get that machine's windows logged in username.

I have tried with System.getProperty("user.name") but when I access the application from some other machine (client) then this still shows username of logged in user on server. I want this is to be changed according to the client machine username every time.

And also I have tried with some JavaScript code, it only works on IE but we are using Firefox.

Kindly suggest the possible ways to work with all kind of browsers.

Application Details:

View: Struts
Application Framework: Spring 3.1.1
Application Server: jboss-6.1.0.Final
Server OS: CentOS 5

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Deiva
  • 295
  • 2
  • 4
  • 5
  • 5
    If it's not sent with HTTP request, it's not accessible on server side. And no browser will send such information as this is potential security risk. – Tomasz Nurkiewicz Sep 07 '12 at 06:47

3 Answers3

0

For security purposes the amount of data applications running in a browser can access is limited. As far as I know, the only thing which is allowed access to client related data would be a Signed Applet.

npinti
  • 51,780
  • 5
  • 72
  • 96
0

Through java you will not be able to access it since it resides in server. You will have to use javascript to get it done...

This might help you..

Get Windows username with JavaScript?

Community
  • 1
  • 1
Andromeda
  • 12,659
  • 20
  • 77
  • 103
0

If this is for an intranet application, you can look at using NTLM (older) or Kerberos (newer) authentication (aka integrated windows authentication).

If you're using Spring security, look at the kerberos extension, http://blog.springsource.org/2009/09/28/spring-security-kerberos/.

pap
  • 27,064
  • 6
  • 41
  • 46