• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get HTTP Session username?

 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpServletRequest has the getUserPrincipal and getRemoteUser methods, which return this information.
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perfect! Thanks a bunch!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic