my dog learned polymorphism
The moose likes Servlets and the fly likes Authnetication and getRemoteUser() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Authnetication and getRemoteUser()" Watch "Authnetication and getRemoteUser()" New topic

Authnetication and getRemoteUser()

Emil Karlsson
Ranch Hand

Joined: May 23, 2002
Posts: 63
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

Joined: Jul 31, 2003
Posts: 263
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:

Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
Have you checked out Aspose?
subject: Authnetication and getRemoteUser()
jQuery in Action, 3rd edition