]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7781 Delete sonar.security.savePassword property
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 29 Jun 2016 07:22:27 +0000 (09:22 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 29 Jun 2016 07:37:40 +0000 (09:37 +0200)
it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java
server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java

index c0692cd7820debc7fd1e672ac9194bbcc905d652..048eb41037fe245d97bd6f7ad0754e11136c4249 100644 (file)
@@ -36,7 +36,6 @@ import org.apache.commons.lang.RandomStringUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.ClassRule;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -90,7 +89,6 @@ public class RailsExternalAuthenticationTest {
   public void resetData() throws Exception {
     setServerProperty(orchestrator, USERS_PROPERTY, null);
     setServerProperty(orchestrator, "sonar.security.updateUserAttributes", null);
-    setServerProperty(orchestrator, "sonar.security.savePassword", null);
     setServerProperty(orchestrator, "sonar.authenticator.createUsers", null);
     resetUsers(USER_LOGIN, TECH_USER);
   }
@@ -173,44 +171,6 @@ public class RailsExternalAuthenticationTest {
         "/user/ExternalAuthenticationTest/external-user-details2.html").build()).runOn(orchestrator);
   }
 
-  /**
-   * SONAR-3138
-   */
-  @Test
-  @Ignore("Fail because sonar.security.savePassword is only read at startup => this test should start its own server")
-  public void shouldFallback() {
-    // Given clean Sonar installation and no users in external system
-    setServerProperty(orchestrator, "sonar.security.savePassword", "true");
-    String login = USER_LOGIN;
-    String oldPassword = "1234567";
-    Map<String, String> users = Maps.newHashMap();
-
-    // When user created in external system
-    users.put(login + ".password", oldPassword);
-    updateUsersInExtAuth(users);
-    // Then
-    assertThat(loginAttempt(login, oldPassword)).isEqualTo(AUTHORIZED);
-
-    // When new external password was set
-    String newPassword = "7654321";
-    users.put(login + ".password", newPassword);
-    updateUsersInExtAuth(users);
-    // Then
-    assertThat(loginAttempt(login, newPassword)).isEqualTo(AUTHORIZED);
-
-    assertThat(loginAttempt(login, oldPassword)).isEqualTo(NOT_AUTHORIZED);
-
-    assertThat(loginAttempt(login, "wrong")).isEqualTo(NOT_AUTHORIZED);
-
-    // When external system does not work
-    users.remove(login + ".password");
-    updateUsersInExtAuth(users);
-    // Then
-    assertThat(loginAttempt(login, newPassword)).isEqualTo(AUTHORIZED);
-    assertThat(loginAttempt(login, oldPassword)).isEqualTo(NOT_AUTHORIZED);
-    assertThat(loginAttempt(login, "wrong")).isEqualTo(NOT_AUTHORIZED);
-  }
-
   /**
    * SONAR-3138
    */
@@ -240,7 +200,6 @@ public class RailsExternalAuthenticationTest {
   @Test
   public void adminIsLocalAccountByDefault() {
     // Given clean Sonar installation and no users in external system
-    setServerProperty(orchestrator, "sonar.security.savePassword", "false");
     String login = "admin";
     String localPassword = "admin";
     String remotePassword = "nimda";
index b80ef4aebed4a8a5712d02f22f5090310587391b..4a3267e4ce7a7af218b7e7aedb9fc022573098f0 100644 (file)
  */
 package org.sonar.ce.container;
 
+import static java.lang.String.valueOf;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.sonar.process.ProcessEntryPoint.PROPERTY_PROCESS_INDEX;
+import static org.sonar.process.ProcessEntryPoint.PROPERTY_SHARED_PATH;
+import static org.sonar.process.ProcessProperties.PATH_DATA;
+import static org.sonar.process.ProcessProperties.PATH_HOME;
+import static org.sonar.process.ProcessProperties.PATH_TEMP;
+import static org.sonar.process.ProcessProperties.STARTED_AT;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.Date;
@@ -34,15 +43,6 @@ import org.sonar.db.DbTester;
 import org.sonar.process.ProcessId;
 import org.sonar.process.Props;
 
-import static java.lang.String.valueOf;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.process.ProcessEntryPoint.PROPERTY_PROCESS_INDEX;
-import static org.sonar.process.ProcessEntryPoint.PROPERTY_SHARED_PATH;
-import static org.sonar.process.ProcessProperties.PATH_DATA;
-import static org.sonar.process.ProcessProperties.PATH_HOME;
-import static org.sonar.process.ProcessProperties.PATH_TEMP;
-import static org.sonar.process.ProcessProperties.STARTED_AT;
-
 public class ComputeEngineContainerImplTest {
   private static final int CONTAINER_ITSELF = 1;
   private static final int COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION = CONTAINER_ITSELF + 1;
@@ -102,7 +102,7 @@ public class ComputeEngineContainerImplTest {
         + 22 // level 1
         + 46 // content of DaoModule
         + 1 // content of EsSearchModule
-        + 57 // content of CorePropertyDefinitions
+        + 56 // content of CorePropertyDefinitions
         + 1 // content of CePropertyDefinitions
     );
     assertThat(picoContainer.getParent().getParent().getParent().getParent()).isNull();
index 3369492cdc9fe812a1fa348962d33fe7747103ea..08305b9ab159ab7b6f26db7270df1bffc32143e4 100644 (file)
@@ -19,6 +19,8 @@
  */
 package org.sonar.core.config;
 
+import static org.sonar.api.database.DatabaseProperties.PROP_PASSWORD;
+
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 import java.util.Arrays;
@@ -28,8 +30,6 @@ import org.sonar.api.PropertyType;
 import org.sonar.api.config.PropertyDefinition;
 import org.sonar.api.resources.Qualifiers;
 
-import static org.sonar.api.database.DatabaseProperties.PROP_PASSWORD;
-
 public class CorePropertyDefinitions {
 
   /* Time machine periods */
@@ -120,10 +120,6 @@ public class CorePropertyDefinitions {
         .name("Security Realm")
         .hidden()
         .build(),
-      PropertyDefinition.builder("sonar.security.savePassword")
-        .name("Save external password")
-        .hidden()
-        .build(),
       PropertyDefinition.builder("sonar.authenticator.downcase")
         .name("Downcase login")
         .description("Downcase login during user authentication, typically for Active Directory")