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;
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);
}
"/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
*/
@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";
*/
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;
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;
+ 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();
*/
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;
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 */
.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")