KEYCLOAK-2990: added test for single logout to broker testing (new testsuite)
This commit is contained in:
parent
18a64103cd
commit
9e857fe245
2 changed files with 29 additions and 2 deletions
|
@ -15,7 +15,6 @@ import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.pages.UpdateAccountInformationPage;
|
import org.keycloak.testsuite.pages.UpdateAccountInformationPage;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static org.keycloak.testsuite.admin.ApiUtil.createUserWithAdminClient;
|
import static org.keycloak.testsuite.admin.ApiUtil.createUserWithAdminClient;
|
||||||
import static org.keycloak.testsuite.admin.ApiUtil.resetUserPassword;
|
import static org.keycloak.testsuite.admin.ApiUtil.resetUserPassword;
|
||||||
|
@ -115,7 +114,7 @@ public abstract class AbstractBrokerTest extends AbstractKeycloakTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void tryToLogInAsUserInIDP() {
|
public void logInAsUserInIDP() {
|
||||||
driver.navigate().to(getAuthRoot() + "/auth/realms/" + consumerRealmName() + "/account");
|
driver.navigate().to(getAuthRoot() + "/auth/realms/" + consumerRealmName() + "/account");
|
||||||
|
|
||||||
log.debug("Clicking social " + getIDPAlias());
|
log.debug("Clicking social " + getIDPAlias());
|
||||||
|
@ -151,5 +150,30 @@ public abstract class AbstractBrokerTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
Assert.assertTrue("There must be user " + getUserLogin() + " in realm " + consumerRealmName(),
|
Assert.assertTrue("There must be user " + getUserLogin() + " in realm " + consumerRealmName(),
|
||||||
isUserFound);
|
isUserFound);
|
||||||
|
|
||||||
|
testSingleLogout();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void testSingleLogout() {
|
||||||
|
log.debug("Testing single log out");
|
||||||
|
|
||||||
|
driver.navigate().to(getAuthRoot() + "/auth/realms/" + providerRealmName() + "/account");
|
||||||
|
|
||||||
|
Assert.assertTrue("Should be logged in the account page", driver.getTitle().endsWith("Account Management"));
|
||||||
|
|
||||||
|
driver.navigate().to(getAuthRoot()
|
||||||
|
+ "/auth/realms/" + providerRealmName()
|
||||||
|
+ "/protocol/" + "openid-connect"
|
||||||
|
+ "/logout");
|
||||||
|
|
||||||
|
driver.navigate().to(getAuthRoot() + "/auth/realms/" + providerRealmName() + "/account");
|
||||||
|
|
||||||
|
Assert.assertTrue("Should be on login page", driver.getTitle().startsWith("Log in to"));
|
||||||
|
Assert.assertTrue("Should be on " + providerRealmName() + " realm", driver.getCurrentUrl().contains("/auth/realms/" + providerRealmName()));
|
||||||
|
|
||||||
|
driver.navigate().to(getAuthRoot() + "/auth/realms/" + consumerRealmName() + "/account");
|
||||||
|
|
||||||
|
Assert.assertTrue("Should be on login page", driver.getTitle().startsWith("Log in to"));
|
||||||
|
Assert.assertTrue("Should be on " + consumerRealmName() + " realm", driver.getCurrentUrl().contains("/auth/realms/" + consumerRealmName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,9 @@ public class KcOidcBrokerTest extends AbstractBrokerTest {
|
||||||
client.setRedirectUris(Collections.singletonList(getAuthRoot() +
|
client.setRedirectUris(Collections.singletonList(getAuthRoot() +
|
||||||
"/auth/realms/" + REALM_CONS_NAME + "/broker/" + IDP_OIDC_ALIAS + "/endpoint/*"));
|
"/auth/realms/" + REALM_CONS_NAME + "/broker/" + IDP_OIDC_ALIAS + "/endpoint/*"));
|
||||||
|
|
||||||
|
client.setAdminUrl(getAuthRoot() +
|
||||||
|
"/auth/realms/" + REALM_CONS_NAME + "/broker/" + IDP_OIDC_ALIAS + "/endpoint");
|
||||||
|
|
||||||
return Collections.singletonList(client);
|
return Collections.singletonList(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue