Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Get NT Username  RSS feed

 
Dave Bosky
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone show me an example of how to obtain the NT Username of the person accessing my JSP page? I found a code snippet that was supposed to do the task but it only returns 'SYSTEM', not the actual user.
//System.getProperty("user.name");

I've done it before so easily using Cold Fusion but can't seem to locate an example in Java/JSP that actually works.

Thanks,
Dave
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This will get you the user.name property for the environment your JSP page is running on not the username of a client making a request to it.

The way you are supposed to do this is by using NTLM - which is an authorization scheme used by MS products. So it will only work with IE.

I'd suggest unless you have a specific, valid reason to need single signon behaviour don't try this. The easiest way to find out who a user is is to ask the user with some other, non-proprietory authentication mechanism.
[ February 02, 2005: Message edited by: Paul Sturrock ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!