From 35fcfd2d718f8eede0f5f26106853e16f02f4769 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Wed, 29 Jun 2016 09:22:27 +0200 Subject: [PATCH] SONAR-7781 Delete sonar.security.savePassword property --- .../user/RailsExternalAuthenticationTest.java | 41 ------------------- .../ComputeEngineContainerImplTest.java | 20 ++++----- .../core/config/CorePropertyDefinitions.java | 8 +--- 3 files changed, 12 insertions(+), 57 deletions(-) diff --git a/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java b/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java index c0692cd7820..048eb41037f 100644 --- a/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java +++ b/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java @@ -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 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"; diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java index b80ef4aebed..4a3267e4ce7 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java @@ -19,6 +19,15 @@ */ 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(); diff --git a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java index 3369492cdc9..08305b9ab15 100644 --- a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java +++ b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java @@ -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") -- 2.39.5