0 Replies Latest reply on Jun 4, 2009 2:48 PM by maitscha.christoph.mayerhofer.gmx.at

    Redirect Page-Parameter to Login-View

    maitscha.christoph.mayerhofer.gmx.at

      Hi!


      I have the following problem: I'd like to forward a page-parameter to the login-view. When the users opens e.a. the page ../aSecuredPage.seam?username=max and he has not logged in yet, he should be forwarded to the login.xhtml view and the username should be pre-filled with the page parameter.


      My login.page.xml is here:



         <param name="username"
            value="#{credentials.username}" />
      
         <navigation from-action="#{identity.login}">
            <rule if="#{identity.loggedIn}">
               <redirect view-id="/aSecuredPage.xhtml"/>
            </rule>
         </navigation>
      



      Currently it works when I open ../login.seam?username=max, then the login page is opened pre-filled with the specified username.


      The problem is when I open another page. It seams the page-parameters are removed and added after the login has been done. I added the include-page-params parameter, but without success [pages.xml]:




           <exception class="org.jboss.seam.security.NotLoggedInException">
                <redirect view-id="/login.xhtml" include-page-params="true">
                     <message severity="warn">
                          #{messages['org.jboss.seam.exception.NotLoggedIn']}
                     </message>
                </redirect>
           </exception>
      



      It seams the redirect removes the parameters, and adds them later again [components.xml]:



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



      Any ideas how I can forwared the page parameters to the login-view?


      Regards, Christoph