diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-11-28 16:25:50 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-11-28 16:25:50 +0100 |
commit | aa13239ecdc00c6d3322c5134e7266cd66e91a1b (patch) | |
tree | b78db0405ad885f91387d860e9ba5a7783bfaf4a | |
parent | 8578fb03dc34d704b2cb2b361f55b3d472d40d87 (diff) | |
download | sonarqube-aa13239ecdc00c6d3322c5134e7266cd66e91a1b.tar.gz sonarqube-aa13239ecdc00c6d3322c5134e7266cd66e91a1b.zip |
SONAR-5430 Update SSO properties in order to start with "sonar.web.sso"
4 files changed, 50 insertions, 48 deletions
diff --git a/it/it-tests/src/test/java/it/user/SsoAuthenticationTest.java b/it/it-tests/src/test/java/it/user/SsoAuthenticationTest.java index 76543eb289e..df84677bae2 100644 --- a/it/it-tests/src/test/java/it/user/SsoAuthenticationTest.java +++ b/it/it-tests/src/test/java/it/user/SsoAuthenticationTest.java @@ -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 diff --git a/server/sonar-server/src/main/java/org/sonar/server/authentication/SsoAuthenticator.java b/server/sonar-server/src/main/java/org/sonar/server/authentication/SsoAuthenticator.java index 3eafed1f6da..a1d3608fc78 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/authentication/SsoAuthenticator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/authentication/SsoAuthenticator.java @@ -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"; diff --git a/server/sonar-server/src/test/java/org/sonar/server/authentication/SsoAuthenticatorTest.java b/server/sonar-server/src/test/java/org/sonar/server/authentication/SsoAuthenticatorTest.java index 7e7ae6ec728..9ed6449b1db 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/authentication/SsoAuthenticatorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/authentication/SsoAuthenticatorTest.java @@ -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(); } diff --git a/sonar-application/src/main/assembly/conf/sonar.properties b/sonar-application/src/main/assembly/conf/sonar.properties index 64c88b496e6..2ad69eff9b0 100644 --- a/sonar-application/src/main/assembly/conf/sonar.properties +++ b/sonar-application/src/main/assembly/conf/sonar.properties @@ -136,6 +136,34 @@ # 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. @@ -298,32 +326,6 @@ # 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 |