aspose file tools*
The moose likes JDBC and the fly likes How to determine user with Tomcat JDBC Realm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to determine user with Tomcat JDBC Realm " Watch "How to determine user with Tomcat JDBC Realm " New topic
Author

How to determine user with Tomcat JDBC Realm

Doug Braidwood
Ranch Hand

Joined: Apr 04, 2010
Posts: 42
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?


SCJP, SCWCD
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 475
    
    3
Hi,

HttpServletRequest contains methods for programmatic security - getRemoteUser(), isUserInRole(), etc.
Doug Braidwood
Ranch Hand

Joined: Apr 04, 2010
Posts: 42
Thanks Karthik, that's exactly what I was looking for.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to determine user with Tomcat JDBC Realm
 
Similar Threads
question about user roles
Multiple Realm Possible?
what is realm. ???
question about tomcat JDBC realm.
Tomcat with more than one Applications in WEBAPPS folder