Search in sources :

Example 11 with ExternalLdapConfig

use of com.zimbra.cs.ldap.LdapServerConfig.ExternalLdapConfig in project zm-mailbox by Zimbra.

the class AutoProvision method getExternalAttrsByDn.

protected ZAttributes getExternalAttrsByDn(String dn) throws ServiceException {
    String url = domain.getAutoProvLdapURL();
    boolean wantStartTLS = domain.isAutoProvLdapStartTlsEnabled();
    String adminDN = domain.getAutoProvLdapAdminBindDn();
    String adminPassword = domain.getAutoProvLdapAdminBindPassword();
    ExternalLdapConfig config = new ExternalLdapConfig(url, wantStartTLS, null, adminDN, adminPassword, null, "auto provision account");
    ZLdapContext zlc = null;
    try {
        zlc = LdapClient.getExternalContext(config, LdapUsage.AUTO_PROVISION);
        return prov.getHelper().getAttributes(zlc, dn, getAttrsToFetch());
    } finally {
        LdapClient.closeContext(zlc);
    }
}
Also used : ExternalLdapConfig(com.zimbra.cs.ldap.LdapServerConfig.ExternalLdapConfig) ZLdapContext(com.zimbra.cs.ldap.ZLdapContext)

Aggregations

ExternalLdapConfig (com.zimbra.cs.ldap.LdapServerConfig.ExternalLdapConfig)11 ZLdapContext (com.zimbra.cs.ldap.ZLdapContext)6 LDAPConnectionPool (com.unboundid.ldap.sdk.LDAPConnectionPool)3 KnownKey (com.zimbra.common.localconfig.KnownKey)3 UBIDLdapContext (com.zimbra.cs.ldap.unboundid.UBIDLdapContext)3 HashMap (java.util.HashMap)3 Test (org.junit.Test)3 ServiceException (com.zimbra.common.service.ServiceException)2 ZSearchResultEntry (com.zimbra.cs.ldap.ZSearchResultEntry)2 SearchGalResult (com.zimbra.cs.account.Provisioning.SearchGalResult)1 GalSearchConfig (com.zimbra.cs.gal.GalSearchConfig)1 LdapInvalidAttrValueException (com.zimbra.cs.ldap.LdapException.LdapInvalidAttrValueException)1 LdapSizeLimitExceededException (com.zimbra.cs.ldap.LdapException.LdapSizeLimitExceededException)1 SearchLdapOptions (com.zimbra.cs.ldap.SearchLdapOptions)1 ZLdapFilter (com.zimbra.cs.ldap.ZLdapFilter)1 FilterId (com.zimbra.cs.ldap.ZLdapFilterFactory.FilterId)1 ZSearchResultEnumeration (com.zimbra.cs.ldap.ZSearchResultEnumeration)1 Ignore (org.junit.Ignore)1