12 Replies Latest reply on Dec 27, 2007 5:44 PM by Pete Muir

    Why is Authenticator.authenticate() called twice if it retur

    Kurt Edegger Newbie

      Hi!

      I've just generated an application with seam-gen (seam-2.0.0.CR2) and modified the Authenticator.authenticate() method to return false as well:

       public boolean authenticate()
       {
       log.info("authenticating #0", identity.getUsername());
       if ("Foo".equalsIgnoreCase(identity.getUsername())){
       identity.addRole("admin");
       log.info("Autentication: #0", "TRUE");
       return true;
       }else{
       log.info("Autentication: #0", "FALSE");
       return false;
       }
       }
      


      Now obviously a user "Foo" can log in with an arbitrary password and any other user gets an "invalid login" message. Everything's fine so far, but interestingly I'm getting two


      authenticating xxx
      Autentication: FALSE


      entries in the log, if a user "xxx" tries to log in - hence the authenticate() method is called twice.
      Could anyone explain to me, why this is the case - I thought, if an action method returns false, simple the current page is re-rendered.

      Thanks a lot for any explanations.

      Best regards, Kurt