5 Replies Latest reply on May 30, 2007 9:29 AM by Carlos Abreu

    Seam authentication module problem

    Carlos Abreu Newbie

      Hy i´m facing some problems when i try to set my Authentication module.

      1) I can´t execute the autentication method without setting the parameters value, like folows:

      public boolean authenticate(String username, String password, Set<String> roles)
      


      2) The Identity Class from the Seam Framework is returning null when i try to obtain the user password

      Identity.instance().getPassword()
      


      3) The Identity Class from the Seam Framework doesn´t have the addRole method:

      Identity.instance().addRole(user.getUserRole().getRoleDesc());
      


      I am reading the seam tutorial about security modules(http://docs.jboss.com/seam/latest/reference/en/html/security.html#d0e6331).

      Can anyone know what is happening ?

      Thanks in advance

        • 1. Re: Seam authentication module problem
          Leo Newbie

          carlos,

          list your components.xml, web.xml, login page and other code you think important here, please.

          • 2. Re: Seam authentication module problem
            Carlos Abreu Newbie

            Humm... Allright, my configuration files is:

            login.page.xml

            <!DOCTYPE page PUBLIC
             "-//JBoss/Seam Pages Configuration DTD 1.1//EN"
             "http://jboss.com/products/seam/pages-1.1.dtd">
            
            <page>
             <navigation from-action="#{identity.login}">
             <rule if="#{identity.loggedIn}">
             <redirect view-id="/home.xhtml"/>
             </rule>
             </navigation>
            </page>
            



            components.xml
             <drools:rule-base name="securityRules">
             <drools:rule-files><value>/security.drl</value></drools:rule-files>
             </drools:rule-base>
            
             <security:identity authenticate-method="#{authenticator.authenticate}" />
            


            All the others configurations is using the default generated by seam gen.

            My login page is using this code:

            
             <h:form>
            
             <div class="dialog">
             <div class="prop">
             <span class="name">Username</span>
             <span class="value">
             <h:inputText id="username" value="#{identity.username}"/>
             </span>
             </div>
             <div class="prop">
             <span class="name">Password</span>
             <span class="value">
             <h:inputSecret id="password" value="#{identity.password}"/>
             </span>
             </div>
             </div>
            
             <div class="actionButtons">
             <h:commandButton value="Login" action="#{identity.login}"/>
             </div>
            
             </h:form>
            


            Thanks.

            • 3. Re: Seam authentication module problem
              Shane Bryzak Master

              Your authenticate method has the wrong signature. It should accept no parameters, and instead refer to the username and password in Identity.

              • 4. Re: Seam authentication module problem
                Carlos Abreu Newbie

                Hy Shane, yes that is correct my authenticate method only work passing the parameters... If i let without it, i can´t recover the user password using the Identity.instance().getPassword(), always returns null.

                My other doubt is about the addRole method, this method doesn´t exist in the class org.jboss.seam.security.Identity

                Thanks...

                • 5. Re: Seam authentication module problem
                  Carlos Abreu Newbie

                  I found the problem, the SEAM integration with JAAS only works with SEAM 1.2.

                  I sugest to inform what is the version of SEAM the example will work on the http://docs.jboss.com/seam/latest/reference/en/html/security.html page.

                  Thanks