1 Reply Latest reply on Sep 13, 2007 7:14 AM by fmeystre

    @Restrict and redirect.captureCurrentView

    fmeystre

      I try to use the built-in security handling to redirect user to the page she originally requested after the login.

      I works fine when I'm using login-required="true" in pages.xml but the problem is when I'm using @Restrict("#{identity.loggedIn}") in the class. When the annotations is used, the login page is shown but after login the page is reloaded (instead of the originally requested). And on the JBoss Console I can see an Exception: javax.faces.el.EvaluationException: Exception while invoking expression #{commandeService.commander} ........... Caused by: org.jboss.seam.security.NotLoggedInException

      I'm doing something wrong ?

      here is my files :

      pages.xml :
      <pages no-conversation-view-id="/home.xhtml"
      login-view-id="/login.xhtml">
      <page view-id="*">
      ...
      <navigation from-action="#{commandeService.commander(panier)}">
      <redirect view-id="/commande.xhtml">

      ...


      <page view-id="/commande.xhtml" login-required="true">
      ...

      <redirect view-id="/login.xhtml">
      #{messages.NotLoggedIn}






      components.xml:
      ...







      ...

      Java class, session bean with restricted method/class:

      @Stateful
      @Scope(CONVERSATION)
      @Name("commandeService")

      @Restrict("#{identity.loggedIn}")
      public class CommandeServiceBean implements CommandeService{

      @In(required=false)
      private User user;
      ...
      @PersistenceContext
      private EntityManager em;

      @Begin(join=true)
      public void commander(Panier panier) throws PoidsMaxException, NotLoggedInException {
      ...
      }
      }

        • 1. Re: @Restrict and redirect.captureCurrentView
          fmeystre

          Sorry... trouble with my post, here is my component.xml

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