diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/CustomerPortalSubsystem.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/CustomerPortalSubsystem.java new file mode 100644 index 0000000000..57384daeab --- /dev/null +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/CustomerPortalSubsystem.java @@ -0,0 +1,43 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.testsuite.adapter.page; + +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.keycloak.testsuite.page.AbstractPageWithInjectedUrl; + +import java.net.URL; + +/** + * + * @author tkyjovsk + */ +public class CustomerPortalSubsystem extends AbstractPageWithInjectedUrl { + + public static final String DEPLOYMENT_NAME = "customer-portal-subsystem"; + + @ArquillianResource + @OperateOnDeployment(DEPLOYMENT_NAME) + private URL url; + + @Override + public URL getInjectedUrl() { + return url; + } + +} diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractServletsAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractServletsAdapterTest.java index a3badef973..a2d0355e5c 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractServletsAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractServletsAdapterTest.java @@ -45,7 +45,6 @@ public abstract class AbstractServletsAdapterTest extends AbstractAdapterTest { WebArchive deployment = ShrinkWrap.create(WebArchive.class, name + ".war") .addClasses(servletClasses) .addAsWebInfResource(webXML, "web.xml") - .addAsWebInfResource(keycloakJSON, "keycloak.json") .addAsWebInfResource(jbossDeploymentStructure, JBOSS_DEPLOYMENT_STRUCTURE_XML); URL keystore = AbstractServletsAdapterTest.class.getResource(webInfPath + "keystore.jks"); @@ -53,6 +52,10 @@ public abstract class AbstractServletsAdapterTest extends AbstractAdapterTest { deployment.addAsWebInfResource(keystore, "classes/keystore.jks"); } + if (keycloakJSON != null) { + deployment.addAsWebInfResource(keycloakJSON, "keycloak.json"); + } + addContextXml(deployment, name); return deployment; diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractDemoServletsAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractDemoServletsAdapterTest.java index ab7b1f5dc5..c754cd3cbc 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractDemoServletsAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractDemoServletsAdapterTest.java @@ -59,6 +59,8 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd @Page private CustomerPortal customerPortal; @Page + private CustomerPortalSubsystem customerPortalSubsystem; + @Page private SecurePortal securePortal; @Page private CustomerDb customerDb; @@ -74,6 +76,11 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd return servletDeployment(CustomerPortal.DEPLOYMENT_NAME, CustomerServlet.class, ErrorServlet.class); } + @Deployment(name = CustomerPortalSubsystem.DEPLOYMENT_NAME) + protected static WebArchive customerPortalSubsystem() { + return servletDeployment(CustomerPortalSubsystem.DEPLOYMENT_NAME, CustomerServlet.class, ErrorServlet.class); + } + @Deployment(name = SecurePortal.DEPLOYMENT_NAME) protected static WebArchive securePortal() { return servletDeployment(SecurePortal.DEPLOYMENT_NAME, CallAuthenticatedServlet.class); @@ -99,6 +106,14 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd return servletDeployment(InputPortal.DEPLOYMENT_NAME, "keycloak.json", InputServlet.class); } + @Test + public void testCustomerPortalWithSubsystemSettings() { + customerPortalSubsystem.navigateTo(); + assertCurrentUrlStartsWithLoginUrlOf(testRealmPage); + testRealmLoginPage.form().login("bburke@redhat.com", "password"); + assertTrue(driver.getPageSource().contains("Bill Burke") && driver.getPageSource().contains("Stian Thorgersen")); + } + @Test public void testSavedPostRequest() throws InterruptedException { // test login to customer-portal which does a bearer request to customer-db diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/customer-portal-subsystem/META-INF/context.xml b/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/customer-portal-subsystem/META-INF/context.xml new file mode 100644 index 0000000000..ed36f5613a --- /dev/null +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/customer-portal-subsystem/META-INF/context.xml @@ -0,0 +1,20 @@ + + + + + \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/customer-portal-subsystem/WEB-INF/jetty-web.xml b/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/customer-portal-subsystem/WEB-INF/jetty-web.xml new file mode 100644 index 0000000000..8c59313878 --- /dev/null +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/customer-portal-subsystem/WEB-INF/jetty-web.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/customer-portal-subsystem/WEB-INF/web.xml b/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/customer-portal-subsystem/WEB-INF/web.xml new file mode 100644 index 0000000000..280c9e96f0 --- /dev/null +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/customer-portal-subsystem/WEB-INF/web.xml @@ -0,0 +1,76 @@ + + + + + + customer-portal-subsystem + + + Servlet + org.keycloak.testsuite.adapter.servlet.CustomerServlet + + + Error Servlet + org.keycloak.testsuite.adapter.servlet.ErrorServlet + + + + Servlet + /* + + + + Error Servlet + /error.html + + + + + Users + /* + + + user + + + + + Errors + /error.html + + + + + KEYCLOAK + demo + + /error.html + /error.html + + + + + admin + + + user + + diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/demorealm.json b/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/demorealm.json index fbe54ceb30..79d050a76f 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/demorealm.json +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/demorealm.json @@ -127,6 +127,16 @@ ], "secret": "password" }, + { + "clientId": "customer-portal-subsystem", + "enabled": true, + "adminUrl": "/customer-portal-subsystem", + "baseUrl": "/customer-portal-subsystem", + "redirectUris": [ + "/customer-portal-subsystem/*" + ], + "secret": "password" + }, { "clientId": "customer-cookie-portal", "enabled": true, diff --git a/testsuite/integration-arquillian/tests/other/adapters/jboss/common/xslt/keycloak-subsystem.xsl b/testsuite/integration-arquillian/tests/other/adapters/jboss/common/xslt/keycloak-subsystem.xsl new file mode 100644 index 0000000000..bb776134c2 --- /dev/null +++ b/testsuite/integration-arquillian/tests/other/adapters/jboss/common/xslt/keycloak-subsystem.xsl @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + demo + MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB + http://localhost:/auth + EXTERNAL + customer-portal-subsystem + password + + + + + + + + + + + \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/other/adapters/jboss/pom.xml b/testsuite/integration-arquillian/tests/other/adapters/jboss/pom.xml index f06e57873b..42780cf1e1 100644 --- a/testsuite/integration-arquillian/tests/other/adapters/jboss/pom.xml +++ b/testsuite/integration-arquillian/tests/other/adapters/jboss/pom.xml @@ -37,6 +37,42 @@ ${project.parent.basedir}/common ${app.server.home}/modules/system/add-ons/keycloak + + + + + org.codehaus.mojo + xml-maven-plugin + + + Configure keycloak subsystem + process-test-resources + + transform + + + + + ${app.server.home}/standalone/configuration + + standalone.xml + + ${common.resources}/xslt/keycloak-subsystem.xsl + ${app.server.home}/standalone/configuration + + + auth-server-port + ${auth.server.http.port} + + + + + + + + + +