diff --git a/adapters/oidc/js/src/main/resources/keycloak.js b/adapters/oidc/js/src/main/resources/keycloak.js index a268e7cb0c..74a9d8288c 100755 --- a/adapters/oidc/js/src/main/resources/keycloak.js +++ b/adapters/oidc/js/src/main/resources/keycloak.js @@ -1103,9 +1103,10 @@ oauthParams: {} } for (var i = 0; i < p.length; i++) { - var t = p[i].split('='); - if (supportedParams.indexOf(t[0]) !== -1) { - result.oauthParams[t[0]] = t[1]; + var split = p[i].indexOf("="); + var key = p[i].slice(0, split); + if (supportedParams.indexOf(key) !== -1) { + result.oauthParams[key] = p[i].slice(split + 1); } else { if (result.paramsString !== '') { result.paramsString += '&'; diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/JavascriptAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/JavascriptAdapterTest.java index 7531898db9..612c8b0103 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/JavascriptAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/JavascriptAdapterTest.java @@ -474,6 +474,22 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest { }); } + @Test + public void equalsSignInRedirectUrl() { + testAppUrl = authServerContextRootPage.toString().replace("localhost", NIP_IO_URL) + JAVASCRIPT_URL + "/index.html?test=bla=bla&super=man"; + jsDriver.navigate().to(testAppUrl); + + JSObjectBuilder arguments = defaultArguments(); + + testExecutor.init(arguments, this::assertInitNotAuth) + .login(this::assertOnLoginPage) + .loginForm(testUser, this::assertOnTestAppUrl) + .init(arguments, (driver1, output1, events2) -> { + assertTrue(driver1.getCurrentUrl().contains("bla=bla")); + assertSuccessfullyLoggedIn(driver1, output1, events2); + }); + } + @Test public void spaceInRealmNameTest() { // Unfortunately this test doesn't work on phantomjs