Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Windows Active Directory lookup

Avatar

Level 1

Hi,

 

I am trying to connect to a window's AD server that's not LDAP enabled. I have all details DNS, Domain Controller etc. When I am trying to use Intial Directory Context I get an error that "java.naming/javax.naming.directory.InitialDirContext.getURLOrDefaultInitDirCtx(InitialDirContext.java:111)"

 

As  a standalone java program I am able to establish connection but not when using in combination with AEM. Is there any other way of connecting where LDAP protocol is not used?

 

 

Thank you in advance!

5 Replies

Avatar

Level 1

Thanks for the suggestions.

Installed all jars and resolve ddependencie, but I am getting a new errror now.

 

Ldapauth is failing and below message is from the error log - 

Tried api-all.jar and then with individual jars.

 

07.07.2021 18:12:33.589 ERROR [0:0:0:0:0:0:0:1 [1625661753586] GET /bin/ebook/service/ldapAuth HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable java.lang.NoSuchMethodError: org.apache.directory.ldap.client.api.LdapConnectionPool.<init>(Lorg/apache/commons/pool/PoolableObjectFactory;)

 

Getting error while establishing connection -

final LdapConnectionPool pool = new LdapConnectionPool(factory);

Avatar

Level 1

Somehow overcame the previous error after trying some old versions of the JAR, but getting this new error now

InvalidDN exception when authenticate method is ran.

final PasswordWarning warning = ldapConnectionTemplate.authenticate( "ou=test,dc=example,dc=com", "(sAMAccountName=" + username +")", SearchScope.SUBTREE, password.toCharArray());

 

exc.png