Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Windows User ID in java  RSS feed

 
Andy Hurst
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am trying to get the current logged on user's windows user id in a jsp page.
I am using tomcat 4.1.27 and have it deployed through IIS.
If I can't get this to work, I have just spent the last 2 weeks doing nothing.
Thanks guys,
Andy,
EDIT:: I have tried System.getProperty("user.name"); but that returns the windows id of the user that started the tomcat system. I also have IIS set so that anonymous access is off.
Thanks again.
[ October 24, 2003: Message edited by: dilbert ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch dilbert!
I'll attend to your question in my next response, but first...
There aren't many rules you'll have to worry about when participating in these forums, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
Thanks!
bear
JSP Forum Bartender
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now, onto your question which doesn't make a whole lot of sense to me.
What do you mean by 'current logged on user'? The person sitting at the browser on the client?
If so, that's not something Java's going to be able to help you with since the Java running on the server doesn't know anything about what's going on on the client except what the browser chooses to send it.
And I'm pretty sure that the currently logged on user isn't one of the things the browsers going to be sending along.
bear
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dilbert,
The open source jCIFS package handles this nicely. Just do a search. You can extend the NTLMServlet and then get the username. It will even allow seemless authentication. In other words, it can get the client password as well. This is an incredible package that will allow java developers to do things that were never possible in the past. I tried to do this about a year ago and found that it was virtually impossible. Just recently I came accross a post by Peter den Haan here on the ranch that pointed out this API. Only problem is that it's open source and that means the documentation is only so-so.
 
Andy Hurst
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Thanks guys,
As you can see I changed my display name, (sorry, my bad). I will look into the jCIFS package.
Thanks again.
Dilbert.... er Andy.
 
Andy Hurst
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found a much easier way to do this than to try to work with the jCIFS.
It only works if you are deploying your tomcat server onto a IIS platform.
It is simple to actually deploy the server using instructions on the tomcat home site but I only found one place that said to try this.
To the file jk2.properties in your Tomcat\conf folder add the line
request.tomcatAuthentication="false"
now you can use request.getRemoteUser();
That is much simpler.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!