Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-5268

Anonymous bind login doesn't work for ldap connector

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 10.0.4, 10.2, 10.1.2
    • 8.8, 8.12.5
    • LDAP Connector
    • None

      I configured an anonymous to connect to LDAP server via ldaps://... according to https://docs.jboss.org/author/display/teiid812final/LDAP+Data+Sources
      like:

                      <resource-adapter id="ldap">
                          <module slot="main" id="org.jboss.teiid.resource-adapter.ldap"/>
                          <connection-definitions>
                              <connection-definition class-name="org.teiid.resource.adapter.ldap.LDAPManagedConnectionFactory" jndi-name="java:/ldapDS" enabled="true" use-java-context="true" pool-name="ldapDS">
                                  <config-property name="LdapUrl">
                                      ldaps://ldap.corp.redhat.com:636
                                  </config-property>
                                  <config-property name="LdapAdminUserDN">
                                  </config-property>
                                  <config-property name="LdapAdminUserPassword">
                                  </config-property>
                                  <config-property name="LdapTxnTimeoutInMillis">
                                      -1
                                  </config-property>
                              </connection-definition>
                          </connection-definitions>
                      </resource-adapter>
      

      when I test the connection by jboss-cli, error occurs:
      command:

      [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS:test-connection-in-pool
      

      error:

      13:02:17,263 DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (management-handler-thread - 3) ldapDS running as FIFO
      13:02:17,263 DEBUG [org.jboss.jca.core.connectionmanager.pool.idle.IdleRemover] (management-handler-thread - 3) Register pool: SemaphoreArrayListManagedConnectionPool@13f30b23[pool=ldapDS] (interval=1800000)
      13:02:17,264 DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (management-handler-thread - 3) ldapDS: getConnection(null, null) [0/20]
      13:02:17,802 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (management-handler-thread - 3) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Initializing LDAP directory context failed. Please check LDAP connection properties, including username and password: [LDAP: error code 49 - Invalid Credentials]
      	at org.teiid.resource.adapter.ldap.LDAPConnectionImpl.initializeLDAPContext(LDAPConnectionImpl.java:151)
      	at org.teiid.resource.adapter.ldap.LDAPConnectionImpl.<init>(LDAPConnectionImpl.java:75)
      	at org.teiid.resource.adapter.ldap.LDAPManagedConnectionFactory$1.getConnection(LDAPManagedConnectionFactory.java:49)
      	at org.teiid.resource.adapter.ldap.LDAPManagedConnectionFactory$1.getConnection(LDAPManagedConnectionFactory.java:43)
      	at org.teiid.resource.spi.BasicManagedConnectionFactory.createManagedConnection(BasicManagedConnectionFactory.java:71)
      	at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:858) [ironjacamar-core-impl-1.0.37.Final-redhat-1.jar:1.0.37.Final-redhat-1]
      	at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:413) [ironjacamar-core-impl-1.0.37.Final-redhat-1.jar:1.0.37.Final-redhat-1]
      	at org.jboss.jca.core.connectionmanager.pool.AbstractPool.internalTestConnection(AbstractPool.java:725) [ironjacamar-core-impl-1.0.37.Final-redhat-1.jar:1.0.37.Final-redhat-1]
      	at org.jboss.jca.core.connectionmanager.pool.strategy.OnePool.testConnection(OnePool.java:89) [ironjacamar-core-impl-1.0.37.Final-redhat-1.jar:1.0.37.Final-redhat-1]
      	at org.jboss.as.connector.subsystems.common.pool.PoolOperations$TestConnectionInPool.invokeCommandOn(PoolOperations.java:143) [jboss-as-connector-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.connector.subsystems.common.pool.PoolOperations$1.execute(PoolOperations.java:82) [jboss-as-connector-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:702) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:537) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:338) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:314) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1144) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:331) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:201) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doExecute(ModelControllerClientOperationHandler.java:208) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.access$300(ModelControllerClientOperationHandler.java:135) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1$1.run(ModelControllerClientOperationHandler.java:157) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1$1.run(ModelControllerClientOperationHandler.java:153) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_112]
      	at javax.security.auth.Subject.doAs(Subject.java:422) [rt.jar:1.8.0_112]
      	at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:94) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.execute(ModelControllerClientOperationHandler.java:153) [jboss-as-controller-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2$1.doExecute(AbstractMessageHandler.java:298)
      	at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:537)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_112]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_112]
      	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_112]
      	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.2.Final-redhat-1.jar:2.1.2.Final-redhat-1]
      Caused by: javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]
      	at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3136) [rt.jar:1.8.0_112]
      	at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3082) [rt.jar:1.8.0_112]
      	at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2883) [rt.jar:1.8.0_112]
      	at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2797) [rt.jar:1.8.0_112]
      	at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:319) [rt.jar:1.8.0_112]
      	at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:192) [rt.jar:1.8.0_112]
      	at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:210) [rt.jar:1.8.0_112]
      	at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:153) [rt.jar:1.8.0_112]
      	at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:83) [rt.jar:1.8.0_112]
      	at org.jboss.as.naming.InitialContext.getDefaultInitCtx(InitialContext.java:122) [jboss-as-naming-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.naming.InitialContext.init(InitialContext.java:107) [jboss-as-naming-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:154) [rt.jar:1.8.0_112]
      	at org.jboss.as.naming.InitialContext.<init>(InitialContext.java:98) [jboss-as-naming-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at org.jboss.as.naming.InitialContextFactory.getInitialContext(InitialContextFactory.java:44) [jboss-as-naming-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
      	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684) [rt.jar:1.8.0_112]
      	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) [rt.jar:1.8.0_112]
      	at javax.naming.InitialContext.init(InitialContext.java:244) [rt.jar:1.8.0_112]
      	at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:154) [rt.jar:1.8.0_112]
      	at org.teiid.resource.adapter.ldap.LDAPConnectionImpl.initializeLDAPContext(LDAPConnectionImpl.java:148)
      	... 31 more
      
      13:02:17,808 DEBUG [org.jboss.as.controller.management-operation] (management-handler-thread - 3) JBAS014616: Operation ("test-connection-in-pool") failed - address: ([
          ("subsystem" => "resource-adapters"),
          ("resource-adapter" => "ldap"),
          ("connection-definitions" => "ldapDS")
      ]) - failure description: "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid"
      

      It looks username isn't set as expected

              rhn-engineering-shawkins Steven Hawkins
              yzhu@redhat.com Yu Ming Zhu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: