4 Replies Latest reply on Dec 20, 2007 12:35 PM by b.reeve

    Identity.loggedIn and Session expiring

    b.reeve

      Hello !


      1. Is there a way we can map identity.loggedIn to a method to keep checking against some criteria. For eg: If I want to redirect the user to login page when the session expires, can I configure identity.loggedIn = loginBean.sessionExpired.

      2. Or, I found in the forum that an event can be raised for sessionExpired. But then how do I redirect the user to myLogin page on this event.
      <event type="org.jboss.seam.sessionExpired">
       <action execute="#{redirect.toSomeViewID}"/>
       </event>
      


      3. Also if I do
      <page view-id="*" action="#{loginBean.sessionExpired}">
       <navigation>
       <rule if="login">
       <redirect view-id="/index.xhtml" />
       </rule>
       </navigation>
      </page>
      

      what happens when sessionExpired method returns null

      Any help would be appreciated.

      Thanks !


        • 1. Re: Identity.loggedIn and Session expiring
          pmuir

           

          "b.reeve" wrote:
          1. Is there a way we can map identity.loggedIn to a method to keep checking against some criteria. For eg: If I want to redirect the user to login page when the session expires, can I configure identity.loggedIn = loginBean.sessionExpired.


          No.

          2. Or, I found in the forum that an event can be raised for sessionExpired. But then how do I redirect the user to myLogin page on this event.
          <event type="org.jboss.seam.sessionExpired">
           <action execute="#{redirect.toSomeViewID}"/>
           </event>
          


          Not yet implemented. This is the best way to do what you are AFAICS.

          3. Also if I do
          <page view-id="*" action="#{loginBean.sessionExpired}">
           <navigation>
           <rule if="login">
           <redirect view-id="/index.xhtml" />
           </rule>
           </navigation>
          </page>
          

          what happens when sessionExpired method returns null


          Null in JSF means stay on the same page.

          • 2. Re: Identity.loggedIn and Session expiring
            b.reeve

            Thank you for the answers.


            Not yet implemented. This is the best way to do what you are AFAICS.


            Does this mean that there are plans for adding this to future release?


            Null in JSF means stay on the same page.

            But I am getting the page navigated according to some rule (defined in pages.xml) when the return type is null.


            1. Also, Is there a way I can disable Seam from adding the default seam messages to FacesMessage apart from giving a value for that key in the resource bundle?

            2. Is there some way to do something like,

            pages.xml
            <page view-id="/login.xhtml" >
             <navigation from-action="#{identity.login}" >
             <rule if="#{identity.loggedIn} >
             <evaluate="#{loginBean.navigation}" >
             <rule if-outcome="pageA" >
             <redirect view-id="/pageA.xhtml" />
             </rule>
             <rule if-outcome="pageB" >
             <redirect view-id="/pageB.xhtml" />
             </rule>
             <rule if-outcome="landing" >
             <redirect view-id="/index.xhtml" />
             </rule>
             </evaluate>
             </rule>
             </navigation>
            </page>
            


            so that my evaluate would be evaluated only if certain condition is met and not always.

            Thanks again for helping!


            • 3. Re: Identity.loggedIn and Session expiring
              pmuir

               

              "b.reeve" wrote:
              Not yet implemented. This is the best way to do what you are AFAICS.


              Does this mean that there are plans for adding this to future release?


              Yes, the sessionExpired event will be added.

              1. Also, Is there a way I can disable Seam from adding the default seam messages to FacesMessage apart from giving a value for that key in the resource bundle?


              Thats the simplest way, but there are other ways depending on the particular message you are trying to hide.

              That pages.xml ruleset isn't valid - this is equivalent and valid

              <page view-id="/login.xhtml" >
               <navigation from-action="#{identity.login}" >
               <rule if="#{identity.loggedIn AND loginBean.navigation eq 'pageA'}" >
               <redirect view-id="/pageA.xhtml" />


              etc.

              • 4. Re: Identity.loggedIn and Session expiring
                b.reeve

                Thanks for the replies,
                I finally got that ruleset working by configuring

                <page view-id="/login.xhtml" >
                 <navigation from-action="#{identity.login}" >
                 <rule if="#{identity.loggedIn}>
                 <redirect view-id="/#{loginBean.navigation}.xhtml" />
                 </rule>
                 </navigation>
                </page>
                


                Is there any drawback in implementing it this way.

                Thanks !