diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/KerberosRule.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/KerberosRule.java index 11bfe180ca..223a387ccd 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/KerberosRule.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/KerberosRule.java @@ -73,4 +73,8 @@ public class KerberosRule extends LDAPRule { public boolean isCaseSensitiveLogin() { return ldapTestConfiguration.isCaseSensitiveLogin(); } + + public boolean isStartEmbeddedLdapServer() { + return ldapTestConfiguration.isStartEmbeddedLdapServer(); + } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/AbstractKerberosTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/AbstractKerberosTest.java index 42722da3c2..abda821e1d 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/AbstractKerberosTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/AbstractKerberosTest.java @@ -17,6 +17,9 @@ package org.keycloak.testsuite.federation.kerberos; +import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson; +import static org.keycloak.testsuite.admin.ApiUtil.findClientByClientId; + import java.net.URI; import java.security.Principal; import java.util.Hashtable; @@ -44,6 +47,7 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine; import org.junit.After; +import org.junit.Assume; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -75,8 +79,6 @@ import org.keycloak.testsuite.auth.page.AuthRealm; import org.keycloak.testsuite.pages.AccountPasswordPage; import org.keycloak.testsuite.pages.LoginPage; import org.keycloak.testsuite.util.OAuthClient; -import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson; -import static org.keycloak.testsuite.admin.ApiUtil.findClientByClientId; /** * @author Marek Posolda @@ -102,6 +104,8 @@ public abstract class AbstractKerberosTest extends AbstractAuthTest { protected abstract void setKrb5ConfPath(); + protected abstract boolean isStartEmbeddedLdapServer(); + @Override public void addTestRealms(List testRealms) { RealmRepresentation realmRep = loadJson(getClass().getResourceAsStream("/kerberos/kerberosrealm.json"), RealmRepresentation.class); @@ -256,7 +260,8 @@ public abstract class AbstractKerberosTest extends AbstractAuthTest { @Test public void credentialDelegationTest() throws Exception { - // Add kerberos delegation credential mapper + Assume.assumeTrue("Ignoring test as the embedded server is not started", isStartEmbeddedLdapServer()); + // Add kerberos delegation credential mapper ProtocolMapperModel protocolMapper = UserSessionNoteMapper.createClaimMapper(KerberosConstants.GSS_DELEGATION_CREDENTIAL_DISPLAY_NAME, KerberosConstants.GSS_DELEGATION_CREDENTIAL, KerberosConstants.GSS_DELEGATION_CREDENTIAL, "String", diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/KerberosLdapTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/KerberosLdapTest.java index 1a4f626ca7..5d5eb73d84 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/KerberosLdapTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/KerberosLdapTest.java @@ -75,6 +75,11 @@ public class KerberosLdapTest extends AbstractKerberosTest { protected boolean isCaseSensitiveLogin() { return kerberosRule.isCaseSensitiveLogin(); } + + @Override + protected boolean isStartEmbeddedLdapServer() { + return kerberosRule.isStartEmbeddedLdapServer(); + } @Override diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/KerberosStandaloneTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/KerberosStandaloneTest.java index 8cdb9bf699..65e5a3e52e 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/KerberosStandaloneTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/KerberosStandaloneTest.java @@ -78,6 +78,11 @@ public class KerberosStandaloneTest extends AbstractKerberosTest { protected boolean isCaseSensitiveLogin() { return kerberosRule.isCaseSensitiveLogin(); } + + @Override + protected boolean isStartEmbeddedLdapServer() { + return kerberosRule.isStartEmbeddedLdapServer(); + } @Override @@ -90,7 +95,7 @@ public class KerberosStandaloneTest extends AbstractKerberosTest { spnegoLoginTestImpl(); // Assert user was imported and hasn't any required action on him. Profile info is synced from LDAP - assertUser("hnelson", "hnelson@keycloak.org", null, null, false); + assertUser("hnelson", "hnelson@" + kerberosRule.getConfig().get(KerberosConstants.KERBEROS_REALM).toLowerCase(), null, null, false); } @@ -108,11 +113,11 @@ public class KerberosStandaloneTest extends AbstractKerberosTest { Assert.assertEquals(200, spnegoResponse.getStatus()); String responseText = spnegoResponse.readEntity(String.class); Assert.assertTrue(responseText.contains("You need to update your user profile to activate your account.")); - Assert.assertTrue(responseText.contains("hnelson@keycloak.org")); + Assert.assertTrue(responseText.contains("hnelson@" + kerberosRule.getConfig().get(KerberosConstants.KERBEROS_REALM).toLowerCase())); spnegoResponse.close(); // Assert user was imported and has required action on him - assertUser("hnelson", "hnelson@keycloak.org", null, null, true); + assertUser("hnelson", "hnelson@" + kerberosRule.getConfig().get(KerberosConstants.KERBEROS_REALM).toLowerCase(), null, null, true); // Switch updateProfileOnFirstLogin to off kerberosProvider.getConfig().putSingle(KerberosConstants.UPDATE_PROFILE_FIRST_LOGIN, "false");