Closed ancgate closed 6 years ago
Hi.
Have you tried allowing it to discover the domain itself using ADAuthenticatorFactory.newInstance()?
If you have the library in DEBUG mode you should see what it discovers.
I would also try and get a connection without calling addSearchObject() first to see if that will work. The addSearchObject method is ideally used to just improve performance.
Hi, thank you for the reply.
Yes, I tried allowing it to discover the domain itself using ADAuthenticatorFactory.newInstance() and it works perfectly. I got all the information of adUser. It works also when I put the domain name. I also got all the information of adUser. And I did all the this without calling addSearchObject(). The only problem I have is that it takes more than 30s to return the results. That is why I used the addsearchObject to improve performance. The authentication is faster however the method authenticator.retrieveLoggedInUser() return null. This is my problem. I wanted to know what did I missed knowing I want to improve the performance.
When I add the method addSearchObject to the authenticator, adUser is null even if I make the affection.
ADAuthenticator authenticator = ADAuthenticatorFactory.newInstance("MERQURY.COM"); String searchObject="OU=BOARD,DC=MERQURY,DC=COM"; authenticator.addSearchObject(searchObject); boolean authenticated = authenticator.authenticate("pmurphy", "password"); ADUser adUser = authenticator.retrieveLoggedInUser();