Search code examples
javaldapunboundid-ldap-sdk

How to check whether current LDAP server is up or down before doing an authentication


I want to check whether the current LDAP server is up or down before doing an authentication. I am using UnboundID LDAP SDK. IS there any possible way to do this?


Solution

  • We can do this with SSUtil. Here an authenticated entry will not be needed and we can check whether the server is up or down before doing any authentication.

    SSLUtil su = new SSLUtil(new TrustAllTrustManager());
    SSLSocketFactory sf = su.createSSLSocketFactory();
    LDAPConnection connection = new LDAPConnection(sf,"localhost", 10636);
    

    Looking for pros and cons for this solution.