aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-auth
diff options
context:
space:
mode:
authorSteve Marion <steve.marion@sonarsource.com>2022-09-14 09:09:50 +0200
committersonartech <sonartech@sonarsource.com>2022-09-15 20:03:03 +0000
commit37226c00747bddecc291f56ec1b208984527931a (patch)
tree7063db8cff8f4b4b88708daa6de02453b0063ca1 /server/sonar-webserver-auth
parent492c498c7400666923316b7df3bf9befa0183398 (diff)
downloadsonarqube-37226c00747bddecc291f56ec1b208984527931a.tar.gz
sonarqube-37226c00747bddecc291f56ec1b208984527931a.zip
SONAR-17296 action for generating SAML request
Create action for generating SAML request with test purpose relay-state.
Diffstat (limited to 'server/sonar-webserver-auth')
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java
index b2750c95ece..66f2797b226 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java
@@ -25,6 +25,7 @@ import java.util.Set;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.jetbrains.annotations.NotNull;
import org.sonar.api.platform.Server;
import org.sonar.api.server.ServerSide;
import org.sonar.api.server.authentication.OAuth2IdentityProvider;
@@ -67,6 +68,11 @@ public class OAuth2ContextFactory {
return new OAuthContextImpl(request, response, identityProvider);
}
+ @NotNull
+ public String generateCallbackUrl(String identityProviderKey) {
+ return server.getPublicRootUrl() + CALLBACK_PATH + identityProviderKey;
+ }
+
public class OAuthContextImpl implements OAuth2IdentityProvider.InitContext, OAuth2CallbackContext {
private final HttpServletRequest request;
@@ -81,7 +87,7 @@ public class OAuth2ContextFactory {
@Override
public String getCallbackUrl() {
- return server.getPublicRootUrl() + CALLBACK_PATH + identityProvider.getKey();
+ return generateCallbackUrl(identityProvider.getKey());
}
@Override