You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by Les Hazlewood <lh...@apache.org> on 2009/09/10 16:50:17 UTC

Querying sessions based on user id or other criteria

A question on the user list under the thread title "Tracking last
accessed time for a user" made me think of something that I've come
across more than a few times in my own applications and I think would
be a really great addition to Shiro - something that no other Java
open source project can offer (to the best of my knowledge).

It is often desirable to be able to query a session based on criteria
- usually user id, start timestamp, last access timestamp, host
address or any combination thereof.

If Shiro's Session had a getPrincipal() and getPrincipals() :
PrincipalCollection methods on it and that data was set on the Session
after log-in, then this could translate to queryable properties.

This is very useful in applications that like to show the total number
of current users, or that might wish to access a session based on user
id (to see if they're currently logged in perhaps) and a whole other
set of useful information.

I think adding these two methods to the interface would be a very
powerful addition to the framework.  We'd have the ability to present
information that many people would like in applications but that does
not yet exist in an OS offering (that I know of).

I've done this on my own applications by sub-classing and
sub-interfacing things in Shiro, but it'd be much nicer IMO if it
could be part of the framework.  Any objections to me adding a Jira
issue to support this?  Thoughts?