This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Authnetication and getRemoteUser()

 
Emil Karlsson
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I wondering if it is possible to get user username the user has logged on to his w2k with and then use it in a servlet/jsp?
More precisly is it like this I want to do:
1. When a user clicks on a link, his w2k username is fetched and checked against some data that is is stored in a dataset.
2. If the dataset contains the username it will display the desired page. If NOT the dataset contains the username it will display a message page.
-- in other words I don't want to have some username/password to be entered?
Is it possible and if so, how?
/Emil Karlsson
 
Tom Blough
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get the user name you will have to make a native call to a Windows dll. The function you need is WNetGetUser in MPR.DLL. Chech the WinAPI from Micro$oft for details.
I have not coded it in Java, but here it is in VB:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic