diff options
author | Klaudio Sinani <klaudio.sinani@sonarsource.com> | 2022-11-26 15:16:54 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-12-08 20:02:58 +0000 |
commit | 9af91426d840ca8189c18beff033e0413fcd23ab (patch) | |
tree | 9106b1535fcfbe7f16bc395da0168f4dede271c7 /server/sonar-webserver-webapi | |
parent | 77e8af2605811bf1d13532585ec18ecb602970a5 (diff) | |
download | sonarqube-9af91426d840ca8189c18beff033e0413fcd23ab.tar.gz sonarqube-9af91426d840ca8189c18beff033e0413fcd23ab.zip |
SONAR-17645 Enable SCIM feature toggling mechanism
Diffstat (limited to 'server/sonar-webserver-webapi')
-rw-r--r-- | server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/ValidationAction.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/ValidationAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/ValidationAction.java index 3b1c5e37a86..2aa1777fc40 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/ValidationAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/ValidationAction.java @@ -21,6 +21,8 @@ package org.sonar.server.saml.ws; import java.io.IOException; +import java.util.Arrays; +import java.util.stream.Collectors; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; @@ -40,9 +42,12 @@ import org.sonar.server.authentication.event.AuthenticationException; import org.sonar.server.user.ThreadLocalUserSession; import org.sonar.server.ws.ServletFilterHandler; +import static org.sonar.server.saml.ws.SamlValidationWs.SAML_VALIDATION_CONTROLLER; + public class ValidationAction extends ServletFilter implements SamlAction { static final String VALIDATION_CALLBACK_KEY = SamlValidationRedirectionFilter.SAML_VALIDATION_KEY; + private static final String URL_DELIMITER = "/"; private final ThreadLocalUserSession userSession; private final SamlAuthenticator samlAuthenticator; private final OAuth2ContextFactory oAuth2ContextFactory; @@ -60,7 +65,7 @@ public class ValidationAction extends ServletFilter implements SamlAction { @Override public UrlPattern doGetPattern() { - return UrlPattern.create("/" + SamlValidationWs.SAML_VALIDATION_CONTROLLER + "/" + VALIDATION_CALLBACK_KEY); + return UrlPattern.create(composeUrlPattern(SAML_VALIDATION_CONTROLLER, VALIDATION_CALLBACK_KEY)); } @Override @@ -105,4 +110,11 @@ public class ValidationAction extends ServletFilter implements SamlAction { .setDescription("SAML assertion value") .setRequired(true); } + + private static String composeUrlPattern(String... parameters) { + return Arrays + .stream(parameters) + .map(URL_DELIMITER::concat) + .collect(Collectors.joining()); + } } |