1 Reply Latest reply on Apr 26, 2012 2:51 AM by sekobey

    My custom login module class could not be found by JBOSS???

    sekobey

      Hi everybody,

       

      I'm working on login a remote ejb client to the JBOSS 7.1.1 server for a one week, however i am not successful. I use my own security-domain which consists of remoting, LdapExtended and my custom login module. I see in the logs LdapExt login is successful, however my login module class is not found. I tried deploying my login module in a jar which in my ear file, i define a new module in modules folder and i add module tag in login module definition in standalone.xml and at last i tried changing org/jboss/as/remoting module's xml file by adding my login module jar as resource-root. However my all trials are failed. Now i don't know how JBOSS show my custom login module.

      I added standalone.xml, myloginmodule.jar as attachments. jar file is added as resource root in org/jboss/as/remoting/module.xml. My client code is like this, there is no jboss-ejb-client.properties because i give parameters as hard-coded.

       

      My client code:

       

      Properties pr = new Properties();

      pr.put("endpoint.name", "client-endpoint");

      pr.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");

      pr.put("remote.connections", "default");

      pr.put("remote.connection.default.port", "4447");

      pr.put("remote.connection.default.host", "10.204.10.54");

      pr.put("remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS", "JBOSS-LOCAL-USER");

      pr.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");

      pr.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");

      pr.put("remote.connection.default.username", "49351259682");

      pr.put("remote.connection.default.password", "Test12345");

      EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(pr);

      ContextSelector < EJBClientContext > selector = new ConfigBasedEJBClientContextSelector(cc);

      EJBClientContext.setSelector(selector);

       

       

      Properties props = new Properties();

      props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

      props.put("jboss.naming.client.ejb.context", true);

       

       

      try {

            Context c = new InitialContext(props);

            kullaniciEJB = (KullaniciEJBRemote) c.lookup("ejb:merveys-kayit-tckkys/merveys-kayit-ejb-tckkys//KullaniciEJB!tr.gov.tubitak.bilgem.uekae.deys.tckk.merveys.common.controller.ejb.kullanici.KullaniciEJBRemote");

      } catch (NamingException e) {

            e.printStackTrace();

      }

       

      int count = kullaniciEJB.countKartIslemList(1L, null, null);

       

      Error log is below:

       

      11:26:59,626 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] (Remoting "sekobey" task-2) Begin getAppConfigurationEntry(TckkysSecurity), size

      =4

      11:26:59,628 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] (Remoting "sekobey" task-2) End getAppConfigurationEntry(TckkysSecurity), authIn

      fo=AppConfigurationEntry[]:

      [0]

      LoginModule Class: org.jboss.as.security.remoting.RemotingLoginModule

      ControlFlag: LoginModuleControlFlag: optional

      Options:

      name=password-stacking, value=useFirstPass

      [1]

      LoginModule Class: org.jboss.security.auth.spi.LdapExtLoginModule

      ControlFlag: LoginModuleControlFlag: required

      Options:

      name=baseFilter, value=(sAMAccountName={0})

      name=bindDN, value=tckk\administrator

      name=rolesCtxDN, value=cn=Users,dc=TCKK,dc=net

      name=roleNameAttributeID, value=name

      name=baseCtxDN, value=ou=TCKK,dc=TCKK,dc=net

      name=password-stacking, value=useFirstPass

      name=java.naming.factory.initial, value=com.sun.jndi.ldap.LdapCtxFactory

      name=java.naming.security.authentication, value=simple

      name=roleFilter, value=(member={1})

      name=allowEmptyPasswords, value=false

      name=java.naming.provider.url, value=ldap://tckk_ldap:389

      name=bindCredential, value=****

      name=roleAttributeIsDN, value=true

      name=searchScope, value=ONELEVEL_SCOPE

      name=throwValidateError, value=true

      [2]

      LoginModule Class: tr.gov.tubitak.bilgem.uekae.deys.tckk.merveys.kayit.controller.util.KysRolLoginModule

      ControlFlag: LoginModuleControlFlag: required

      Options:

      name=dsJndiName, value=java:/TckkDS

      name=password-stacking, value=useFirstPass

       

       

      11:26:59,677 TRACE [org.jboss.as.security.remoting.RemotingLoginModule] (Remoting "sekobey" task-2) initialize

      11:26:59,679 TRACE [org.jboss.as.security.remoting.RemotingLoginModule] (Remoting "sekobey" task-2) Security domain: TckkysSecurity

      11:26:59,681 TRACE [org.jboss.as.security.remoting.RemotingLoginModule] (Remoting "sekobey" task-2) login

      11:26:59,682 TRACE [org.jboss.security.auth.spi.LdapExtLoginModule] (Remoting "sekobey" task-2) initialize

      11:26:59,684 TRACE [org.jboss.security.auth.spi.LdapExtLoginModule] (Remoting "sekobey" task-2) Security domain: TckkysSecurity

      11:26:59,685 TRACE [org.jboss.security.auth.spi.LdapExtLoginModule] (Remoting "sekobey" task-2) login

      11:26:59,686 TRACE [org.jboss.security.auth.spi.LdapExtLoginModule] (Remoting "sekobey" task-2) Failed to parse: null, disabling recursion: java.lang.

      NumberFormatException: null

              at java.lang.Integer.parseInt(Integer.java:417) [rt.jar:1.6.0_26]

              at java.lang.Integer.parseInt(Integer.java:499) [rt.jar:1.6.0_26]

              at org.jboss.security.auth.spi.LdapExtLoginModule.createLdapInitContext(LdapExtLoginModule.java:395) [picketbox-4.0.7.Final.jar:4.0.7.Final]

              at org.jboss.security.auth.spi.LdapExtLoginModule.validatePassword(LdapExtLoginModule.java:312) [picketbox-4.0.7.Final.jar:4.0.7.Final]

              at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:267) [picketbox-4.0.7.Final.jar:4.0.7.Final]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_26]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_26]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_26]

              at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_26]

              at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769) [rt.jar:1.6.0_26]

              at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) [rt.jar:1.6.0_26]

              at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) [rt.jar:1.6.0_26]

              at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.6.0_26]

              at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) [rt.jar:1.6.0_26]

              at javax.security.auth.login.LoginContext.login(LoginContext.java:579) [rt.jar:1.6.0_26]

              at org.jboss.as.domain.management.security.JaasCallbackHandler.handle(JaasCallbackHandler.java:126) [jboss-as-domain-management-7.1.1.Final.ja

      r:7.1.1.Final]

              at org.jboss.as.remoting.RealmSecurityProvider$RealmCallbackHandler.handle(RealmSecurityProvider.java:418) [jboss-as-remoting-7.1.1.Final.jar:

      7.1.1.Final]

              at org.jboss.sasl.util.AbstractSaslParticipant.tryHandleCallbacks(AbstractSaslParticipant.java:98) [jboss-sasl-1.0.0.Final.jar:1.0.0.Final]

              at org.jboss.sasl.util.AbstractSaslParticipant.handleCallbacks(AbstractSaslParticipant.java:83) [jboss-sasl-1.0.0.Final.jar:1.0.0.Final]

              at org.jboss.sasl.plain.PlainSaslServer.access$000(PlainSaslServer.java:41) [jboss-sasl-1.0.0.Final.jar:1.0.0.Final]

              at org.jboss.sasl.plain.PlainSaslServer$1.evaluateMessage(PlainSaslServer.java:95) [jboss-sasl-1.0.0.Final.jar:1.0.0.Final]

              at org.jboss.sasl.util.AbstractSaslParticipant.evaluateMessage(AbstractSaslParticipant.java:165) [jboss-sasl-1.0.0.Final.jar:1.0.0.Final]

              at org.jboss.sasl.util.AbstractSaslServer.evaluateResponse(AbstractSaslServer.java:56) [jboss-sasl-1.0.0.Final.jar:1.0.0.Final]

              at org.xnio.sasl.SaslUtils.evaluateResponse(SaslUtils.java:194) [xnio-api-3.0.3.GA.jar:3.0.3.GA]

              at org.jboss.remoting3.remote.ServerConnectionOpenListener$AuthStepRunnable.run(ServerConnectionOpenListener.java:407) [jboss-remoting-3.2.3.G

      A.jar:3.2.3.GA]

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]

              at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

       

       

      11:26:59,745 TRACE [org.jboss.security.auth.spi.LdapExtLoginModule] (Remoting "sekobey" task-2) Logging into LDAP server, env={throwValidateError=true

      , baseFilter=(sAMAccountName={0}), allowEmptyPasswords=false, java.naming.security.credentials=***, jboss.security.security_domain=TckkysSecurity, pas

      sword-stacking=useFirstPass, java.naming.security.authentication=simple, baseCtxDN=ou=TCKK,dc=TCKK,dc=net, roleAttributeIsDN=true, rolesCtxDN=cn=Users

      ,dc=TCKK,dc=net, java.naming.security.principal=tckk\administrator, searchScope=ONELEVEL_SCOPE, java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxF

      actory, roleFilter=(member={1}), java.naming.provider.url=ldap://tckk_ldap:389, roleNameAttributeID=name, bindDN=tckk\administrator, bindCredential=**

      *}

      11:26:59,755 TRACE [org.jboss.security.auth.spi.LdapExtLoginModule] (Remoting "sekobey" task-2) Logging into LDAP server, env={throwValidateError=true

      , baseFilter=(sAMAccountName={0}), allowEmptyPasswords=false, java.naming.security.credentials=***, jboss.security.security_domain=TckkysSecurity, pas

      sword-stacking=useFirstPass, java.naming.security.authentication=simple, baseCtxDN=ou=TCKK,dc=TCKK,dc=net, roleAttributeIsDN=true, rolesCtxDN=cn=Users

      ,dc=TCKK,dc=net, java.naming.security.principal=CN=serkan y²ld²r²m,OU=TCKK,DC=TCKK,DC=net, searchScope=ONELEVEL_SCOPE, java.naming.factory.initial=com

      .sun.jndi.ldap.LdapCtxFactory, roleFilter=(member={1}), java.naming.provider.url=ldap://tckk_ldap:389, roleNameAttributeID=name, bindDN=tckk\administr

      ator, bindCredential=***}

      11:26:59,763 TRACE [org.jboss.security.auth.spi.LdapExtLoginModule] (Remoting "sekobey" task-2) User '49351259682' authenticated, loginOk=true

      11:26:59,764 TRACE [org.jboss.remoting.remote.server] (Remoting "sekobey" task-2) Server sending authentication rejected (javax.security.sasl.SaslExce

      ption: Callback handler invocation failed [Caused by java.lang.NoClassDefFoundError: Could not initialize class tr.gov.tubitak.bilgem.uekae.deys.tckk.

      merveys.kayit.controller.util.KysRolLoginModule])

      11:26:59,767 TRACE [org.xnio.channels.framed] (Remoting "sekobey" task-2) Accepting java.nio.HeapByteBuffer[pos=0 lim=1 cap=8192] into java.nio.HeapBy

      teBuffer[pos=0 lim=8196 cap=8196]

      11:26:59,769 TRACE [org.xnio.channels.framed] (Remoting "sekobey" task-2) Accepted a message into java.nio.HeapByteBuffer[pos=5 lim=8196 cap=8196]

      11:26:59,770 TRACE [org.xnio.channels.framed] (Remoting "sekobey" task-2) Fully flushed org.xnio.channels.FramedMessageChannel around TCP socket chann

      el (NIO) <1de0ed6>

      11:26:59,771 TRACE [org.xnio.nio.selector] (Remoting "sekobey" read-1) Selected on sun.nio.ch.WindowsSelectorImpl@18abaa4

      11:26:59,771 TRACE [org.jboss.remoting.remote.connection] (Remoting "sekobey" task-2) Sent message java.nio.HeapByteBuffer[pos=1 lim=1 cap=8192] (dire

      ct)

      11:26:59,772 TRACE [org.xnio.nio.selector] (Remoting "sekobey" read-1) Selected key sun.nio.ch.SelectionKeyImpl@1a01913 for java.nio.channels.SocketCh

      annel[connected local=SEKOBEY.ug.net/10.204.10.54:4447 remote=/10.204.10.54:54551]

      11:26:59,773 TRACE [org.xnio.channels.framed] (Remoting "sekobey" task-2) Fully flushed org.xnio.channels.FramedMessageChannel around TCP socket chann

      el (NIO) <1de0ed6>

      11:26:59,774 TRACE [org.xnio.listener] (Remoting "sekobey" read-1) Invoking listener Read listener for org.xnio.channels.FramedMessageChannel around T

      CP socket channel (NIO) <1de0ed6> on channel TCP socket channel (NIO) <1de0ed6>

      11:26:59,774 TRACE [org.jboss.remoting.remote.connection] (Remoting "sekobey" task-2) Flushed channel (direct)

        • 1. Re: My custom login module class could not be found by JBOSS???
          sekobey

          I tried 7.1.2 Nightly build yesterday. My problem is solved there. However, it only accepts if my login module class is in my ear file as under lib folder or as a class in ejb jar. I tried putting my login module jar as a module in modules directory. In standalone.xml, i give module name as parameter to the login module tag but it doesn't work. I think we must add a login module jar as a module to the jboss and we can use it in our security-domain.