File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to get HTTP Session username? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to get HTTP Session username?" Watch "How to get HTTP Session username?" New topic
Author

How to get HTTP Session username?

Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
I'm using FORM authentication under Tomcat 5. Everything works fine, but I'm trying to get the name of the logged in user, as it's stored in the session authentication. Is there a Principal, or Identity instance I can grab from the session in order to display the currently logged in user?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
HttpServletRequest has the getUserPrincipal and getRemoteUser methods, which return this information.


Ping & DNS - my free Android networking tools app
Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
Perfect! Thanks a bunch!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get HTTP Session username?
 
Similar Threads
How to prevent multiple logins
Checking for Session Timeout
Logoff button - what to do?
Weblogic Session Issue
Query regarding Session Tracking