Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Java Servlet get the logged in user name  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I deployed my servlet in server using tomcat. It basically have some input fields and save changes button. When someone writes something and click save I want to save changes to DB along with the PC name and logged user name of the client's PC. Everything is done till updating PC name and Username of client. I can get PC name by How can I get username? I tried many things such as (returns null, also returns null. How to change auth type?) and also tried (returns server username where as I need client username) and doesnt do the trick as well

(By username I mean the username by which logged in to PC.)
 
Master Rancher
Posts: 3630
40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm pretty sure that, outside of some authorisation mechanisms (and I can't actually think of one that would), that data is not passed in a request.
That would strike me as a security hole if that data was sent as a matter of course.  Who wants their login id for their machine being sent out?
 
Jayachandra Ch
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
am not sure about java but it can be done with asp.net, we can get data of the client
 
Dave Tolls
Master Rancher
Posts: 3630
40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jayachandra Ch wrote:am not sure about java but it can be done with asp.net, we can get data of the client



Is that only if the client is a Windows box?
Is it doing windows based auth?

Essentially, the logged in user of a device is not a standard part of an http request header.
 
author & internet detective
Sheriff
Posts: 38564
654
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jayachandra,
What are you using for login now? Some single sign on applications add a request header.

If you are looking for the username that was used to login to the computer, that's not available in Java.
 
Jayachandra Ch
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just want to get the pc's username who edits my servlet. If the username is there in DB it gives special privileges else it will skip. I dont need password (if at all we can do so), i need pc name and current logged in username in pc. Looking for any small procedure to achieve it. Thankyou
 
Author and ninkuma
Marshal
Posts: 66804
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not possible without a client-side agent (ActiveX, signed applet, etc).

So what do you expect to do if someone visits from a Mac? Linux? An iPhone? A Galaxy Note (before it catches fire)?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!