Shiro provides listener interfaces for being notified of events inside the framework. Two that might be related to what you're trying to accomplish are: - org.apache.shiro.authc.AuthenticationListener - org.apache.shiro.session.SessionListener With the AuthenticationListener, you can be notified when someone successfully logs in, fails a login attempt, or logs out. With the SessionListener, you could be notified when a session is started or stopped for a user (which happens automatically when they login and out, respectively, I believe). Hope this helps, Bryan Turner Katasoft, Inc
Date: Thu, 26 May 2011 11:04:58 -0400 Subject: Re: Counting logged users From: [email protected] To: [email protected] How accurate do you want to be? If use use login / logout / session expired events, I think your counts will be way off, as you don't know if a user is actually still viewing the page. You may need another lib that does some sort of polling from the client, if you want the information to be really accurate. If you just need to be kinda accurate, you could make some assumptions, (say count a user active for 2 minutes after every request they make) then just need some sort of access logging. On Thu, May 26, 2011 at 7:39 AM, Blaise Gervais <[email protected]> wrote: Dear Shiro users, There is two days ago, I have started to use Shiro in my web app (who use Spring and Spring MVC) and he works fine Now I want to display how many users logged in, so I have to react when users logs in and logs out to update a counter stored into the applicaion context but I don't know How to achieve that with Shiro ? Thanks
