]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5430 Update SSO properties in order to start with "sonar.web.sso"
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 28 Nov 2016 15:25:50 +0000 (16:25 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 28 Nov 2016 15:25:50 +0000 (16:25 +0100)
it/it-tests/src/test/java/it/user/SsoAuthenticationTest.java
server/sonar-server/src/main/java/org/sonar/server/authentication/SsoAuthenticator.java
server/sonar-server/src/test/java/org/sonar/server/authentication/SsoAuthenticatorTest.java
sonar-application/src/main/assembly/conf/sonar.properties

index 76543eb289e4eb68ce854bef00024478cf6739ef..df84677bae2ef4bf53088391a1543fc89e28a483 100644 (file)
@@ -59,11 +59,11 @@ public class SsoAuthenticationTest {
 
   @ClassRule
   public static final Orchestrator orchestrator = Orchestrator.builderEnv()
-    .setServerProperty("sonar.sso.enable", "true")
-    .setServerProperty("sonar.sso.loginHeader", LOGIN_HEADER)
-    .setServerProperty("sonar.sso.nameHeader", NAME_HEADER)
-    .setServerProperty("sonar.sso.emailHeader", EMAIL_HEADER)
-    .setServerProperty("sonar.sso.groupsHeader", GROUPS_HEADER)
+    .setServerProperty("sonar.web.sso.enable", "true")
+    .setServerProperty("sonar.web.sso.loginHeader", LOGIN_HEADER)
+    .setServerProperty("sonar.web.sso.nameHeader", NAME_HEADER)
+    .setServerProperty("sonar.web.sso.emailHeader", EMAIL_HEADER)
+    .setServerProperty("sonar.web.sso.groupsHeader", GROUPS_HEADER)
     .build();
 
   @ClassRule
index 3eafed1f6da284c1c60aaa888c76f5fc137d2718..a1d3608fc78eaac80334d50c99e3122f6ed83f74 100644 (file)
@@ -54,21 +54,21 @@ public class SsoAuthenticator implements Startable {
 
   private static final Splitter COMA_SPLITTER = Splitter.on(",").trimResults().omitEmptyStrings();
 
-  private static final String ENABLE_PARAM = "sonar.sso.enable";
+  private static final String ENABLE_PARAM = "sonar.web.sso.enable";
 
-  private static final String LOGIN_HEADER_PARAM = "sonar.sso.loginHeader";
+  private static final String LOGIN_HEADER_PARAM = "sonar.web.sso.loginHeader";
   private static final String LOGIN_HEADER_DEFAULT_VALUE = "X-Forwarded-Login";
 
-  private static final String NAME_HEADER_PARAM = "sonar.sso.nameHeader";
+  private static final String NAME_HEADER_PARAM = "sonar.web.sso.nameHeader";
   private static final String NAME_HEADER_DEFAULT_VALUE = "X-Forwarded-Name";
 
-  private static final String EMAIL_HEADER_PARAM = "sonar.sso.emailHeader";
+  private static final String EMAIL_HEADER_PARAM = "sonar.web.sso.emailHeader";
   private static final String EMAIL_HEADER_DEFAULT_VALUE = "X-Forwarded-Email";
 
-  private static final String GROUPS_HEADER_PARAM = "sonar.sso.groupsHeader";
+  private static final String GROUPS_HEADER_PARAM = "sonar.web.sso.groupsHeader";
   private static final String GROUPS_HEADER_DEFAULT_VALUE = "X-Forwarded-Groups";
 
-  private static final String REFRESH_INTERVAL_PARAM = "sonar.sso.refreshIntervalInMinutes";
+  private static final String REFRESH_INTERVAL_PARAM = "sonar.web.sso.refreshIntervalInMinutes";
   private static final String REFRESH_INTERVAL_DEFAULT_VALUE = "5";
 
   private static final String LAST_REFRESH_TIME_TOKEN_PARAM = "ssoLastRefreshTime";
index 7e7ae6ec728d1d16664b96d5d99702cf98e3b3b3..9ed6449b1dbc59b5c3dce69db750a495b379ba9c 100644 (file)
@@ -227,7 +227,7 @@ public class SsoAuthenticatorTest {
 
   @Test
   public void use_refresh_time_from_settings() throws Exception {
-    settings.setProperty("sonar.sso.refreshIntervalInMinutes", "10");
+    settings.setProperty("sonar.web.sso.refreshIntervalInMinutes", "10");
     startWithSso();
     UserDto user = insertUser(DEFAULT_USER, group1);
     // Refresh time was updated 6 minutes ago => less than 10 minutes ago so not updated
@@ -256,10 +256,10 @@ public class SsoAuthenticatorTest {
 
   @Test
   public void use_headers_from_settings() throws Exception {
-    settings.setProperty("sonar.sso.loginHeader", "head-login");
-    settings.setProperty("sonar.sso.nameHeader", "head-name");
-    settings.setProperty("sonar.sso.emailHeader", "head-email");
-    settings.setProperty("sonar.sso.groupsHeader", "head-groups");
+    settings.setProperty("sonar.web.sso.loginHeader", "head-login");
+    settings.setProperty("sonar.web.sso.nameHeader", "head-name");
+    settings.setProperty("sonar.web.sso.emailHeader", "head-email");
+    settings.setProperty("sonar.web.sso.groupsHeader", "head-groups");
     startWithSso();
     setNotUserInToken();
     HttpServletRequest request = createRequest(ImmutableMap.of("head-login", DEFAULT_LOGIN, "head-name", DEFAULT_NAME, "head-email", DEFAULT_EMAIL, "head-groups", GROUPS));
@@ -271,10 +271,10 @@ public class SsoAuthenticatorTest {
 
   @Test
   public void detect_group_header_even_with_wrong_case() throws Exception {
-    settings.setProperty("sonar.sso.loginHeader", "login");
-    settings.setProperty("sonar.sso.nameHeader", "name");
-    settings.setProperty("sonar.sso.emailHeader", "email");
-    settings.setProperty("sonar.sso.groupsHeader", "Groups");
+    settings.setProperty("sonar.web.sso.loginHeader", "login");
+    settings.setProperty("sonar.web.sso.nameHeader", "name");
+    settings.setProperty("sonar.web.sso.emailHeader", "email");
+    settings.setProperty("sonar.web.sso.groupsHeader", "Groups");
     startWithSso();
     setNotUserInToken();
     HttpServletRequest request = createRequest(ImmutableMap.of("login", DEFAULT_LOGIN, "name", DEFAULT_NAME, "email", DEFAULT_EMAIL, "groups", GROUPS));
@@ -327,12 +327,12 @@ public class SsoAuthenticatorTest {
   }
 
   private void startWithSso() {
-    settings.setProperty("sonar.sso.enable", true);
+    settings.setProperty("sonar.web.sso.enable", true);
     underTest.start();
   }
 
   private void startWithoutSso() {
-    settings.setProperty("sonar.sso.enable", false);
+    settings.setProperty("sonar.web.sso.enable", false);
     underTest.start();
   }
 
index 64c88b496e64e75663d7c8e7089de40b52cf27c8..2ad69eff9b05487a14c164af890bb9b426853154 100644 (file)
 # and cannot be greater than 3 months. Value must be strictly positive.
 #sonar.web.sessionTimeoutInMinutes=4320
 
+
+#--------------------------------------------------------------------------------------------------
+# SSO AUTHENTICATION
+
+# Enable authentication using HTTP headers
+#sonar.web.sso.enable=false
+
+# Name of the header to get the user login.
+# Only alphanumeric, '.' and '@' characters are allowed
+#sonar.web.sso.loginHeader=X-Forwarded-Login
+
+# Name of the header to get the user name
+#sonar.web.sso.nameHeader=X-Forwarded-Name
+
+# Name of the header to get the user email (optional)
+#sonar.web.sso.emailHeader=X-Forwarded-Email
+
+# Name of the header to get the list of user groups, separated by comma (optional).
+# If the sonar.sso.groupsHeader is set, the user will belong to those groups if groups exist in SonarQube.
+# If none of the provided groups exists in SonarQube, the user won't belong to any group.
+# Note that the default group will NOT be automatically added when using SSO, it should be provided in the groups list, if needed.
+#sonar.web.sso.groupsHeader=X-Forwarded-Groups
+
+# Interval used to know when to refresh name, email and groups.
+# During this interval, if for instance the name of the user is changed in the header, it will only be updated after X minutes.
+#sonar.web.sso.refreshIntervalInMinutes=5
+
+
 #--------------------------------------------------------------------------------------------------
 # COMPUTE ENGINE
 # The Compute Engine is responsible for processing background tasks.
 # Default value (which was "combined" before version 6.2) is equivalent to "combined + SQ HTTP request ID":
 #sonar.web.accessLogs.pattern=%h %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}" "%reqAttribute{ID}"
 
-#--------------------------------------------------------------------------------------------------
-# AUTHENTICATION
-
-# Enable authentication using HTTP headers
-#sonar.sso.enable=false
-
-# Name of the header to get the user login.
-# Only alphanumeric, '.' and '@' characters are allowed
-#sonar.sso.loginHeader=X-Forwarded-Login
-
-# Name of the header to get the user name
-#sonar.sso.nameHeader=X-Forwarded-Name
-
-# Name of the header to get the user email (optional)
-#sonar.sso.emailHeader=X-Forwarded-Email
-
-# Name of the header to get the list of user groups, separated by comma (optional).
-# If the sonar.sso.groupsHeader is set, the user will belong to those groups if groups exist in SonarQube.
-# If none of the provided groups exists in SonarQube, the user won't belong to any group.
-# Note that the default group will NOT be automatically added when using SSO, it should be provided in the groups list, if needed.
-#sonar.sso.groupsHeader=X-Forwarded-Groups
-
-# Interval used to know when to refresh name, email and groups.
-# During this interval, if for instance the name of the user is changed in the header, it will only be updated after X minutes.
-#sonar.sso.refreshIntervalInMinutes=5
-
 
 #--------------------------------------------------------------------------------------------------
 # OTHERS