<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Tracking logged in user&#8217;s using spring-security and HttpSessionListener in java web application</title>
	<atom:link href="http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html</link>
	<description>Everything java</description>
	<lastBuildDate>Wed, 01 Feb 2012 06:25:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jacques de Molay</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/comment-page-1#comment-598</link>
		<dc:creator>Jacques de Molay</dc:creator>
		<pubDate>Fri, 29 Jan 2010 01:08:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=188#comment-598</guid>
		<description>Nice example, but using sessionRegistry.getAllPrincipals() you get an up-to-date list of logged-in users.</description>
		<content:encoded><![CDATA[<p>Nice example, but using sessionRegistry.getAllPrincipals() you get an up-to-date list of logged-in users.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav Jagavkar</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/comment-page-1#comment-528</link>
		<dc:creator>Gaurav Jagavkar</dc:creator>
		<pubDate>Thu, 22 Oct 2009 05:17:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=188#comment-528</guid>
		<description>Nice one Buddy,
Gives a good head start.</description>
		<content:encoded><![CDATA[<p>Nice one Buddy,<br />
Gives a good head start.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zika Zikic</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/comment-page-1#comment-509</link>
		<dc:creator>Zika Zikic</dc:creator>
		<pubDate>Thu, 03 Sep 2009 21:00:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=188#comment-509</guid>
		<description>Class UserTracker is not Thread-Safe, you should consider that first when you post such  example.

Rgrds.</description>
		<content:encoded><![CDATA[<p>Class UserTracker is not Thread-Safe, you should consider that first when you post such  example.</p>
<p>Rgrds.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sachin Yadav</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/comment-page-1#comment-434</link>
		<dc:creator>Sachin Yadav</dc:creator>
		<pubDate>Mon, 06 Apr 2009 09:21:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=188#comment-434</guid>
		<description>Hi,

You post is quite useful for me, i am using the customer listner to put userId and session in a hash map (in a singleton class). Now the problem is that site admin should eb able to see all the logged in users and can logout any of them from is panel.

First half or requirement can easily be done using you code, can you please guide me know how do i call logout for a user when logout if clicked by admin and not the user himself.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>You post is quite useful for me, i am using the customer listner to put userId and session in a hash map (in a singleton class). Now the problem is that site admin should eb able to see all the logged in users and can logout any of them from is panel.</p>
<p>First half or requirement can easily be done using you code, can you please guide me know how do i call logout for a user when logout if clicked by admin and not the user himself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lukas</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/comment-page-1#comment-326</link>
		<dc:creator>Lukas</dc:creator>
		<pubDate>Sat, 28 Feb 2009 12:59:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=188#comment-326</guid>
		<description>Thank you for useful post. 
I just don&#039;t understand, why you increment the counter, when a user logs in and decrement the counter, when a session expires. The opposite action of session expiration should be session creation. The problem could be, that you decrease counter, when a session expires, but there&#039;s no guarantee, that the expired session was session of logged-in user. It could be session of not-logged in visitor.
Wouldn&#039;t be better to check, if there is security context present (in session), when you decrease the counter?</description>
		<content:encoded><![CDATA[<p>Thank you for useful post.<br />
I just don&#8217;t understand, why you increment the counter, when a user logs in and decrement the counter, when a session expires. The opposite action of session expiration should be session creation. The problem could be, that you decrease counter, when a session expires, but there&#8217;s no guarantee, that the expired session was session of logged-in user. It could be session of not-logged in visitor.<br />
Wouldn&#8217;t be better to check, if there is security context present (in session), when you decrease the counter?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav Arora</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/comment-page-1#comment-299</link>
		<dc:creator>Gaurav Arora</dc:creator>
		<pubDate>Wed, 25 Feb 2009 12:40:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=188#comment-299</guid>
		<description>Forgot to add that even if you do implement your own service, all you&#039;d have to do was return a hashed password in the User object, thats it.</description>
		<content:encoded><![CDATA[<p>Forgot to add that even if you do implement your own service, all you&#8217;d have to do was return a hashed password in the User object, thats it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav Arora</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/comment-page-1#comment-298</link>
		<dc:creator>Gaurav Arora</dc:creator>
		<pubDate>Wed, 25 Feb 2009 12:38:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=188#comment-298</guid>
		<description>@John:
The custom AuthenticationProcessingFilter does not really have anything to do with your UserService. Your UserService is there only to retrieve details from the backend, which it is doing in your configuration. The AuthenticationProcessingFilter simply takes the username and password that is input by the user and retreieves the User object using the defined UserService.

You do have to explicitly handle the hashing since you&#039;re using a password encoder the pass returned from the database must be encoded already. The configuration you sent over should work just fine except for the password being returned should be encoded. Adding an AuthenticationProcessingFilter to it shouldn&#039;t break it. 

As far as the caching goes, changes to UserService and AuthenticationProcessingFilter should not change the way User objects are cached. So you can use the cache still. (I&#039;m not 100% sure about this though)

Go ahead and try the changes, we can always fix it if the config does break. ;)

Gaurav</description>
		<content:encoded><![CDATA[<p>@John:<br />
The custom AuthenticationProcessingFilter does not really have anything to do with your UserService. Your UserService is there only to retrieve details from the backend, which it is doing in your configuration. The AuthenticationProcessingFilter simply takes the username and password that is input by the user and retreieves the User object using the defined UserService.</p>
<p>You do have to explicitly handle the hashing since you&#8217;re using a password encoder the pass returned from the database must be encoded already. The configuration you sent over should work just fine except for the password being returned should be encoded. Adding an AuthenticationProcessingFilter to it shouldn&#8217;t break it. </p>
<p>As far as the caching goes, changes to UserService and AuthenticationProcessingFilter should not change the way User objects are cached. So you can use the cache still. (I&#8217;m not 100% sure about this though)</p>
<p>Go ahead and try the changes, we can always fix it if the config does break. <img src='http://www.codercorp.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Gaurav</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav Arora</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/comment-page-1#comment-297</link>
		<dc:creator>Gaurav Arora</dc:creator>
		<pubDate>Wed, 25 Feb 2009 12:12:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=188#comment-297</guid>
		<description>Yes, you can use the getLoggedInUsers() method anywhere you like. But you cannot issue a redirect in the listener.</description>
		<content:encoded><![CDATA[<p>Yes, you can use the getLoggedInUsers() method anywhere you like. But you cannot issue a redirect in the listener.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/comment-page-1#comment-295</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 25 Feb 2009 07:46:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=188#comment-295</guid>
		<description>Thanks for the info on how to get the username. I must admit I am still confused though. Spring documentation is like a long riddle... If I implement my own custom authenticationProcessingFilter as you mention, I am unclear on how to handle the concerns that I currently am handling now using the straight jdbc user service (shown below).  Specifically: 

Where do I handle the hashing of the password to validate the user&#039;s entered one? 

Do I lose the ability to take advantage of EhCacheBasedUserCache?


    	
    	    	
    

 
        
    </description>
		<content:encoded><![CDATA[<p>Thanks for the info on how to get the username. I must admit I am still confused though. Spring documentation is like a long riddle&#8230; If I implement my own custom authenticationProcessingFilter as you mention, I am unclear on how to handle the concerns that I currently am handling now using the straight jdbc user service (shown below).  Specifically: </p>
<p>Where do I handle the hashing of the password to validate the user&#8217;s entered one? </p>
<p>Do I lose the ability to take advantage of EhCacheBasedUserCache?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ocb</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/tracking-logged-in-users-using-spring-security-httpsessionlistener-in-java-web-application.html/comment-page-1#comment-291</link>
		<dc:creator>ocb</dc:creator>
		<pubDate>Tue, 24 Feb 2009 12:53:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=188#comment-291</guid>
		<description>Hello, how I can use the getLoggedInusers() method in other class or only can use it in jsp? And, Can I do a redirect in sessionDestroyed? thanks</description>
		<content:encoded><![CDATA[<p>Hello, how I can use the getLoggedInusers() method in other class or only can use it in jsp? And, Can I do a redirect in sessionDestroyed? thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

