<?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: Session expired messages using Seam security</title>
	<atom:link href="http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/feed/" rel="self" type="application/rss+xml" />
	<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/</link>
	<description>Blog by a developer for a developer</description>
	<lastBuildDate>Tue, 24 Aug 2010 13:52:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: snowhite</title>
		<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/comment-page-1/#comment-14047</link>
		<dc:creator>snowhite</dc:creator>
		<pubDate>Tue, 06 Oct 2009 18:02:03 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/#comment-14047</guid>
		<description>Hi Jacob,

I found this article of yours very helpful. However when I try to implement the same, I am getting &quot;session expired&quot; message when user tries to log in for the first time into the application. After logging in, once the session expires, I am getting the session expired message as desired. Is there anything I need to do to see &quot;session expired&quot; message not appear when user logs into application.

Thanks.</description>
		<content:encoded><![CDATA[<p>Hi Jacob,</p>
<p>I found this article of yours very helpful. However when I try to implement the same, I am getting &#8220;session expired&#8221; message when user tries to log in for the first time into the application. After logging in, once the session expires, I am getting the session expired message as desired. Is there anything I need to do to see &#8220;session expired&#8221; message not appear when user logs into application.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ale Feltes</title>
		<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/comment-page-1/#comment-12643</link>
		<dc:creator>Ale Feltes</dc:creator>
		<pubDate>Thu, 20 Aug 2009 12:54:32 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/#comment-12643</guid>
		<description>Thank you for the post. To have it working, I added this to my pages.xml

&lt;code&gt;
	
          
    
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Thank you for the post. To have it working, I added this to my pages.xml</p>
<p><code></p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jacob.orshalick</title>
		<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/comment-page-1/#comment-415</link>
		<dc:creator>jacob.orshalick</dc:creator>
		<pubDate>Tue, 25 Mar 2008 14:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/#comment-415</guid>
		<description>Hi Lijun,

Sorry for my delay.

The session expired event is fired after the context is reconstructed (it actually checks for the new session and is *not* fired when the session is destroyed).  Thus, your CustomAuthenticator is part of the new session ensuring the message is available.  Flushing the messages after the INVOKE_APPLICATION phase will only work if the INVOKE_APPLICATION phase is executed (which may be your issue).  What you can do is configure an &lt;action&gt; in your pages.xml configuration for the login page which executes your flush.  By the time the action executes the FacesMessages component is available from the context.

The best approach is using the patch submitted for &lt;a href=&quot;http://jira.jboss.com/jira/browse/JBSEAM-2257&quot; rel=&quot;nofollow&quot;&gt;JBSEAM-2257&lt;/a&gt; as it avoids issues with the context not being available.  The session expiration check is performed *after* the context has been initialized ensuring that the FacesMessages component is available when the event is fired.  This is scheduled for inclusion in 2.1.0.GA.

Hope that helps.

Jacob</description>
		<content:encoded><![CDATA[<p>Hi Lijun,</p>
<p>Sorry for my delay.</p>
<p>The session expired event is fired after the context is reconstructed (it actually checks for the new session and is *not* fired when the session is destroyed).  Thus, your CustomAuthenticator is part of the new session ensuring the message is available.  Flushing the messages after the INVOKE_APPLICATION phase will only work if the INVOKE_APPLICATION phase is executed (which may be your issue).  What you can do is configure an &lt;action&gt; in your pages.xml configuration for the login page which executes your flush.  By the time the action executes the FacesMessages component is available from the context.</p>
<p>The best approach is using the patch submitted for <a href="http://jira.jboss.com/jira/browse/JBSEAM-2257" rel="nofollow">JBSEAM-2257</a> as it avoids issues with the context not being available.  The session expiration check is performed *after* the context has been initialized ensuring that the FacesMessages component is available when the event is fired.  This is scheduled for inclusion in 2.1.0.GA.</p>
<p>Hope that helps.</p>
<p>Jacob</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lijun</title>
		<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/comment-page-1/#comment-355</link>
		<dc:creator>Lijun</dc:creator>
		<pubDate>Mon, 17 Mar 2008 19:19:34 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/#comment-355</guid>
		<description>Hello Jacob,

I am following your method. However, I could not make it work on the flushMessages() part. Because the HttpSession has expired, and CustomAuthenticator is a SESSION scope bean, when it&#039;s the time FacesMessages is available, CustomAuthenticator is already re-constructed and this.messages is already gone.

Please explain how you do &quot;The flushMessages method should be invoked either by an action on your pages.xml or by flushing after the INVOKE_APPLICATION phase (this is up to your preference).&quot; Especially how to do it by an action on your pages.xml.

I invoke flushMessages() by
&lt;code&gt;
        @Observer(&quot;org.jboss.seam.afterPhase&quot;)
	public void flushMessages(PhaseEvent event) {
		PhaseId id = event.getPhaseId();
		if(id == PhaseId.INVOKE_APPLICATION){	
			for(FacesMessage message : this.faceMessages){
			    FacesMessages.instance().add(message);
			}
			faceMessages.clear();		
		}
    } 
&lt;/code&gt;

Thank you very much.</description>
		<content:encoded><![CDATA[<p>Hello Jacob,</p>
<p>I am following your method. However, I could not make it work on the flushMessages() part. Because the HttpSession has expired, and CustomAuthenticator is a SESSION scope bean, when it&#8217;s the time FacesMessages is available, CustomAuthenticator is already re-constructed and this.messages is already gone.</p>
<p>Please explain how you do &#8220;The flushMessages method should be invoked either by an action on your pages.xml or by flushing after the INVOKE_APPLICATION phase (this is up to your preference).&#8221; Especially how to do it by an action on your pages.xml.</p>
<p>I invoke flushMessages() by<br />
<code><br />
        @Observer("org.jboss.seam.afterPhase")<br />
	public void flushMessages(PhaseEvent event) {<br />
		PhaseId id = event.getPhaseId();<br />
		if(id == PhaseId.INVOKE_APPLICATION){<br />
			for(FacesMessage message : this.faceMessages){<br />
			    FacesMessages.instance().add(message);<br />
			}<br />
			faceMessages.clear();<br />
		}<br />
    }<br />
</code></p>
<p>Thank you very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jacob.orshalick</title>
		<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/comment-page-1/#comment-19</link>
		<dc:creator>jacob.orshalick</dc:creator>
		<pubDate>Wed, 12 Dec 2007 17:29:27 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/#comment-19</guid>
		<description>Hi Nayan,

You do not have to modify the seam source.  It simply means that you have to keep in mind that the notification only works for general cookie settings as described in the next paragraph, i.e. cookies expire when the browser session is ended (browser is closed).

If the cookie is set to never expire or expiration occurs at some future date, the security.sessionExpired event will be triggered any time the session expires (regardless of whether the browser is closed and then reopened).  Hope that clarifies your question.</description>
		<content:encoded><![CDATA[<p>Hi Nayan,</p>
<p>You do not have to modify the seam source.  It simply means that you have to keep in mind that the notification only works for general cookie settings as described in the next paragraph, i.e. cookies expire when the browser session is ended (browser is closed).</p>
<p>If the cookie is set to never expire or expiration occurs at some future date, the security.sessionExpired event will be triggered any time the session expires (regardless of whether the browser is closed and then reopened).  Hope that clarifies your question.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nayan</title>
		<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/comment-page-1/#comment-18</link>
		<dc:creator>Nayan</dc:creator>
		<pubDate>Wed, 12 Dec 2007 16:28:43 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/#comment-18</guid>
		<description>Hi,

your post is really helpful. I want to clarify one point.. Can you please elaborate what you mean by.. &quot;you can basically notify the user when the server session has ended by adding the following to a PhaseListener&quot;.  Does this mean we need to modify seam source?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>your post is really helpful. I want to clarify one point.. Can you please elaborate what you mean by.. &#8220;you can basically notify the user when the server session has ended by adding the following to a PhaseListener&#8221;.  Does this mean we need to modify seam source?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: HeavyGod</title>
		<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/comment-page-1/#comment-5</link>
		<dc:creator>HeavyGod</dc:creator>
		<pubDate>Tue, 27 Nov 2007 10:02:35 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/#comment-5</guid>
		<description>Really good and really interesting post. I expect (and other readers maybe :)) new useful posts from you! 
Good luck and successes in blogging!</description>
		<content:encoded><![CDATA[<p>Really good and really interesting post. I expect (and other readers maybe <img src='http://solutionsfit.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ) new useful posts from you!<br />
Good luck and successes in blogging!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheng Huang</title>
		<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/comment-page-1/#comment-4</link>
		<dc:creator>Sheng Huang</dc:creator>
		<pubDate>Mon, 19 Nov 2007 19:13:49 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/#comment-4</guid>
		<description>Good afternoon Jacob,

Sorry that I cannot make it work with the new org.jboss.seam.loggedOut event. So I followed your approach to make a third page in between. I used my home page, which does not require login, and clear the messages list there. In this way, I don&#039;t need to redirect to the login page.

Thank you very much for all your help and have a nice day!

Best regards,
Sheng</description>
		<content:encoded><![CDATA[<p>Good afternoon Jacob,</p>
<p>Sorry that I cannot make it work with the new org.jboss.seam.loggedOut event. So I followed your approach to make a third page in between. I used my home page, which does not require login, and clear the messages list there. In this way, I don&#8217;t need to redirect to the login page.</p>
<p>Thank you very much for all your help and have a nice day!</p>
<p>Best regards,<br />
Sheng</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jacob.orshalick</title>
		<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/comment-page-1/#comment-3</link>
		<dc:creator>jacob.orshalick</dc:creator>
		<pubDate>Mon, 19 Nov 2007 18:13:40 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/#comment-3</guid>
		<description>I look forward to hearing your approach.  It&#039;s always great to have alternatives :)</description>
		<content:encoded><![CDATA[<p>I look forward to hearing your approach.  It&#8217;s always great to have alternatives <img src='http://solutionsfit.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheng Huang</title>
		<link>http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/comment-page-1/#comment-2</link>
		<dc:creator>Sheng Huang</dc:creator>
		<pubDate>Mon, 19 Nov 2007 13:21:38 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/11/16/session-expired-messages-using-seam-security/#comment-2</guid>
		<description>Good morning Jacob,

Thanks a lot for the tutorial and it is great. However, the meta refresh solution is not very desirable to us because our application cannot redirect to another page without user&#039;s explicit request.

I am in the middle of upgrading from Seam beta to 2.0.0.GA, so I will try the new org.jboss.seam.loggedOut event as you suggested. I will let you know the result.

Have a nice day!

Best regards,
Sheng</description>
		<content:encoded><![CDATA[<p>Good morning Jacob,</p>
<p>Thanks a lot for the tutorial and it is great. However, the meta refresh solution is not very desirable to us because our application cannot redirect to another page without user&#8217;s explicit request.</p>
<p>I am in the middle of upgrading from Seam beta to 2.0.0.GA, so I will try the new org.jboss.seam.loggedOut event as you suggested. I will let you know the result.</p>
<p>Have a nice day!</p>
<p>Best regards,<br />
Sheng</p>
]]></content:encoded>
	</item>
</channel>
</rss>
