aspose file tools*
The moose likes Servlets and the fly likes how can I get username in my web application. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how can I get username in my web application. " Watch "how can I get username in my web application. " New topic
Author

how can I get username in my web application.

ertan eyimaya
Greenhorn

Joined: Feb 16, 2005
Posts: 14
I use IIS 6.0 and Tomcat 5.5.7.

In IIS -> Directory Security -> Authentication Methods, I set the
"Digest Auth. for windows domain servers" checkbox so that users can
log on by domain username/passwords.

When user wants to enter the site windows login panel appears, after
entering the domain username/password user can login.

But I could not found a way to get the username in my jsp/servlet.
Is it possible? how?
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
SERVER || network || CLIENT || BROWSER

You can NOT have a Windows (or any other) login screen appear on a client by issueing any command from a server in a web application.
If you could I could also create a web application that shuts down your computer or formats its harddisk.


42
ertan eyimaya
Greenhorn

Joined: Feb 16, 2005
Posts: 14
sorry. I did not explain correctly. The login panel is not for windows login but web login.??? When you fallow the steps mentioned in the question in IIS it asks for username/password and If I enter a domain username/password web page opens.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

As far as I'm aware, that particular authentication mechanism stores hashed credentials for an authenticated user in Active Directory (or possibly against the Domain Controller, can't remember which). So the only place you can get them is from AD, except of course they will be hashed so no use to you. You can get the username if you use basic authentication (but of course, the password is send in clear text), or you could use NTLM. The vagueries of how to do that are dotted about the Security forum.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 363
Try here.


No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
Anil Sadi
Greenhorn

Joined: Jan 09, 2001
Posts: 23
Hi ertan,

It is possible with HTTP Basic Authentication. You need to declare the protected resources in web.xml file and specify the Basic Authentication. When a user tries to access the protected resources, the browser will prompt for the username/password. You can authenticate the user using the specified relam.

I hope it gives the answer to your question.

Anil Sadineni.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can I get username in my web application.