2 Replies Latest reply on Apr 29, 2009 10:33 AM by ebanfa

    Seam 2.1.2CR Identity Manager Login Failed

    ebanfa

      Hello Everyone,


      I know this topic has been posted before but seems there has been no resolution. Ok I download Seam 2.1.2CR and fired it up. I created a project using: seam create-project add-identity-management. I also used seam-gen to generate my entities. My problem is that the login into the front end fails with blank password (admin user) and it still fails after I changed the password in the database (I also updated the annotation in my UserAccount class to @UserPassword setting hash to none) and tried inserting a new user into the database but still no luck. Worst of all there is not Exception thrown. I have increased the log levels to Debug and I can see Hibernate is issuing out the SQL statements to select the user but I dont know why the login still fails. I am running Seam 2.1.2CR on JBOSS-5.0.0GA on WinXP against MySQL 5.



      PS: I have also updated all my ${Entity name here}.page.xml files to include login-required set to true so effectively all pages are inaccessible to me.


      My seam components.xml reads:



      <security:identity/>
      <security:jpa-identity-store user-class="com.cellonia.alantra.model.UserAccount"
                                   role-class="com.cellonia.alantra.model.UserRole"/>
      <security:jpa-permission-store 
                user-permission-class="com.cellonia.alantra.model.UserPermission"/>
      <security:remember-me enabled="true"/>





      JBoss Server Log reads:



      
      2009-04-28 13:28:50,765 DEBUG [org.hibernate.hql.ast.AST] (http-127.0.0.1-8080-3) --- SQL AST ---
       \-[SELECT] QueryNode: 'SELECT'  querySpaces (user_account)
          +-[SELECT_CLAUSE] SelectClause: '{select clause}'
          |  +-[ALIAS_REF] IdentNode: 'useraccoun0_.id as id94_' {alias=u, className=com.cellonia.alantra.model.UserAccount, tableAlias=useraccoun0_}
          |  \-[SQL_TOKEN] SqlFragment: 'useraccoun0_.enabled as enabled94_, useraccoun0_.password_hash as password3_94_, useraccoun0_.username as username94_'
          +-[FROM] FromClause: 'from' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[u], fromElementByTableAlias=[useraccoun0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
          |  \-[FROM_FRAGMENT] FromElement: 'user_account useraccoun0_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=u,role=null,tableName=user_account,tableAlias=useraccoun0_,origin=null,colums={,className=com.cellonia.alantra.model.UserAccount}}
          \-[WHERE] SqlNode: 'where'
             \-[EQ] BinaryLogicOperatorNode: '='
                +-[DOT] DotNode: 'useraccoun0_.username' {propertyName=username,dereferenceType=4,propertyPath=username,path={synthetic-alias}.username,tableAlias=useraccoun0_,className=com.cellonia.alantra.model.UserAccount,classAlias=u}
                |  +-[IDENT] IdentNode: '{synthetic-alias}' {originalText={synthetic-alias}}
                |  \-[IDENT] IdentNode: 'username' {originalText=username}
                \-[NAMED_PARAM] ParameterNode: '?' {name=username, expectedType=org.hibernate.type.StringType@193b49}
      
      2009-04-28 13:28:50,765 DEBUG [org.hibernate.hql.ast.ErrorCounter] (http-127.0.0.1-8080-3) throwQueryException() : no errors
      2009-04-28 13:28:50,796 DEBUG [org.hibernate.hql.ast.QueryTranslatorImpl] (http-127.0.0.1-8080-3) HQL: select u from com.cellonia.alantra.model.UserAccount u where username = :username
      2009-04-28 13:28:50,796 DEBUG [org.hibernate.hql.ast.QueryTranslatorImpl] (http-127.0.0.1-8080-3) SQL: select useraccoun0_.id as id94_, useraccoun0_.enabled as enabled94_, useraccoun0_.password_hash as password3_94_, useraccoun0_.username as username94_ from user_account useraccoun0_ where useraccoun0_.username=?
      2009-04-28 13:28:50,796 DEBUG [org.hibernate.hql.ast.ErrorCounter] (http-127.0.0.1-8080-3) throwQueryException() : no errors
      2009-04-28 13:28:50,843 DEBUG [org.hibernate.jdbc.AbstractBatcher] (http-127.0.0.1-8080-3) about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
      2009-04-28 13:28:50,843 DEBUG [org.hibernate.jdbc.ConnectionManager] (http-127.0.0.1-8080-3) opening JDBC connection
      2009-04-28 13:28:52,578 DEBUG [org.hibernate.SQL] (http-127.0.0.1-8080-3) 
          select
              useraccoun0_.id as id94_,
              useraccoun0_.enabled as enabled94_,
              useraccoun0_.password_hash as password3_94_,
              useraccoun0_.username as username94_ 
          from
              user_account useraccoun0_ 
          where
              useraccoun0_.username=? limit ?
      2009-04-28 13:28:52,578 INFO  [STDOUT] (http-127.0.0.1-8080-3) Hibernate: 
          select
              useraccoun0_.id as id94_,
              useraccoun0_.enabled as enabled94_,
              useraccoun0_.password_hash as password3_94_,
              useraccoun0_.username as username94_ 
          from
              user_account useraccoun0_ 
          where
              useraccoun0_.username=? limit ?
      2009-04-28 13:28:52,734 DEBUG [org.hibernate.jdbc.AbstractBatcher] (http-127.0.0.1-8080-3) about to open ResultSet (open ResultSets: 0, globally: 0)
      2009-04-28 13:28:52,734 DEBUG [org.hibernate.jdbc.AbstractBatcher] (http-127.0.0.1-8080-3) about to close ResultSet (open ResultSets: 1, globally: 1)
      2009-04-28 13:28:52,734 DEBUG [org.hibernate.jdbc.AbstractBatcher] (http-127.0.0.1-8080-3) about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
      2009-04-28 13:28:52,734 DEBUG [org.hibernate.jdbc.ConnectionManager] (http-127.0.0.1-8080-3) aggressively releasing JDBC connection
      2009-04-28 13:28:52,734 DEBUG [org.hibernate.jdbc.ConnectionManager] (http-127.0.0.1-8080-3) releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
      2009-04-28 13:28:52,734 DEBUG [org.hibernate.engine.StatefulPersistenceContext] (http-127.0.0.1-8080-3) initializing non-lazy collections
      2009-04-28 13:28:52,750 DEBUG [org.jboss.seam.contexts.Contexts] (http-127.0.0.1-8080-3) found in session context: org.jboss.seam.security.rememberMe
      2009-04-28 13:28:52,750 DEBUG [org.jboss.seam.security.Identity] (http-127.0.0.1-8080-3) Login failed for: admin
      javax.security.auth.login.LoginException: Login Failure: all modules ignored
           at javax.security.auth.login.LoginContext.invoke(LoginContext.java:921)
           at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
           at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
           at java.security.AccessController.doPrivileged(Native Method)
           at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
           at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
           at org.jboss.seam.security.Identity.authenticate(Identity.java:344)
           at org.jboss.seam.security.Identity.authenticate(Identity.java:332)
           at org.jboss.seam.security.Identity.login(Identity.java:259)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      




      Please I would appreciate any help or pointers to a solution.


      Regards


      Edward

        • 1. Re: Seam 2.1.2CR Identity Manager Login Failed
          ebanfa

          Sorry I meant to say strange exception thrown :-)


          Thanks again

          • 2. Re: Seam 2.1.2CR Identity Manager Login Failed
            ebanfa

            Ok...I tried to follow an example I saw on the forum, I created a simple bean to manually create a user using the following code below but now Seam tells me it cant add the user to the admin role coz the role does not exist, but the role is existing in the database...hmmmm maybe Seam and I are using different identity stores...


                   


            @In Credentials credentials;
            @In IdentityManager identityManager;
                 
            public String createUser()
            {
             try 
             {
               identityManager.getIdentityStore().createUser("ebanfa", "cellonia123");
               identityManager.getIdentityStore().grantRole("ebanfa", "admin");
             } 
             catch (RuntimeException e) 
             {
               // TODO Auto-generated catch block
               e.printStackTrace();
               throw e;
             }
             return "homepage";
            }