4 Replies Latest reply on Mar 18, 2008 2:02 AM by coolstone

    How to support two login page

    coolstone

      in our web application, there are two ways to login: the first user account and password and second use a CA Key to login. And how to support two login page in seam application? it seams only one login page can use in seam:pages.xml:login-view-id ="/login.xhtml"
      and one authenticate-method support in seam :
      security:identity authenticate-method="#authenticator.authenticate"


      in our application, we want CA user login using CA Key in another login page loginCA.xhtml.
      how to achieve it?


      when exactly the identity instance create.


      Thank you!


      (i am sorry.english is no my main language, so...)

        • 1. Re: How to support two login page
          keithnaas

          Shawn,


          You could have one login page, and have it forward to the two separate login pages based on the value of some property.  Or you could have one login page, and toggle between the two modes based on a user action. 


          Then if you want two different authenticate methods, you could simply extend the Identity object and add the extra functionality to authenticate differently for the two different screens. 


          To tell Seam to use your Identity object, make sure to add the Identity's @Name annotation to your object.  This worked in Seam 1.2.1.GA.


          @Name("org.jboss.seam.security.identity")
          



          I'm sure you'll encounter some roadblocks along the way, but this should get your started.


          Good luck,
          Keith

          • 2. Re: How to support two login page
            coolstone

            Thank you, Keith.


            Here comes another problem:when the method 'authenticator.authenticate' invokes?


            <security:identity authenticate-method="#{authenticator.authenticate}"/>



            i notice that in the login page, only the method  'identity.login' is been invoked.


            <h:commandButton class="Button" width="80px" value="Login" action="#{identity.login}" />




            can we control when to invoke the authenticate method?




            Shawn Young

            • 3. Re: How to support two login page
              keithnaas

              If you look at the Identity component, you can see when and why the authenticate method is invoked. 


              If you have a good enuf reason, I'm sure you can change things how you want.  However, most of that stuff works really well OOTB so it should be a pretty compelling reason.

              • 4. Re: How to support two login page
                coolstone

                Thank you very much! Keith.


                I extend the org.jboss.seam.security.identity, and everything goes well now.
                In our application, we should support the CA(Certificate Authority) login...


                Thank you for your help!