This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes How do u find out the client username? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How do u find out the client username?" Watch "How do u find out the client username?" New topic
Author

How do u find out the client username?

Dean Fredericks
Ranch Hand

Joined: Dec 04, 2004
Posts: 60
Ive set up security in my web.xml, and server.xml

I see the method req.isUserInRole(),

But what I really want is the calling clients username.

How do I get this??

Thanks
Dean


PLEASE WATCH THIS VIDEO: <a href="http://www.glumbert.com/media/dolphin" target="_blank" rel="nofollow">http://www.glumbert.com/media/dolphin</a><br /> <br /><-- that video is no joke. Spread the word... this cant go on!!!<br /> <br />SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCMAD 1.0
Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
"request.getRemoteUser()" is that what you want?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41591
    
  55
Try req.getUserPrincipal().getName().


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do u find out the client username?