Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

User Name and Basic authentication

 
Mohan Panigrahi
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I am using basic authentication. The user enters correct user_id and password once, and as long his session does not expire, he remains "validated" to access the protected resources.

Now, in one of my JSPs/servlets,I want to get access the userId field for some database query. Does tomcat or other containers would store the user_id field (entered by user during authentication) somewhere in session, so that I can access it from JSP pages?

Thanks,
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that HttpServletRequest.getUserPrincipal().getName() solves your problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic