Search in sources :

Example 1 with StartTLSPostConnectProcessor

use of com.unboundid.ldap.sdk.StartTLSPostConnectProcessor in project zm-mailbox by Zimbra.

the class LdapConnectionPool method createConnPool.

private static LDAPConnectionPool createConnPool(LdapServerConfig config) throws LdapException {
    LdapServerPool serverPool = new LdapServerPool(config);
    ServerSet serverSet = serverPool.getServerSet();
    BindRequest bindRequest = createBindRequest(config);
    PostConnectProcessor postConnectProcessor = null;
    if (serverPool.getConnectionType() == LdapConnType.STARTTLS) {
        SSLContext startTLSContext = LdapSSLUtil.createSSLContext(config.sslAllowUntrustedCerts());
        postConnectProcessor = new StartTLSPostConnectProcessor(startTLSContext);
    }
    LDAPConnectionPool connPool = null;
    try {
        connPool = new LDAPConnectionPool(serverSet, bindRequest, config.getConnPoolInitSize(), config.getConnPoolMaxSize(), postConnectProcessor);
        connPool.setRetryFailedOperationsDueToInvalidConnections(true);
    } catch (LDAPException e) {
        throw UBIDLdapException.mapToLdapException(e);
    }
    return connPool;
}
Also used : ServerSet(com.unboundid.ldap.sdk.ServerSet) LDAPConnectionPool(com.unboundid.ldap.sdk.LDAPConnectionPool) LDAPException(com.unboundid.ldap.sdk.LDAPException) PostConnectProcessor(com.unboundid.ldap.sdk.PostConnectProcessor) StartTLSPostConnectProcessor(com.unboundid.ldap.sdk.StartTLSPostConnectProcessor) BindRequest(com.unboundid.ldap.sdk.BindRequest) SimpleBindRequest(com.unboundid.ldap.sdk.SimpleBindRequest) SSLContext(javax.net.ssl.SSLContext) StartTLSPostConnectProcessor(com.unboundid.ldap.sdk.StartTLSPostConnectProcessor)

Aggregations

BindRequest (com.unboundid.ldap.sdk.BindRequest)1 LDAPConnectionPool (com.unboundid.ldap.sdk.LDAPConnectionPool)1 LDAPException (com.unboundid.ldap.sdk.LDAPException)1 PostConnectProcessor (com.unboundid.ldap.sdk.PostConnectProcessor)1 ServerSet (com.unboundid.ldap.sdk.ServerSet)1 SimpleBindRequest (com.unboundid.ldap.sdk.SimpleBindRequest)1 StartTLSPostConnectProcessor (com.unboundid.ldap.sdk.StartTLSPostConnectProcessor)1 SSLContext (javax.net.ssl.SSLContext)1