[DS-1180] build the DN manually instead of attempting to search with the privileged adminUser

This commit is contained in:
Sam Ottenhoff
2012-05-29 13:37:58 -06:00
parent a9f3f7384a
commit 621f222740

View File

@@ -182,7 +182,19 @@ public class LDAPHierarchicalAuthentication
// Get the DN of the user
String adminUser = ConfigurationManager.getProperty("authentication-ldap", "search.user");
String adminPassword = ConfigurationManager.getProperty("authentication-ldap", "search.password");
String dn = ldap.getDNOfUser(adminUser, adminPassword, context, netid);
String objectContext = ConfigurationManager.getProperty("authentication-ldap", "object_context");
String idField = ConfigurationManager.getProperty("authentication-ldap", "id_field");
String dn = "";
// If adminUser is blank, then we can't search so assume the DN
if (StringUtils.isBlank(adminUser) || StringUtils.isBlank(adminPassword))
{
dn = idField + "=" + netid + "," + objectContext;
}
else
{
dn = ldap.getDNOfUser(adminUser, adminPassword, context, netid);
}
// Check a DN was found
if ((dn == null) || (dn.trim().equals("")))
@@ -579,4 +591,4 @@ public class LDAPHierarchicalAuthentication
{
return "org.dspace.eperson.LDAPAuthentication.title";
}
}
}