IDEMPIERE-3861 Switch LDAP type by System Configuration / based on suggestion from Ray Lee
This commit is contained in:
parent
ca2c67999d
commit
8641a1540f
|
@ -26,6 +26,7 @@ import javax.naming.directory.Attribute;
|
||||||
import javax.naming.directory.Attributes;
|
import javax.naming.directory.Attributes;
|
||||||
import javax.naming.ldap.InitialLdapContext;
|
import javax.naming.ldap.InitialLdapContext;
|
||||||
|
|
||||||
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,10 +53,12 @@ public class LDAP
|
||||||
// ldap://dc.compiere.org
|
// ldap://dc.compiere.org
|
||||||
env.put(Context.PROVIDER_URL, ldapURL);
|
env.put(Context.PROVIDER_URL, ldapURL);
|
||||||
env.put(Context.SECURITY_AUTHENTICATION, "simple");
|
env.put(Context.SECURITY_AUTHENTICATION, "simple");
|
||||||
// jjanke@compiere.org
|
StringBuffer principal;
|
||||||
// For OpenLDAP uncomment the next line
|
if ("openldap".equals(MSysConfig.getValue(MSysConfig.LDAP_TYPE))) {
|
||||||
// StringBuffer principal = new StringBuffer("uid=").append(userName).append(",").append(domain);
|
principal = new StringBuffer("uid=").append(userName).append(",").append(domain);
|
||||||
StringBuffer principal = new StringBuffer(userName).append("@").append(domain);
|
} else {
|
||||||
|
principal = new StringBuffer(userName).append("@").append(domain);
|
||||||
|
}
|
||||||
env.put(Context.SECURITY_PRINCIPAL, principal.toString());
|
env.put(Context.SECURITY_PRINCIPAL, principal.toString());
|
||||||
env.put(Context.SECURITY_CREDENTIALS, password);
|
env.put(Context.SECURITY_CREDENTIALS, password);
|
||||||
//
|
//
|
||||||
|
|
|
@ -42,7 +42,7 @@ 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 ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
|
||||||
|
@ -104,6 +104,7 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber";
|
public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber";
|
||||||
public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES";
|
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 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_DESTINATION_ADDRESS = "LOCATION_MAPS_DESTINATION_ADDRESS";
|
||||||
public static final String LOCATION_MAPS_ROUTE_PREFIX = "LOCATION_MAPS_ROUTE_PREFIX";
|
public static final String LOCATION_MAPS_ROUTE_PREFIX = "LOCATION_MAPS_ROUTE_PREFIX";
|
||||||
public static final String LOCATION_MAPS_SOURCE_ADDRESS = "LOCATION_MAPS_SOURCE_ADDRESS";
|
public static final String LOCATION_MAPS_SOURCE_ADDRESS = "LOCATION_MAPS_SOURCE_ADDRESS";
|
||||||
|
|
Loading…
Reference in New Issue