1 2 Previous Next 16 Replies Latest reply on Oct 3, 2012 6:36 PM by Jason Porter

    Seam 3 login redirect problem

    Taner Aruk Newbie

      Hi,

       

      I'm using Seam 3 with Seam Faces( jsf 2, primefaces 3)

       

      My problem is that after login succeed, the redirection is not made to the url of my main page.

       

      login.xhtml

      <h:commandButton id="login" value="Login" action="#{identity.login}" styleClass="loginButton"/>

       

      My Faces configuration to protect private pages :

      import org.jboss.seam.faces.rewrite.FacesRedirect;

      import org.jboss.seam.faces.security.LoginView;

      import org.jboss.seam.faces.view.config.ViewConfig;

      import org.jboss.seam.faces.view.config.ViewPattern; 


      @ViewConfig

      public interface ViewConfiguration {

      static enum MyPages {


      @FacesRedirect

      @ViewPattern("/screens/*")

      @LoggedIn

      @LoginView("/login.xhtml")

      PRIVATE, 


      @ViewPattern("/login.xhtml")

      LOGIN;

      }

      }

      And my @LoggedIn :

      import org.jboss.seam.security.annotations.SecurityBindingType; 

      @SecurityBindingType @Retention(RetentionPolicy.RUNTIME)

      @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})

      public @interface LoggedIn { }

      And securityRules.java

      public class SecurityRules {

        @LoggedIn  @Secures

        boolean loginChecker(Identity identity) {

            if (identity.getUser() == null ) {

                return false;

            } else {

                return true;

            }

        }

       

      When I click login button, succesfully loggin(if i write home page url manualy it goes) but cannot redirect to home page from login.xhtml, after I click login button second time, it redirects to home page.

       

      Thanks for your help.

        1 2 Previous Next