Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to determine user with Tomcat JDBC Realm

 
Doug Braidwood
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there,

I am trying to write a little web application which will allow users to log in, and enter or retrieve data from a database.

I am using Tomcat and MySQL

It is basically working, my java components can talk to the database and I am using the JDBC realm in Tomcat for security. So I have a users and a user_roles table in the Database and Tomcat uses this to authenticate.

My question/problem is how to know which user has logged on. I would have thought this would be a session attribute but it doesn't seem to be.
Can you help?
 
Karthik Shiraly
Bartender
Posts: 1208
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

HttpServletRequest contains methods for programmatic security - getRemoteUser(), isUserInRole(), etc.
 
Doug Braidwood
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Karthik, that's exactly what I was looking for.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic