0 Replies Latest reply on Oct 6, 2009 4:31 PM by jeroen

    Redirect after relogin

    jeroen

      Hi all,


      I am having problems with Seam Security and re-login. In my application I have 2 protected pages: maintenance and
      test. After login, do something, logout and switch to the other page I am not redirected to captured page.


      This scenario works:



      1. Go to test page using a bookmark

      2. Page is restricted, so redirected to the login page

      3. Login and return to caputured page (configured this in components.xml)

      4. Logout and get redirected to the test page again.

      5. Do re-login



      After the 4th step I can re-login to the same page without any problems. When I use a bookmark to go to
      the maintenance page I can login, but I am not redirected to the captured page.


      In the debugger I can see that the right page is captured after hitting the bookmark, but at the time it has to
      return to that captured view, the viewId is null.


      Can somebody help me with this problem. Thanks in advance.


      Jeroen



      Pages.xml:


      <page view-id="/pages/maintenance/index.xhtml" scheme="https" login-required="true">
          <rewrite pattern="/maintain" />
          <restrict>#{s:hasRole('ADMIN') or s:hasRole('TESTER')}</restrict>
      </page>
      
      <!-- Root for testware -->
      <page view-id="/pages/test/index.xhtml" scheme="https" login-required="true">
          <rewrite pattern="/test" />
          <restrict>#{s:hasRole('TESTER')}</restrict>
      </page>
      
      <page view-id="/pages/maintaince/*" scheme="https">
          <navigation from-action="#{identity.logout}">
              <end-conversation before-redirect="true"/>
              <redirect view-id="/pages/maintenance/index.xhtml"/>
          </navigation>
      </page>
      
      <page view-id="/pages/test/*" scheme="https">
          <navigation from-action="#{identity.logout}">
              <end-conversation before-redirect="true"/>
              <redirect view-id="/pages/test/index.xhtml"/>
          </navigation>
      </page>




      Components.xml:


      <event type="org.jboss.seam.security.notLoggedIn">
          <action execute="#{redirect.captureCurrentView}"/>
      </event>
      <event type="org.jboss.seam.security.postAuthenticate">
          <action execute="#{redirect.returnToCapturedView}"/>
      </event>