2 Replies Latest reply on Jul 5, 2007 2:52 PM by gavin.king

    Page parameter and returnToCapturedView

    fernando_jmt

      Hi.

      I have page parameter registered with a converter which encrypts and decrypts the value, something like this:

      <page view-id="/admin/user.xhtml">
       <param name="id" value="#{userAction.id}" converter="#{cipherConverter.forLong}"/>
      </page>
      


      I also have registered the following in components.xml:
      <event type="org.jboss.seam.notLoggedIn">
       <action expression="#{redirect.captureCurrentView}"/>
       </event>
       <event type="org.jboss.seam.postAuthenticate">
       <action expression="#{redirect.returnToCapturedView}"/>
       </event>
      


      I have the following scenario:

      1.- Log in.
      2.- In the user list copy one of the urls with the page param encrypted: http://localhost:8080/myapp/admin/user.jsf?id=x5JyJWpACE4*
      3.- Log off the application (I'm forcing this, but it supposes the session expired).
      4.- Copy the url of the point 2. into the browser address bar, and hit enter.
      5.- cipherConverter is called, specifically the getAsObject of the converter is called. Of course this method will convert the encrypted id to Long.
      6.- The Login form is called, I write the account info and then log in.
      7.- Immediately cipherConverter is called again. The getAsObject of the converter is called, but the value passed is the decrypted by the point 5. In this point I will always get an exception because the getAsObject expects an encrypted string, but the value passed in is an decrypted string (the long as string).

      Is the execution of the point 5 right?
      Why is invoking the converter first and then capturing the decrypted param?
      Is there a way I can follow to get this working fine?


      Thanks in advance for your help.