This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Servlets and the fly likes User List in Container Managed Security Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "User List in Container Managed Security" Watch "User List in Container Managed Security" New topic

User List in Container Managed Security

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
I am using Container Managed Security and want to list/count the number of users authenticated so far. What would be the best strategy to do this? The problem is that the spec defines authenticated user as having non-null value in request.getUserPrincipal(). How could I count the number of Principal objects maintained by the container?
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

If the container doesn't allow a mechanism to exatract this information, you can look at ways to 'decorate' the login/logout process to maintain your own count. You can also add session listeners to track 'visitors' by finding sessions that do not have credentials attached.
I agree. Here's the link:
subject: User List in Container Managed Security
It's not a secret anymore!