use of org.keycloak.testsuite.util.javascript.JSObjectBuilder in project keycloak by keycloak.
the class JavascriptAdapterTest method equalsSignInRedirectUrl.
@Test
public void equalsSignInRedirectUrl() {
testAppUrl = authServerContextRootPage.toString().replace(AUTH_SERVER_HOST, JS_APP_HOST) + 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"));
assertInitAuth(driver1, output1, events2);
});
}
use of org.keycloak.testsuite.util.javascript.JSObjectBuilder in project keycloak by keycloak.
the class JavascriptAdapterTest method testSilentCheckSsoNotAuthenticated.
@Test
public void testSilentCheckSsoNotAuthenticated() {
JSObjectBuilder checkSSO = defaultArguments().checkSSOOnLoad().add("checkLoginIframe", false).add("silentCheckSsoRedirectUri", authServerContextRootPage.toString().replace(AUTH_SERVER_HOST, JS_APP_HOST) + JAVASCRIPT_URL + "/silent-check-sso.html");
testExecutor.init(checkSSO, this::assertInitNotAuth, SuiteContext.BROWSER_STRICT_COOKIES);
}
use of org.keycloak.testsuite.util.javascript.JSObjectBuilder in project keycloak by keycloak.
the class JavascriptAdapterTest method testSilentCheckSsoWithFallbackDisabled.
@Test
public void testSilentCheckSsoWithFallbackDisabled() {
JSObjectBuilder checkSSO = defaultArguments().checkSSOOnLoad().disableSilentCheckSSOFallback().add("silentCheckSsoRedirectUri", authServerContextRootPage.toString().replace(AUTH_SERVER_HOST, JS_APP_HOST) + JAVASCRIPT_URL + "/silent-check-sso.html");
testExecutor.init(checkSSO, this::assertInitNotAuth).login(this::assertOnLoginPage).loginForm(testUser, this::assertOnTestAppUrl).init(checkSSO, this::assertInitAuth).refresh().init(checkSSO, // with the fall back disabled, the adapter won't do full redirect to KC
SuiteContext.BROWSER_STRICT_COOKIES ? this::assertInitNotAuth : this::assertInitAuth);
}
use of org.keycloak.testsuite.util.javascript.JSObjectBuilder in project keycloak by keycloak.
the class JavascriptAdapterTest method testCheckSso.
@Test
public void testCheckSso() {
JSObjectBuilder checkSSO = defaultArguments().checkSSOOnLoad();
// when 3rd party cookies are disabled, the adapter has to do a full redirect to KC to check whether the user
// is logged in or not – it can't rely on the login iframe
testExecutor.init(checkSSO, this::assertInitNotAuth, SuiteContext.BROWSER_STRICT_COOKIES).login(this::assertOnLoginPage).loginForm(testUser, this::assertOnTestAppUrl).init(checkSSO, this::assertInitAuth, false).refresh().init(checkSSO, this::assertInitAuth, true);
}
use of org.keycloak.testsuite.util.javascript.JSObjectBuilder in project keycloak by keycloak.
the class JavascriptAdapterTest method testScopeInLoginOptionsShouldBeConsideredByLoginUrl.
/**
* Test for scope handling via {@code loginOptions}: <pre>{@code
* Keycloak keycloak = new Keycloak(); keycloak.login({.... scope: "profile email phone"})
* }</pre>
* See KEYCLOAK-14412
*/
@Test
public void testScopeInLoginOptionsShouldBeConsideredByLoginUrl() {
testExecutor.configure().init(defaultArguments());
JSObjectBuilder loginOptions = JSObjectBuilder.create().add("scope", "profile email phone");
testExecutor.login(loginOptions, (JavascriptStateValidator) (driver, output, events) -> {
assertThat(driver.getCurrentUrl(), containsString("&scope=openid%20profile%20email%20phone"));
});
}
Aggregations