tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <fzli...@omnytex.com>
Subject Re: Concurrent login detection - how?
Date Tue, 14 Jun 2005 22:19:41 GMT
A SessionContextListener gets called when a session times out, or is 
otherwise invalidated.  This is how you do it.  I did this in an app 
some time ago... I just needed to maintain a list of who was logged in. 
    You can do something simple like I did: have a UsersList object with 
a single static HashMap in it.  In that HashMap goes User objects.  When 
the session is created, the listener is called, and you put the User 
object in it.  When the session is destroyed, you remove it.  I keyed 
the HashMap off user ID, you can do it however you like.  Just be sure 
to take concurrency into account and it works rather well.  You could do 
it to a database if your requirements make that a better choice.

Frank

Michael Mehrle wrote:
> That actually goes to the heart of my question: HOW do I detect when 
> their session times out? ;-)
> I know the 'strategy' of doing this, but I don't know how to capture a 
> timed-out session - technically. Any input would be welcome.
> 
> TIA,
> 
> Michael
> 
> ----- Original Message ----- From: "David Rickard" 
> <David.Rickard@techbooks.com>
> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> Sent: Tuesday, June 14, 2005 9:53 AM
> Subject: Re: Concurrent login detection - how?
> 
> 
> 
>> Remove IDs from the List when users log out (and add a
>> ServletContextListener to catch people who leave the site without logging
>> out--remove their IDs when their sessions time out);
>>
>> At 09:22 AM 6/14/2005, you wrote:
>>
>>> What is the best way to detect two people being logged in 
>>> concurrently using
>>> the same account? This is one aspect of my efforts to restrict 
>>> fraudulent
>>> access. Again, I don't want to use Acegi since it seems to break the 
>>> rest of
>>> my app. So, what's the best way to do this 'traditionally'?
>>>
>>> Thanks!
>>>
>>> Michael
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>
>>
>> -- 
>>
>> David Rickard
>> Software Engineer
>>
>> TechBooks/GTS
>> Your Single Source Solution!
>> Los Angeles CA * York, PA * Boston,MA * New Delhi, India
>> Visit us on the World Wide Web
>> <http://www.techbooks.com>http://www.techbooks.com
>>
>> david.rickard@techbooks.com
>> 5650 Jillson St., Los Angeles, CA 90040
>> (323) 888-8889 x331
>> (323) 888-1849 (Fax)
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message