aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEric Hartmann <hartmann.eric@gmail.com>2018-06-08 15:27:35 +0200
committerSonarTech <sonartech@sonarsource.com>2018-06-09 20:20:42 +0200
commit95889c7f11fa494e0432c1e64906f9d0cdef2946 (patch)
treed59d5a3edacee9592da9f2ac261203f4af1ccf55 /tests
parent6f6f00faf62ea79215031534671bc4f1d9a55856 (diff)
downloadsonarqube-95889c7f11fa494e0432c1e64906f9d0cdef2946.tar.gz
sonarqube-95889c7f11fa494e0432c1e64906f9d0cdef2946.zip
SONAR-10830 Allow passcode even if forceAuthentication is true
Diffstat (limited to 'tests')
-rw-r--r--tests/src/test/java/org/sonarqube/tests/authorization/SystemPasscodeTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/SystemPasscodeTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/SystemPasscodeTest.java
index b6c9d71acd9..fbdafe3697c 100644
--- a/tests/src/test/java/org/sonarqube/tests/authorization/SystemPasscodeTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/authorization/SystemPasscodeTest.java
@@ -20,6 +20,7 @@
package org.sonarqube.tests.authorization;
import com.sonar.orchestrator.Orchestrator;
+import java.util.Arrays;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
@@ -70,6 +71,21 @@ public class SystemPasscodeTest {
assertThat(response.code()).isEqualTo(401);
}
+ @Test
+ public void system_access_is_granted_even_with_forceAuthentication_is_set_to_true() {
+ tester.settings().setGlobalSetting("sonar.forceAuthentication", "true");
+ Arrays.asList("/api/ce/pause", "/api/ce/resume", "/api/system/health", "/api/system/info")
+ .forEach(url -> {
+ WsRequest request = new GetRequest("api/system/health")
+ .setHeader(PASSCODE_HEADER, VALID_PASSCODE);
+
+ WsResponse response = tester.asAnonymous().wsClient().wsConnector().call(request);
+ assertThat(response.code()).isEqualTo(200);
+ }
+ );
+ tester.settings().setGlobalSetting("sonar.forceAuthentication", "false");
+ }
+
private static GetRequest newRequest() {
return new GetRequest("api/system_passcode/check");
}