7 Replies Latest reply on Aug 13, 2009 4:14 AM by Brian Hiles

    Login Method

    Abhinav Jauhri Newbie
      Hi,
      I am trying to do a simple check with a database table. It gives the following error in the server console:

      ERROR Error invoking login method

      Also would like to know how does it map to the authenticate function by identity.login

      login.xhtml:

      <ui:define name="body">

          <h:form id="login">

              <rich:panel>
                  <f:facet name="header">Login</f:facet>

                  <p>Please login here</p>

                  <div class="dialog">
                      <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
                          <h:outputLabel for="username">Username</h:outputLabel>
                          <h:inputText id="username"
                                    value="#{identity.username}"/>
                          <h:outputLabel for="password">Password</h:outputLabel>
                          <h:inputSecret id="password"
                                      value="#{identity.password}"/>
                          <h:outputLabel for="rememberMe">Remember me</h:outputLabel>
                          <h:selectBooleanCheckbox id="rememberMe"
                                                value="#{identity.rememberMe}"/>
                      </h:panelGrid>
                  </div>

                  <p>
                    <i>Note - </i> You may login with the username 'admin' and a blank password.
                  </p>

              </rich:panel>

              <div class="actionButtons">
                  <h:commandButton value="Login" action="#{identity.login}"/>
              </div>

          </h:form>

      </ui:define>
      </ui:composition>
        • 1. Re: Login Method
          Nicola Ben Novice

          Take a look at the component:


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


          BYe
          Nic

          • 2. Re: Login Method
            Binesh Gummadi Novice

            Did you map your authentication component in components.xml?


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




            • 3. Re: Login Method
              Abhinav Jauhri Newbie

              Yes did map it in components.xml.

              • 4. Re: Login Method
                Binesh Gummadi Novice

                Can you show us your components.xml? I would like to see if you have any identity management and stores defined. Also it would be helpful to show your authenticate component.

                • 5. Re: Login Method
                  Brian Hiles Newbie

                  I'm having a similar problem, but I thought if you use the Identiy Management of Seam, you didn't have to create an Authenticator or have it as part of of components.xml.


                  I've tried to debug it through and it's failing on the lookup user method in JpaIdentityStore, but there isn't an exception that I can see that gets raised to cause it. Any ideas?

                  • 6. Re: Login Method
                    Brian Hiles Newbie

                    Here's my components.xml files



                    <?xml version="1.0" encoding="UTF-8"?>
                    <components xmlns="http://jboss.com/products/seam/components"
                                xmlns:core="http://jboss.com/products/seam/core"
                                xmlns:persistence="http://jboss.com/products/seam/persistence"
                                xmlns:drools="http://jboss.com/products/seam/drools"
                                xmlns:bpm="http://jboss.com/products/seam/bpm"
                                xmlns:security="http://jboss.com/products/seam/security"
                                xmlns:mail="http://jboss.com/products/seam/mail"
                                xmlns:web="http://jboss.com/products/seam/web"
                                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                xsi:schemaLocation=
                                    "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
                                     http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd
                                     http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
                                     http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.2.xsd
                                     http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.2.xsd
                                     http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.2.xsd
                                     http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.2.xsd
                                     http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd">
                    
                       <core:init debug="true" jndi-pattern="@jndiPattern@"/>
                    
                       <core:manager concurrent-request-timeout="500"
                                     conversation-timeout="120000"
                                     conversation-id-parameter="cid"
                                     parent-conversation-id-parameter="pid"/>
                    
                       <!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->
                       <web:hot-deploy-filter url-pattern="*.seam"/>
                    
                       <persistence:managed-persistence-context name="entityManager" auto-create="true"
                                          persistence-unit-jndi-name="java:/toyfilesEntityManagerFactory"/>
                    
                       <drools:rule-base name="securityRules">
                          <drools:rule-files>
                             <value>/security.drl</value>
                          </drools:rule-files>
                       </drools:rule-base>
                    
                       <security:rule-based-permission-resolver security-rules="#{securityRules}"/>
                    
                       <event type="org.jboss.seam.security.notLoggedIn">
                          <action execute="#{redirect.captureCurrentView}"/>
                       </event>
                       <event type="org.jboss.seam.security.loginSuccessful">
                          <action execute="#{redirect.returnToCapturedView}"/>
                       </event>
                    
                       <mail:mail-session host="localhost" port="25"/>
                       
                       <security:jpa-identity-store 
                                 user-class="com.toyfiles.user.User"
                              role-class="com.toyfiles.user.Role" />
                       
                    
                       <!-- For use with jBPM pageflow or process management -->
                       <!--
                       <bpm:jbpm>
                          <bpm:process-definitions></bpm:process-definitions>
                          <bpm:pageflow-definitions></bpm:pageflow-definitions>
                       </bpm:jbpm>
                       -->
                    
                    </components>



                    • 7. Re: Login Method
                      Brian Hiles Newbie

                      Figured it out... It wasn't easy. I had a bad key for a relationship of my User class. NOTHING about that made its way to the logs. I had to inspect the exception as it was created in the lookupUser method. Everything's working smooth now!