@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
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";
@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
@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));
@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));
}
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();
}
# 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