IDEMPIERE-3932 idempiereMonitor and OSGI console must validate against LDAP if configured

This commit is contained in:
Carlos Ruiz 2019-03-25 16:39:34 -03:00
parent 8641a1540f
commit c71fe5f56e
1 changed files with 10 additions and 1 deletions

View File

@ -33,6 +33,7 @@ import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import org.adempiere.exceptions.DBException;
import org.codehaus.groovy.classgen.GeneratorContext;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
@ -213,7 +214,15 @@ public class MUser extends X_AD_User
clientsValidated.add(user.getAD_Client_ID());
boolean valid = false;
if (hash_password) {
MSystem system = MSystem.get(Env.getCtx());
if (system == null)
throw new IllegalStateException("No System Info");
if (system.isLDAP() && ! Util.isEmpty(user.getLDAPUser())) {
System.out.println("validating with LDAP");
valid = system.isLDAP(name, password);
} else if (hash_password) {
valid = user.authenticateHash(password);
} else {
// password not hashed