aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-auth-ldap
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2019-12-05 11:01:07 +0100
committerSonarTech <sonartech@sonarsource.com>2019-12-05 20:46:09 +0100
commit86b588f7038e02445b19dc0fb087a09985ee4428 (patch)
tree74268cc4c37d53e812409518ba62856c8a69b197 /server/sonar-auth-ldap
parent5903d90c057cf58c17e32b4c5c20f87dd8e4f452 (diff)
downloadsonarqube-86b588f7038e02445b19dc0fb087a09985ee4428.tar.gz
sonarqube-86b588f7038e02445b19dc0fb087a09985ee4428.zip
SONAR-12772 Remove deprecated ldap.group.objectClass and ldap. group.memberAttribute
Diffstat (limited to 'server/sonar-auth-ldap')
-rw-r--r--server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapGroupMapping.java21
-rw-r--r--server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapGroupMappingTest.java10
2 files changed, 1 insertions, 30 deletions
diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapGroupMapping.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapGroupMapping.java
index a464345ebf4..1dbc6552b91 100644
--- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapGroupMapping.java
+++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapGroupMapping.java
@@ -25,19 +25,13 @@ import javax.naming.directory.Attribute;
import javax.naming.directory.SearchResult;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.config.Settings;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
/**
* @author Evgeny Mandrikov
*/
public class LdapGroupMapping {
- private static final Logger LOG = Loggers.get(LdapGroupMapping.class);
-
- private static final String DEFAULT_OBJECT_CLASS = "groupOfUniqueNames";
private static final String DEFAULT_ID_ATTRIBUTE = "cn";
- private static final String DEFAULT_MEMBER_ATTRIBUTE = "uniqueMember";
private static final String DEFAULT_REQUEST = "(&(objectClass=groupOfUniqueNames)(uniqueMember={dn}))";
private final String baseDn;
@@ -52,20 +46,7 @@ public class LdapGroupMapping {
this.baseDn = settings.getString(settingsPrefix + ".group.baseDn");
this.idAttribute = StringUtils.defaultString(settings.getString(settingsPrefix + ".group.idAttribute"), DEFAULT_ID_ATTRIBUTE);
- String objectClass = settings.getString(settingsPrefix + ".group.objectClass");
- String memberAttribute = settings.getString(settingsPrefix + ".group.memberAttribute");
-
- String req;
- if (StringUtils.isNotBlank(objectClass) || StringUtils.isNotBlank(memberAttribute)) {
- // For backward compatibility with plugin versions 1.1 and 1.1.1
- objectClass = StringUtils.defaultString(objectClass, DEFAULT_OBJECT_CLASS);
- memberAttribute = StringUtils.defaultString(memberAttribute, DEFAULT_MEMBER_ATTRIBUTE);
- req = "(&(objectClass=" + objectClass + ")(" + memberAttribute + "=" + "{dn}))";
- LOG.warn("Properties '" + settingsPrefix + ".group.objectClass' and '" + settingsPrefix + ".group.memberAttribute' are deprecated" +
- " and should be replaced by single property '" + settingsPrefix + ".group.request' with value: " + req);
- } else {
- req = StringUtils.defaultString(settings.getString(settingsPrefix + ".group.request"), DEFAULT_REQUEST);
- }
+ String req = StringUtils.defaultString(settings.getString(settingsPrefix + ".group.request"), DEFAULT_REQUEST);
this.requiredUserAttributes = StringUtils.substringsBetween(req, "{", "}");
for (int i = 0; i < requiredUserAttributes.length; i++) {
req = StringUtils.replace(req, "{" + requiredUserAttributes[i] + "}", "{" + i + "}");
diff --git a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapGroupMappingTest.java b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapGroupMappingTest.java
index 5a9acab0469..a2b7cea6bed 100644
--- a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapGroupMappingTest.java
+++ b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapGroupMappingTest.java
@@ -43,16 +43,6 @@ public class LdapGroupMappingTest {
}
@Test
- public void backward_compatibility() {
- MapSettings settings = new MapSettings()
- .setProperty("ldap.group.objectClass", "group")
- .setProperty("ldap.group.memberAttribute", "member");
- LdapGroupMapping groupMapping = new LdapGroupMapping(settings, "ldap");
-
- assertThat(groupMapping.getRequest()).isEqualTo("(&(objectClass=group)(member={0}))");
- }
-
- @Test
public void custom_request() {
MapSettings settings = new MapSettings()
.setProperty("ldap.group.request", "(&(|(objectClass=posixGroup)(objectClass=groupOfUniqueNames))(|(memberUid={uid})(uniqueMember={dn})))");