Adam
Adam

Reputation: 21

How do I get the curernt username of someone logged-in using JDBCRealm in Tomcat 6

I'm running Tomcat 6 and have implemented JDBCRealm to authenticate my users. I've got everything setup and authentication is working just fine.

My question is: how do I programmatically get the username of the user who is logged-in? Is this a session attribute that gets set? A Cookie?

This seems very trivial but I'm stumped. Any help is greatly appreciated. Thanks!!

Upvotes: 2

Views: 1761

Answers (1)

lobster1234
lobster1234

Reputation: 7779

You can try getting this information from HttpServletRequest using getUserPrincipal() call.

Upvotes: 2

Related Questions