File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Get Visiting Users Windows User Name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Get Visiting Users Windows User Name" Watch "Get Visiting Users Windows User Name" New topic
Author

Get Visiting Users Windows User Name

Bob Smith
Greenhorn

Joined: Sep 10, 2008
Posts: 12
I'm Developing an Intranet site using Tomcat and JSP. Is there an easy way to grab the visiting user's windows username? Can I do this with Java? What about JavaScript?

I want to make a page that will recognize the current user, and submit their username with the record they submit to a database.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18124
    
    8

There's a package called jCIFS (google it) which tries to do this. I believe that if it works if your users are using Internet Explorer to connect but probably not other browsers. Anyway check it out and see if it fits your requirements.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
You must have captured that username at some point by asking for it. Then you can store it as a Cookie on their machine, and it will be sent on subsequent visits. Not sure how you can get a user's name without asking for it.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

What do you plan to do about visitors not using Windows?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Javascript solutions are only going to work in a certain webbrowser developed by a team in Redmond, which supports ActiveX. But still then, the client may need to confirm security alerts and/or configure the security settings to let it get to work.

Java solutions are only going to work in flavour of a signed applet or web start application which you embed in your JSP. Both are able to run entirely at the client side. You can't do anything from in the server side.
Bob Smith
Greenhorn

Joined: Sep 10, 2008
Posts: 12
I haven't capture the username, that's what I'm trying to figure out how to do. This is an Intranet page, everyone uses windows here.

In ASP I could do this with one setting on ISS and one line of code. I thought it may be easy in JSP/Tomcat. No one has ever done this?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Bob Smith wrote:I haven't capture the username, that's what I'm trying to figure out how to do. This is an Intranet page, everyone uses windows here.

In ASP I could do this with one setting on ISS and one line of code. I thought it may be easy in JSP/Tomcat. No one has ever done this?

It undoubtely makes use of ActiveX and/or Active Directory. Both are, again, platform specific. Java/JSP was never intented to be platform specific. Maybe you're using the wrong tool here.
Bob Smith
Greenhorn

Joined: Sep 10, 2008
Posts: 12
Bauke, Maybe this is the wrong tool, but it is the one I'm stuck with. I'll look into seeing if we can somehow have ActiveX turned on just for this page.

Another option, since there is no easy way to do this with JSP I guess I could have the user enter their Username and then do a check against AD w/ JNDI. That should work. I could have the user enter their username and on submit of the form, look them up in AD w/ JNDI, verify their username is correct, the submit the data.

Thanks for everyones response. JSP/Java is new to me. I'm used to the ASP/VB world.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
If you stick to using Java for this, then the only right approach is to use a signed applet or webstart application (JNLP) for this, as said before.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get Visiting Users Windows User Name
 
Similar Threads
redirect success action to previous page
windows user name
help needed........
Reading password information from a text file.
How to send Parameters from JSP to a Servlet?