6 Replies Latest reply on Feb 9, 2012 3:30 PM by Michał W

    Seam-security, problem with  JPAIdentityStore while logging

    Michał W Newbie

      I use seam-security 3.1.0.Final with JPAIdentityStore configured and with initial db data as in IDM management console example

       

      Every time I try to log in I get the following exception:

       


      ERROR: Login failed

      org.jboss.seam.security.AuthenticationException: Authentication failed.

                at org.jboss.seam.security.IdentityImpl.authenticate(IdentityImpl.java:245)

                at org.jboss.seam.security.IdentityImpl.login(IdentityImpl.java:163)

                at org.jboss.seam.security.IdentityImpl$Proxy$_$$_WeldClientProxy.login(IdentityImpl$Proxy$_$$_WeldClientProxy.java)

                at com.mwasiluk.charity.server.SessionManagementServiceImpl.login(SessionManagementServiceImpl.java:83)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)

                at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)

                at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)

                at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

                at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

                at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

                at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

                at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

                at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

                at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

                at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

                at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)

                at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)

                at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

                at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

                at java.lang.Thread.run(Thread.java:662)

      Caused by: javax.persistence.NoResultException: No entity found for query

                at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:270)

                at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getSingleResult(CriteriaQueryCompiler.java:191)

                at org.jboss.seam.security.management.picketlink.JpaIdentityStore.lookupIdentity(JpaIdentityStore.java:1098)

                at org.jboss.seam.security.management.picketlink.JpaIdentityStore.validateCredential(JpaIdentityStore.java:1698)

                at org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository.validateCredential(WrapperIdentityStoreRepository.java:303)

                at org.picketlink.idm.impl.api.session.managers.AttributesManagerImpl.validateCredentials(AttributesManagerImpl.java:607)

                at org.jboss.seam.security.management.IdmAuthenticator.authenticate(IdmAuthenticator.java:45)

                at org.jboss.seam.security.management.IdmAuthenticator$Proxy$_$$_WeldClientProxy.authenticate(IdmAuthenticator$Proxy$_$$_WeldClientProxy.java)

                at org.jboss.seam.security.IdentityImpl.authenticate(IdentityImpl.java:224)

                ... 46 more

       

       

       

       

      After logging with u:shane and p:password , in MySql server logs I found 2 queries:

       

       

       

       select identityob0_.id as id76_, identityob0_.name as name76_ from IdentityObjectType identityob0_ where identityob0_.name='USER' limit 2

       

       

       select identityob0_.id as id1_, identityob0_.name as name1_, identityob0_.IDENTITY_OBJECT_TYPE_ID as IDENTITY3_1_ from IdentityObject identityob0_ 
      where identityob0_.name='shane' and identityob0_.IDENTITY_OBJECT_TYPE_ID=x'ACED000573720034636F6D2E6D776173696C756B2E636861726974792E7365727665722E6D6F64656C2E4964656E746974794F626A656374547970658C5B3556C6D7542A0200024C000269647400104C6A6176612F6C616E672F4C6F6E673B4C00046E616D657400124C6A6176612F6C616E672F537472696E673B78707372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000174000455534552' limit 2
      

       

      Although first one executes fine (returns id "1" and name "USER"), second one fails using strange IDENTITY_OBJECT_TYPE_ID string.

       

      How can I fix it?

       

      Thanks,

      Michal