diff --git a/org.adempiere.base/src/org/compiere/db/LDAP.java b/org.adempiere.base/src/org/compiere/db/LDAP.java index 1eb5895a75..6fabde8e8d 100644 --- a/org.adempiere.base/src/org/compiere/db/LDAP.java +++ b/org.adempiere.base/src/org/compiere/db/LDAP.java @@ -26,6 +26,7 @@ import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.ldap.InitialLdapContext; +import org.compiere.model.MSysConfig; import org.compiere.util.CLogger; @@ -52,10 +53,12 @@ public class LDAP // ldap://dc.compiere.org env.put(Context.PROVIDER_URL, ldapURL); env.put(Context.SECURITY_AUTHENTICATION, "simple"); - // jjanke@compiere.org - // For OpenLDAP uncomment the next line - // StringBuffer principal = new StringBuffer("uid=").append(userName).append(",").append(domain); - StringBuffer principal = new StringBuffer(userName).append("@").append(domain); + StringBuffer principal; + if ("openldap".equals(MSysConfig.getValue(MSysConfig.LDAP_TYPE))) { + principal = new StringBuffer("uid=").append(userName).append(",").append(domain); + } else { + principal = new StringBuffer(userName).append("@").append(domain); + } env.put(Context.SECURITY_PRINCIPAL, principal.toString()); env.put(Context.SECURITY_CREDENTIALS, password); // diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 273464d002..1b140ad148 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -39,12 +39,12 @@ import org.compiere.util.DisplayType; */ public class MSysConfig extends X_AD_SysConfig { - /** + /** * */ - private static final long serialVersionUID = 8922763368373540965L; + private static final long serialVersionUID = -3144528502974306817L; - public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; + public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; public static final String ALLOCATION_DESCRIPTION = "ALLOCATION_DESCRIPTION"; public static final String ALLOW_APPLY_PAYMENT_TO_CREDITMEMO = "ALLOW_APPLY_PAYMENT_TO_CREDITMEMO"; @@ -104,6 +104,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber"; public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES"; public static final String LASTRUN_RECORD_COUNT = "LASTRUN_RECORD_COUNT"; + public static final String LDAP_TYPE = "LDAP_TYPE"; public static final String LOCATION_MAPS_DESTINATION_ADDRESS = "LOCATION_MAPS_DESTINATION_ADDRESS"; public static final String LOCATION_MAPS_ROUTE_PREFIX = "LOCATION_MAPS_ROUTE_PREFIX"; public static final String LOCATION_MAPS_SOURCE_ADDRESS = "LOCATION_MAPS_SOURCE_ADDRESS";