diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ContainerAssume.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ContainerAssume.java index 6925943378..99ababd699 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ContainerAssume.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ContainerAssume.java @@ -21,6 +21,8 @@ import org.jboss.logging.Logger; import org.junit.Assume; import org.keycloak.testsuite.arquillian.AuthServerTestEnricher; +import static org.keycloak.testsuite.arquillian.AuthServerTestEnricher.AUTH_SERVER_SSL_REQUIRED; + public class ContainerAssume { private static final Logger log = Logger.getLogger(ContainerAssume.class); @@ -45,4 +47,8 @@ public class ContainerAssume { String.format("Ignoring test since %s is set to false", AuthServerTestEnricher.AUTH_SERVER_CLUSTER_PROPERTY), AuthServerTestEnricher.AUTH_SERVER_CLUSTER); } + + public static void assumeAuthServerSSL() { + Assume.assumeTrue("Only works with the SSL configured", AUTH_SERVER_SSL_REQUIRED); + } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SAMLSameSiteTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SAMLSameSiteTest.java index dec2590a4c..3df190c9c2 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SAMLSameSiteTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SAMLSameSiteTest.java @@ -3,6 +3,7 @@ package org.keycloak.testsuite.adapter.servlet; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.graphene.page.Page; import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.BeforeClass; import org.junit.Test; import org.keycloak.adapters.rotation.PublicKeyLocator; import org.keycloak.testsuite.adapter.filter.AdapterActionsFilter; @@ -11,6 +12,7 @@ import org.keycloak.testsuite.adapter.page.EmployeeSigServlet; import org.keycloak.testsuite.arquillian.annotation.AppServerContainer; import org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude; import org.keycloak.testsuite.updaters.ClientAttributeUpdater; +import org.keycloak.testsuite.util.ContainerAssume; import org.keycloak.testsuite.utils.arquillian.ContainerConstants; import org.openqa.selenium.By; @@ -51,6 +53,11 @@ public class SAMLSameSiteTest extends AbstractSAMLServletAdapterTest { @Page protected Employee2Servlet employee2ServletPage; + @BeforeClass + public static void enabledOnlyWithSSL() { + ContainerAssume.assumeAuthServerSSL(); + } + @Test public void samlWorksWithSameSiteCookieTest() throws URISyntaxException { getCleanup(SAMLSERVLETDEMO).addCleanup(ClientAttributeUpdater.forClient(adminClient, SAMLSERVLETDEMO, SAML_CLIENT_ID_EMPLOYEE_2) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookieTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookieTest.java index 48c875ec1c..62648e8471 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookieTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookieTest.java @@ -26,11 +26,13 @@ import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import org.apache.http.util.EntityUtils; import org.jboss.arquillian.graphene.page.Page; +import org.junit.BeforeClass; import org.junit.Test; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.testsuite.AbstractKeycloakTest; import org.keycloak.testsuite.auth.page.AuthRealm; import org.keycloak.testsuite.pages.LoginPage; +import org.keycloak.testsuite.util.ContainerAssume; import org.keycloak.testsuite.util.OAuthClient; import org.keycloak.testsuite.util.OAuthClient.AuthorizationEndpointResponse; import org.keycloak.testsuite.util.RealmBuilder; @@ -161,6 +163,8 @@ public class CookieTest extends AbstractKeycloakTest { @Test public void legacyCookiesTest() { + ContainerAssume.assumeAuthServerSSL(); + accountPage.navigateTo(); assertCurrentUrlStartsWithLoginUrlOf(accountPage); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookiesPathTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookiesPathTest.java index ad88094c04..08fc801c22 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookiesPathTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookiesPathTest.java @@ -26,6 +26,7 @@ import org.keycloak.services.managers.AuthenticationSessionManager; import org.keycloak.testsuite.AbstractKeycloakTest; import org.keycloak.testsuite.ActionURIUtils; import org.keycloak.testsuite.pages.LoginPage; +import org.keycloak.testsuite.util.ContainerAssume; import org.keycloak.testsuite.util.OAuthClient; import org.keycloak.testsuite.util.RealmBuilder; import org.keycloak.testsuite.util.URLUtils; @@ -154,6 +155,8 @@ public class CookiesPathTest extends AbstractKeycloakTest { @Test public void testOldCookieWithWrongPath() { + ContainerAssume.assumeAuthServerSSL(); + Cookie wrongCookie = new Cookie(AuthenticationSessionManager.AUTH_SESSION_ID, AUTH_SESSION_VALUE, null, OLD_COOKIE_PATH, null, false, true); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LoginTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LoginTest.java index 09fc04789b..f0cb1b79da 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LoginTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LoginTest.java @@ -51,6 +51,7 @@ import org.keycloak.testsuite.pages.ErrorPage; import org.keycloak.testsuite.pages.LoginPage; import org.keycloak.testsuite.pages.LoginPasswordUpdatePage; import org.keycloak.testsuite.updaters.RealmAttributeUpdater; +import org.keycloak.testsuite.util.ContainerAssume; import org.keycloak.testsuite.util.DroneUtils; import org.keycloak.testsuite.util.JavascriptBrowser; import org.keycloak.testsuite.util.OAuthClient; @@ -416,6 +417,8 @@ public class LoginTest extends AbstractTestRealmKeycloakTest { @Test public void loginSuccessRealmSigningAlgorithms() throws JWSInputException { + ContainerAssume.assumeAuthServerSSL(); + loginPage.open(); loginPage.login("login-test", "password"); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/AbstractJavascriptTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/AbstractJavascriptTest.java index c7430f94c2..6ae2ab7de2 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/AbstractJavascriptTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/AbstractJavascriptTest.java @@ -3,6 +3,7 @@ package org.keycloak.testsuite.javascript; import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.graphene.page.Page; import org.junit.Before; +import org.junit.BeforeClass; import org.keycloak.admin.client.resource.ClientResource; import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.RealmRepresentation; @@ -13,6 +14,7 @@ import org.keycloak.testsuite.Assert; import org.keycloak.testsuite.admin.ApiUtil; import org.keycloak.testsuite.auth.page.login.OIDCLogin; import org.keycloak.testsuite.util.ClientBuilder; +import org.keycloak.testsuite.util.ContainerAssume; import org.keycloak.testsuite.util.JavascriptBrowser; import org.keycloak.testsuite.util.RealmBuilder; import org.keycloak.testsuite.util.RolesBuilder; @@ -82,6 +84,10 @@ public abstract class AbstractJavascriptTest extends AbstractAuthTest { unauthorizedUser = UserBuilder.create().username("unauthorized").password("password").build(); } + @BeforeClass + public static void enabledOnlyWithSSL() { + ContainerAssume.assumeAuthServerSSL(); + } @Before public void beforeJavascriptTest() {