Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Get Visiting Users Windows User Name

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 25814
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you plan to do about visitors not using Windows?
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
    Bookmark Topic Watch Topic
  • New Topic