KEYCLOAK-6745 Adapter tests - remove abstract adapter test classes

This commit is contained in:
vramik 2018-04-23 13:42:31 +02:00 committed by Pavel Drozd
parent 132386f64d
commit bb5dc4c473
144 changed files with 1158 additions and 1793 deletions

View file

@ -44,6 +44,8 @@
<!--component versions-->
<!--to update arquillian-core to 1.3.0.Final or higher see https://issues.jboss.org/browse/ARQ-2181 -->
<arquillian-core.version>1.2.1.Final</arquillian-core.version>
<!--the version of shrinkwrap_resolver should align with the version in arquillian-bom-->
<shrinkwrap-resolver.version>2.2.6</shrinkwrap-resolver.version>
<selenium.version>3.11.0</selenium.version>
<arquillian-drone.version>2.5.1</arquillian-drone.version>
<arquillian-graphene.version>2.3.2</arquillian-graphene.version>
@ -83,8 +85,10 @@
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>${shrinkwrap-resolver.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
@ -141,6 +145,11 @@
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
<version>0.3.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>

View file

@ -0,0 +1,28 @@
embed-server --server-config=standalone-ha.xml
/subsystem=jgroups/stack=tcpping:add
/subsystem=jgroups/stack=tcpping/transport=TCP:add(socket-binding=jgroups-tcp)
/subsystem=jgroups/stack=tcpping/protocol=TCPPING:add
/subsystem=jgroups/stack=tcpping/protocol=TCPPING/property=initial_hosts:add(value=localhost[${tcpping.port}])
/subsystem=jgroups/stack=tcpping/protocol=TCPPING/property=port_range:add(value=0)
/subsystem=jgroups/stack=tcpping/protocol=MERGE3:add
/subsystem=jgroups/stack=tcpping/protocol=FD_SOCK:add(socket-binding=jgroups-tcp-fd)
/subsystem=jgroups/stack=tcpping/protocol=FD:add
/subsystem=jgroups/stack=tcpping/protocol=VERIFY_SUSPECT:add
/subsystem=jgroups/stack=tcpping/protocol=pbcast.NAKACK2:add
/subsystem=jgroups/stack=tcpping/protocol=UNICAST3:add
/subsystem=jgroups/stack=tcpping/protocol=pbcast.STABLE:add
/subsystem=jgroups/stack=tcpping/protocol=pbcast.GMS:add
/subsystem=jgroups/stack=tcpping/protocol=MFC:add
/subsystem=jgroups/stack=tcpping/protocol=FRAG2:add
/subsystem=jgroups/channel=ee:write-attribute(name=stack,value=tcpping)
/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=cache-server:add(host=localhost,port=${cache.hotrod.port})
/subsystem=infinispan/cache-container=web/replicated-cache=employee-distributable-cache:add(statistics-enabled=true,mode=SYNC)
/subsystem=infinispan/cache-container=web/replicated-cache=employee-distributable-cache/component=locking:add(isolation=REPEATABLE_READ)
/subsystem=infinispan/cache-container=web/replicated-cache=employee-distributable-cache/component=transaction:add(mode=BATCH)
/subsystem=infinispan/cache-container=web/replicated-cache=employee-distributable-cache/store=remote:add(remote-servers=[cache-server],cache=employee-distributable-cache,passivation=false,purge=false,preload=false,shared=true)
/subsystem=infinispan/cache-container=web/replicated-cache=employee-distributable-cache.ssoCache:add(statistics-enabled=true,mode=SYNC)
/subsystem=infinispan/cache-container=web/replicated-cache=employee-distributable-cache.ssoCache/store=remote:add(remote-servers=[cache-server],cache=employee-distributable-cache.ssoCache,passivation=false,purge=false,preload=false,shared=true)

View file

@ -39,6 +39,8 @@
<app.server.oidc.adapter.artifactId>keycloak-eap6-adapter-dist</app.server.oidc.adapter.artifactId>
<app.server.saml.adapter.artifactId>keycloak-saml-eap6-adapter-dist</app.server.saml.adapter.artifactId>
<skip.apply.offline.cli>true</skip.apply.offline.cli>
</properties>
<build>

View file

@ -233,6 +233,7 @@
<goal>exec</goal>
</goals>
<configuration>
<skip>${skip.apply.offline.cli}</skip><!--eap6-->
<executable>./jboss-cli.${script.suffix}</executable>
<workingDirectory>${app.server.jboss.home}/bin</workingDirectory>
<arguments>
@ -247,6 +248,7 @@
<goal>exec</goal>
</goals>
<configuration>
<skip>${skip.apply.offline.cli}</skip><!--eap6-->
<executable>./jboss-cli.${script.suffix}</executable>
<workingDirectory>${app.server.jboss.home}/bin</workingDirectory>
<arguments>
@ -396,6 +398,7 @@
<goal>exec</goal>
</goals>
<configuration>
<skip>${skip.apply.offline.cli}</skip><!--eap6-->
<workingDirectory>${app.server.jboss.home}/bin</workingDirectory>
<executable>./jboss-cli.sh</executable>
<arguments>
@ -410,6 +413,7 @@
<goal>exec</goal>
</goals>
<configuration>
<skip>${skip.apply.offline.cli}</skip><!--eap6-->
<workingDirectory>${app.server.jboss.home}/bin</workingDirectory>
<executable>./jboss-cli.sh</executable>
<arguments>
@ -418,6 +422,22 @@
</arguments>
</configuration>
</execution>
<execution>
<id>configure-crossdc-config</id>
<phase>generate-test-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skip.apply.offline.cli}</skip><!--eap6-->
<workingDirectory>${app.server.jboss.home}/bin</workingDirectory>
<executable>./jboss-cli.sh</executable>
<arguments>
<argument>--file=${common.resources}/cli/configure-crossdc-config.cli</argument>
<argument>-Djboss.server.config.dir=${app.server.jboss.home}/standalone-crossdc/configuration</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

View file

@ -46,7 +46,7 @@ public class CustomerDatabaseServlet extends HttpServlet {
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.logout();
PrintWriter pw = resp.getWriter();
pw.println("servlet logout from database ok");
pw.println("<div id=\"customer_database_logout\">servlet logout from database ok</div>");
pw.flush();
}
}

View file

@ -47,8 +47,10 @@ public class CustomerServlet extends HttpServlet {
KeycloakSecurityContext context = (KeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName());
if (req.getRequestURI().endsWith("logout")) {
resp.setStatus(200);
pw.println("servlet logout ok");
pw.println("<html><body>");
pw.println("<div id=\"customer_portal_logout\">servlet logout ok</div>");
pw.println("</body></html>");
//Clear principal form database-service by calling logout
StringBuilder result = new StringBuilder();
String urlBase = ServletTestUtils.getUrlBase(req);

View file

@ -29,7 +29,7 @@ import org.keycloak.adapters.spi.AuthenticationError;
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
public class ErrorServlet extends HttpServlet {
public static AuthenticationError authError;
private AuthenticationError authError;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
@ -44,7 +44,7 @@ public class ErrorServlet extends HttpServlet {
if (statusCode != null)
pw.print("<br/>HTTP status code: " + statusCode);
if (authError != null)
pw.print("<br/>Error info: " + authError.toString());
pw.print("<br/>Error info: <span id=\"error\">" + authError.toString() + "</span>");
pw.print("</body></html>");
pw.flush();
}

View file

@ -340,6 +340,137 @@
<version>${wildfly.core.version}</version>
</dependency>
</dependencies>
<!--todo move the build section higher probably-->
<build>
<plugins>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
<executions>
<execution>
<id>keycloak-parent-basedir</id>
<goals>
<goal>directory-of</goal>
</goals>
<phase>initialize</phase>
<configuration>
<property>keycloak-parent.basedir</property>
<project>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-parent</artifactId>
</project>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>example-wars</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>hello-world-authz-service</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>photoz-html5-client</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>photoz-restful-api</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>servlet-authz-app</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>servlet-policy-enforcer</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-test-apps-cors-angular-product</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-test-apps-cors-database-service</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
</artifactItems>
<outputDirectory>${examples.home}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
<!--<skip>${skip.example.tests}</skip>-->
</configuration>
</execution>
<execution>
<id>test-apps-realms</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-test-apps-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<includes>**/*realm.json,**/*authz-service.json,**/testsaml.json,**/*-keycloak.json</includes>
</artifactItem>
</artifactItems>
<outputDirectory>${examples.home}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>example-realms</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${examples.home}/example-realms</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
<resources>
<resource>
<directory>${examples.basedir}</directory>
<filtering>true</filtering>
<includes>
<include>**/*.json</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>auth-servers-crossdc-undertow</id>

View file

@ -48,13 +48,6 @@ public class AppServerTestEnricher {
protected final Logger log = Logger.getLogger(this.getClass());
public static final String APP_SERVER_PREFIX = "app-server-";
public static final String APP_SERVER_UNDERTOW = APP_SERVER_PREFIX + "undertow";
public static final String APP_SERVER_WILDFLY = APP_SERVER_PREFIX + "wildfly";
public static final String APP_SERVER_WILDFLY_CLUSTER = APP_SERVER_WILDFLY + "-ha-node-1;"+ APP_SERVER_WILDFLY + "-ha-node-2";
public static final String CURRENT_APP_SERVER = System.getProperty("app.server", "undertow");
@Inject private Instance<ContainerController> containerConrollerInstance;
@ -157,7 +150,7 @@ public class AppServerTestEnricher {
try {
return ManagementClient.online(OnlineOptions
.standalone()
.hostAndPort(System.getProperty("app.server.host"), System.getProperty("app.server","").startsWith("eap6") ? 10199 : 10190)
.hostAndPort(System.getProperty("app.server.host", "localhost"), System.getProperty("app.server","").startsWith("eap6") ? 10199 : 10190)
.protocol(System.getProperty("app.server","").startsWith("eap6") ? ManagementProtocol.REMOTE : ManagementProtocol.HTTP_REMOTING)
.build()
);

View file

@ -28,7 +28,7 @@ import org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDepl
import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.logging.Logger;
import org.keycloak.common.util.StringPropertyReplacer;
import org.keycloak.testsuite.arquillian.AppServerTestEnricher;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.getAppServerQualifiers;
@ -96,7 +96,7 @@ public class DeploymentTargetModifier extends AnnotationDeploymentScenarioGenera
updateServerQualifier(deployment, testClass, newAuthServerQualifier);
} else if (containerQualifier.contains(APP_SERVER_CURRENT)) {
String suffix = containerQualifier.split(APP_SERVER_CURRENT)[1];
String newAppServerQualifier = AppServerTestEnricher.APP_SERVER_PREFIX + AppServerTestEnricher.CURRENT_APP_SERVER + "-" + suffix;
String newAppServerQualifier = ContainerConstants.APP_SERVER_PREFIX + AppServerTestEnricher.CURRENT_APP_SERVER + "-" + suffix;
updateServerQualifier(deployment, testClass, newAppServerQualifier);
} else {
String newServerQualifier = StringPropertyReplacer.replaceProperties(containerQualifier);

View file

@ -14,16 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.testsuite.adapter.example.authorization;
package org.keycloak.testsuite.arquillian.containers;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
public interface ContainerConstants {
public static final String APP_SERVER_PREFIX = "app-server-";
/**
*
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
@AppServerContainer("app-server-wildfly")
//@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflyPhotozExampleLazyLoadPathsAdapterTest extends AbstractPhotozExampleLazyLoadPathsAdapterTest {
public static final String APP_SERVER_UNDERTOW = APP_SERVER_PREFIX + "undertow";
public static final String APP_SERVER_WILDFLY = APP_SERVER_PREFIX + "wildfly";
public static final String APP_SERVER_WILDFLY_CLUSTER = APP_SERVER_WILDFLY + "-ha-node-1;" + APP_SERVER_WILDFLY + "-ha-node-2";
}

View file

@ -19,9 +19,11 @@ package org.keycloak.testsuite.pages;
import org.keycloak.models.Constants;
import org.keycloak.services.resources.RealmsResource;
import org.keycloak.testsuite.util.DroneUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.FindBy;
import javax.ws.rs.core.UriBuilder;
@ -137,10 +139,13 @@ public class AccountUpdateProfilePage extends AbstractAccountPage {
return attrElement.getAttribute("value");
}
@Override
public boolean isCurrent() {
return driver.getTitle().contains("Account Management") && driver.getPageSource().contains("Edit Account");
WebDriver currentDriver = DroneUtils.getCurrentDriver();
return currentDriver.getTitle().contains("Account Management") && currentDriver.getPageSource().contains("Edit Account");
}
@Override
public void open() {
driver.navigate().to(getPath());
}

View file

@ -21,6 +21,8 @@ import static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;
import org.jboss.arquillian.graphene.page.Page;
import org.keycloak.testsuite.adapter.page.AppServerContextRoot;
import org.keycloak.testsuite.auth.page.login.OIDCLogin;
import org.keycloak.testsuite.util.DroneUtils;
import org.keycloak.testsuite.util.JavascriptBrowser;
import org.keycloak.testsuite.util.URLUtils;
import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.WebElement;
@ -32,6 +34,7 @@ import org.openqa.selenium.support.FindBy;
public class AppServerWelcomePage extends AppServerContextRoot {
@Page
@JavascriptBrowser
protected OIDCLogin loginPage;
@FindBy(xpath = "//span[text() = 'Access Control']")
@ -45,7 +48,7 @@ public class AppServerWelcomePage extends AppServerContextRoot {
@Override
public boolean isCurrent() {
return driver.getPageSource().contains("Access Control");
return DroneUtils.getCurrentDriver().getPageSource().contains("Access Control");
}
public void navigateToConsole() {

View file

@ -0,0 +1,18 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.keycloak.testsuite.util;
import org.junit.Assume;
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
public class ContainerAssume {
public static void assumeNotAuthServerUndertow() {
Assume.assumeFalse("Doesn't work on auth-server-undertow",
AuthServerTestEnricher.AUTH_SERVER_CONTAINER.equals(AuthServerTestEnricher.AUTH_SERVER_CONTAINER_DEFAULT));
}
}

View file

@ -47,6 +47,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeoutException;
import org.junit.Assume;
/**
* <code>@AppServerContainer</code> is needed for stopping recursion in
@ -233,6 +234,16 @@ public abstract class AbstractAdapterTest extends AbstractAuthTest {
}
}
protected void assumeNotOnAppServerUndertow() {
log.warn("TODO: Not stable on app-server-undertow. "
+ "It throws: KC-SERVICES0057: Logout for client '${CLIENT_NAME}' failed\n"
+ "org.apache.http.NoHttpResponseException: localhost:8280 failed to respond");
Assume.assumeFalse("Not stable on app-server-undertow. "
+ "It throws: KC-SERVICES0057: Logout for client '${CLIENT_NAME}' failed\n"
+ "org.apache.http.NoHttpResponseException: localhost:8280 failed to respond",
System.getProperty("app.server", "undertow").equals("undertow"));
}
public static void addContextXml(Archive archive, String contextPath) {
try {
String contextXmlContent = IOUtils.toString(tomcatContext.openStream(), "UTF-8")

View file

@ -14,17 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.testsuite.adapter.servlet.cluster;
import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.representations.idm.*;
import org.keycloak.common.util.Retry;
import org.keycloak.testsuite.adapter.page.EmployeeServletDistributable;
import org.keycloak.testsuite.adapter.page.SAMLServlet;
import org.keycloak.testsuite.auth.page.AuthRealm;
import org.keycloak.testsuite.auth.page.login.*;
import org.keycloak.testsuite.page.AbstractPage;
import org.keycloak.testsuite.util.WaitUtils;
package org.keycloak.testsuite.adapter;
import io.undertow.Undertow;
import io.undertow.server.handlers.ResponseCodeHandler;
@ -32,29 +22,36 @@ import io.undertow.server.handlers.proxy.LoadBalancingProxyClient;
import io.undertow.server.handlers.proxy.ProxyHandler;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.function.BiConsumer;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.http.client.methods.HttpGet;
import org.jboss.arquillian.container.test.api.*;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.junit.*;
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.representations.idm.*;
import org.keycloak.common.util.Retry;
import org.keycloak.testsuite.adapter.page.EmployeeServletDistributable;
import org.keycloak.testsuite.adapter.page.SAMLServlet;
import org.keycloak.testsuite.admin.ApiUtil;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.AppServerTestEnricher;
import org.keycloak.testsuite.arquillian.ContainerInfo;
import org.keycloak.testsuite.auth.page.AuthRealm;
import org.keycloak.testsuite.auth.page.login.*;
import org.keycloak.testsuite.page.AbstractPage;
import org.keycloak.testsuite.util.Matchers;
import org.keycloak.testsuite.util.SamlClient;
import org.keycloak.testsuite.util.SamlClient.Binding;
import org.keycloak.testsuite.util.SamlClientBuilder;
import java.net.MalformedURLException;
import java.util.function.BiConsumer;
import org.apache.http.client.methods.HttpGet;
import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
@ -64,7 +61,7 @@ import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.keycloak.testsuite.admin.Users.setPasswordFor;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.getNearestSuperclassWithAppServerAnnotation;
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.APP_SERVER_CURRENT;
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
import static org.keycloak.testsuite.util.IOUtil.loadRealm;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
@ -73,13 +70,14 @@ import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
*
* @author hmlnarik
*/
public abstract class AbstractSAMLAdapterClusterTest extends AbstractServletsAdapterTest {
public abstract class AbstractSAMLAdapterClusteredTest extends AbstractServletsAdapterTest {
protected static final String NODE_1_NAME = "ha-node-1";
protected static final String NODE_2_NAME = "ha-node-2";
protected final String NODE_1_SERVER_NAME = getAppServerId() + "-" + NODE_1_NAME;
protected final String NODE_2_SERVER_NAME = getAppServerId() + "-" + NODE_2_NAME;
// target containers will be replaced in runtime in DeploymentTargetModifier by real app-server
public static final String TARGET_CONTAINER_NODE_1 = APP_SERVER_CURRENT + NODE_1_NAME;
public static final String TARGET_CONTAINER_NODE_2 = APP_SERVER_CURRENT + NODE_2_NAME;
protected static final int PORT_OFFSET_NODE_REVPROXY = NumberUtils.toInt(System.getProperty("app.server.reverse-proxy.port.offset"), -1);
protected static final int HTTP_PORT_NODE_REVPROXY = 8080 + PORT_OFFSET_NODE_REVPROXY;
@ -90,20 +88,6 @@ public abstract class AbstractSAMLAdapterClusterTest extends AbstractServletsAda
protected static final URI NODE_1_URI = URI.create("http://localhost:" + HTTP_PORT_NODE_1);
protected static final URI NODE_2_URI = URI.create("http://localhost:" + HTTP_PORT_NODE_2);
@BeforeClass
public static void checkPropertiesSet() {
Assume.assumeThat(PORT_OFFSET_NODE_1, not(is(-1)));
Assume.assumeThat(PORT_OFFSET_NODE_2, not(is(-1)));
Assume.assumeThat(PORT_OFFSET_NODE_REVPROXY, not(is(-1)));
}
protected static void prepareServerDirectory(String targetSubdirectory) throws IOException {
Path path = Paths.get(System.getProperty("app.server.home"), targetSubdirectory);
File targetSubdirFile = path.toFile();
FileUtils.deleteDirectory(targetSubdirFile);
FileUtils.forceMkdir(targetSubdirFile);
FileUtils.copyDirectoryToDirectory(Paths.get(System.getProperty("app.server.home"), "standalone", "deployments").toFile(), targetSubdirFile);
}
protected LoadBalancingProxyClient loadBalancerToNodes;
protected Undertow reverseProxyToNodes;
@ -121,44 +105,6 @@ public abstract class AbstractSAMLAdapterClusterTest extends AbstractServletsAda
testRealms.add(loadRealm("/adapter-test/keycloak-saml/testsaml-behind-lb.json"));
}
@Before
public void prepareReverseProxy() throws Exception {
loadBalancerToNodes = new LoadBalancingProxyClient().addHost(NODE_1_URI, NODE_1_NAME).setConnectionsPerThread(10);
reverseProxyToNodes = Undertow.builder().addHttpListener(HTTP_PORT_NODE_REVPROXY, "localhost").setIoThreads(2).setHandler(new ProxyHandler(loadBalancerToNodes, 5000, ResponseCodeHandler.HANDLE_404)).build();
reverseProxyToNodes.start();
}
@After
public void stopReverseProxy() {
reverseProxyToNodes.stop();
}
@Before
public void startServer() throws Exception {
prepareServerDirectory("standalone-" + NODE_1_NAME);
controller.start(NODE_1_SERVER_NAME);
prepareWorkerNode(0, Integer.valueOf(System.getProperty("app.server.1.management.port")));
prepareServerDirectory("standalone-" + NODE_2_NAME);
controller.start(NODE_2_SERVER_NAME);
prepareWorkerNode(1, Integer.valueOf(System.getProperty("app.server.2.management.port")));
deployer.deploy(EmployeeServletDistributable.DEPLOYMENT_NAME);
deployer.deploy(EmployeeServletDistributable.DEPLOYMENT_NAME + "_2");
}
/**
* Prepares a worker node
* @param nodeIndex Node index, counting from 0
* @param managementPort Port for management operations on this node
* @throws Exception
*/
protected abstract void prepareWorkerNode(int nodeIndex, Integer managementPort) throws Exception;
@After
public void stopServer() {
controller.stop(NODE_1_SERVER_NAME);
controller.stop(NODE_2_SERVER_NAME);
}
@Override
public void setDefaultPageUriParameters() {
super.setDefaultPageUriParameters();
@ -168,7 +114,57 @@ public abstract class AbstractSAMLAdapterClusterTest extends AbstractServletsAda
loginActionsPage.setAuthRealm(DEMO);
}
protected void testLogoutViaSessionIndex(URL employeeUrl, boolean forceRefreshAtOtherNode, BiConsumer<SamlClientBuilder, String> logoutFunction) {
@BeforeClass
public static void checkPropertiesSet() {
Assume.assumeThat(PORT_OFFSET_NODE_1, not(is(-1)));
Assume.assumeThat(PORT_OFFSET_NODE_2, not(is(-1)));
Assume.assumeThat(PORT_OFFSET_NODE_REVPROXY, not(is(-1)));
assumeNotElytronAdapter();
}
@Before
public void prepareReverseProxy() throws Exception {
loadBalancerToNodes = new LoadBalancingProxyClient().addHost(NODE_1_URI, NODE_1_NAME).setConnectionsPerThread(10);
reverseProxyToNodes = Undertow.builder().addHttpListener(HTTP_PORT_NODE_REVPROXY, "localhost").setIoThreads(2).setHandler(new ProxyHandler(loadBalancerToNodes, 5000, ResponseCodeHandler.HANDLE_404)).build();
reverseProxyToNodes.start();
}
@Before
public void startServers() throws Exception {
prepareServerDirectories();
for (ContainerInfo containerInfo : testContext.getAppServerBackendsInfo()) {
controller.start(containerInfo.getQualifier());
}
deployer.deploy(EmployeeServletDistributable.DEPLOYMENT_NAME);
deployer.deploy(EmployeeServletDistributable.DEPLOYMENT_NAME + "_2");
}
protected abstract void prepareServerDirectories() throws Exception;
protected void prepareServerDirectory(String baseDir, String targetSubdirectory) throws IOException {
Path path = Paths.get(System.getProperty("app.server.home"), targetSubdirectory);
File targetSubdirFile = path.toFile();
FileUtils.deleteDirectory(targetSubdirFile);
FileUtils.forceMkdir(targetSubdirFile);
//workaround for WFARQ-44
FileUtils.copyDirectory(Paths.get(System.getProperty("app.server.home"), baseDir, "deployments").toFile(), new File(targetSubdirFile, "deployments"));
FileUtils.copyDirectory(Paths.get(System.getProperty("app.server.home"), baseDir, "configuration").toFile(), new File(targetSubdirFile, "configuration"));
}
@After
public void stopReverseProxy() {
reverseProxyToNodes.stop();
}
@After
public void stopServers() {
for (ContainerInfo containerInfo : testContext.getAppServerBackendsInfo()) {
controller.stop(containerInfo.getQualifier());
}
}
private void testLogoutViaSessionIndex(URL employeeUrl, boolean forceRefreshAtOtherNode, BiConsumer<SamlClientBuilder, String> logoutFunction) {
setPasswordFor(bburkeUser, CredentialRepresentation.PASSWORD);
final String employeeUrlString;
@ -231,6 +227,16 @@ public abstract class AbstractSAMLAdapterClusterTest extends AbstractServletsAda
demoRealm.users().get(bburkeId).logout();
log.infov("Logged out via admin console");
}
private static void assumeNotElytronAdapter() {
if (!AppServerTestEnricher.isUndertowAppServer()) {
try {
Assume.assumeFalse(FileUtils.readFileToString(Paths.get(System.getProperty("app.server.home"), "standalone", "configuration", "standalone.xml").toFile(), "UTF-8").contains("<security-domain name=\"KeycloakDomain\""));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
@Test
public void testAdminInitiatedBackchannelLogout(@ArquillianResource
@ -299,12 +305,4 @@ public abstract class AbstractSAMLAdapterClusterTest extends AbstractServletsAda
WaitUtils.waitForPageToLoad();
assertCurrentUrlStartsWith(loginPage);
}
private String getAppServerId() {
Class<?> annotatedClass = getNearestSuperclassWithAppServerAnnotation(this.getClass());
return (annotatedClass == null ? "<cannot-find-@AppServerContainer>"
: annotatedClass.getAnnotation(AppServerContainer.class).value());
}
}

View file

@ -131,6 +131,8 @@ public abstract class AbstractServletsAdapterTest extends AbstractAdapterTest {
driver.navigate().to(timeOffsetUri);
WaitUtils.waitUntilElement(By.tagName("body")).is().visible();
String pageSource = driver.getPageSource();
System.out.println(pageSource);
}
}

View file

@ -46,9 +46,11 @@ import org.keycloak.testsuite.ProfileAssume;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.adapter.page.PhotozClientAuthzTestApp;
import org.keycloak.testsuite.auth.page.login.OIDCLogin;
import org.keycloak.testsuite.util.ContainerAssume;
import org.keycloak.testsuite.util.DroneUtils;
import org.keycloak.testsuite.util.JavascriptBrowser;
import org.keycloak.util.JsonSerialization;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
@ -182,6 +184,8 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd
@Test
public void testOnlyOwnerCanDeleteAlbum() throws Exception {
ContainerAssume.assumeNotAuthServerUndertow();
loginToClientPage("alice", "alice");
clientPage.createAlbum("Alice-Family-Album");
@ -233,6 +237,8 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd
@Test
public void testAdminOnlyFromSpecificAddress() throws Exception {
ContainerAssume.assumeNotAuthServerUndertow();
loginToClientPage("admin", "admin");
clientPage.navigateToAdminAlbum(false);
@ -251,6 +257,8 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd
@Test
public void testAdminWithoutPermissionsToTypedResource() throws Exception {
ContainerAssume.assumeNotAuthServerUndertow();
loginToClientPage("alice", "alice");
clientPage.createAlbum("Alice Family Album");
@ -300,6 +308,8 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd
@Test
public void testAdminWithoutPermissionsToDeleteAlbum() throws Exception {
ContainerAssume.assumeNotAuthServerUndertow();
loginToClientPage("alice", "alice");
clientPage.createAlbum("Alice Family Album");
@ -343,6 +353,8 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd
@Test
public void testClientRoleRepresentingUserConsent() throws Exception {
ContainerAssume.assumeNotAuthServerUndertow();
loginToClientPage("alice", "alice");
clientPage.createAlbum("Alice Family Album");
clientPage.viewAlbum("Alice Family Album", false);
@ -423,6 +435,8 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd
@Test
public void testOverridePermissionFromResourceParent() throws Exception {
ContainerAssume.assumeNotAuthServerUndertow();
loginToClientPage("alice", "alice");
String resourceName = "My Resource Instance";
clientPage.createAlbum(resourceName);
@ -483,6 +497,8 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd
@Test
public void testInheritPermissionFromResourceParent() throws Exception {
ContainerAssume.assumeNotAuthServerUndertow();
loginToClientPage("alice", "alice");
String resourceName = "My Resource Instance";
@ -567,6 +583,8 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd
//KEYCLOAK-3777
@Test
public void testEntitlementRequest() throws Exception {
ContainerAssume.assumeNotAuthServerUndertow();
clientPage.navigateTo();
loginToClientPage("admin", "admin");
@ -716,5 +734,6 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd
clientPage.navigateTo();
waitForPageToLoad();
clientPage.login(username, password, scopes);
waitUntilElement(By.linkText("Sign Out")).is().clickable();
}
}
}

View file

@ -1,88 +0,0 @@
/*
* Copyright 2018 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.example.authorization;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.keycloak.testsuite.util.IOUtil.loadJson;
import static org.keycloak.testsuite.util.IOUtil.loadRealm;
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.LaxRedirectStrategy;
import org.jboss.arquillian.container.test.api.Deployer;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.keycloak.admin.client.resource.AuthorizationResource;
import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.admin.client.resource.ClientsResource;
import org.keycloak.admin.client.resource.ResourcesResource;
import org.keycloak.admin.client.resource.RoleResource;
import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.admin.client.resource.UsersResource;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.representations.idm.RoleRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.representations.idm.authorization.PolicyRepresentation;
import org.keycloak.representations.idm.authorization.ResourceRepresentation;
import org.keycloak.representations.idm.authorization.ResourceServerRepresentation;
import org.keycloak.testsuite.ProfileAssume;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.adapter.page.PhotozClientAuthzTestApp;
import org.keycloak.util.JsonSerialization;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public abstract class AbstractPhotozExampleLazyLoadPathsAdapterTest extends AbstractPhotozExampleAdapterTest {
@Deployment(name = PhotozClientAuthzTestApp.DEPLOYMENT_NAME)
public static WebArchive deploymentClient() throws IOException {
return exampleDeployment(PhotozClientAuthzTestApp.DEPLOYMENT_NAME);
}
@Deployment(name = RESOURCE_SERVER_ID, managed = false, testable = false)
public static WebArchive deploymentResourceServer() throws IOException {
return exampleDeployment(RESOURCE_SERVER_ID)
.addAsWebInfResource(new File(TEST_APPS_HOME_DIR + "/photoz/keycloak-lazy-load-path-authz-service.json"), "keycloak.json");
}
}

View file

@ -30,6 +30,8 @@ import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.representations.idm.authorization.PolicyRepresentation;
import org.keycloak.testsuite.ProfileAssume;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import java.io.File;
import java.io.FileNotFoundException;
@ -44,7 +46,8 @@ import static org.keycloak.testsuite.util.IOUtil.loadRealm;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public abstract class AbstractDefaultAuthzConfigAdapterTest extends AbstractExampleAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class DefaultAuthzConfigAdapterTest extends AbstractExampleAdapterTest {
private static final String REALM_NAME = "hello-world-authz";
private static final String RESOURCE_SERVER_ID = "hello-world-authz-service";

View file

@ -16,19 +16,22 @@
*/
package org.keycloak.testsuite.adapter.example.authorization;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import static org.junit.Assert.assertTrue;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public abstract class AbstractPermissiveModeAdapterTest extends AbstractBaseServletAuthzAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class PermissiveModeAdapterTest extends AbstractBaseServletAuthzAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)
public static WebArchive deployment() throws IOException {

View file

@ -0,0 +1,45 @@
/*
* Copyright 2018 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.example.authorization;
import java.io.File;
import java.io.IOException;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.keycloak.testsuite.adapter.page.PhotozClientAuthzTestApp;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class PhotozExampleLazyLoadPathsAdapterTest extends AbstractPhotozExampleAdapterTest {
@Deployment(name = PhotozClientAuthzTestApp.DEPLOYMENT_NAME)
public static WebArchive deploymentClient() throws IOException {
return exampleDeployment(PhotozClientAuthzTestApp.DEPLOYMENT_NAME);
}
@Deployment(name = RESOURCE_SERVER_ID, managed = false, testable = false)
public static WebArchive deploymentResourceServer() throws IOException {
return exampleDeployment(RESOURCE_SERVER_ID)
.addAsWebInfResource(new File(TEST_APPS_HOME_DIR + "/photoz/keycloak-lazy-load-path-authz-service.json"), "keycloak.json");
}
}

View file

@ -21,11 +21,14 @@ import java.io.IOException;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.keycloak.testsuite.adapter.page.PhotozClientAuthzTestApp;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public abstract class AbstractPhotozExampleNoLazyLoadPathsAdapterTest extends AbstractPhotozExampleAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class PhotozExampleNoLazyLoadPathsAdapterTest extends AbstractPhotozExampleAdapterTest {
@Deployment(name = PhotozClientAuthzTestApp.DEPLOYMENT_NAME)
public static WebArchive deploymentClient() throws IOException {

View file

@ -20,11 +20,14 @@ import java.io.IOException;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public abstract class AbstractServletAuthzAdapterTest extends AbstractServletAuthzFunctionalAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class ServletAuthzAdapterTest extends AbstractServletAuthzFunctionalAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)
public static WebArchive deployment() throws IOException {

View file

@ -16,20 +16,20 @@
*/
package org.keycloak.testsuite.adapter.example.authorization;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public abstract class AbstractServletAuthzCIPAdapterTest extends AbstractServletAuthzFunctionalAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class ServletAuthzCIPAdapterTest extends AbstractServletAuthzFunctionalAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)
public static WebArchive deployment() throws IOException {

View file

@ -22,11 +22,14 @@ import org.junit.Test;
import java.io.File;
import java.io.IOException;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public abstract class AbstractServletAuthzLazyLoadPathsAdapterTest extends AbstractServletAuthzFunctionalAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class ServletAuthzLazyLoadPathsAdapterTest extends AbstractServletAuthzFunctionalAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)
public static WebArchive deployment() throws IOException {

View file

@ -24,11 +24,14 @@ import org.keycloak.representations.idm.authorization.ResourceRepresentation;
import java.io.File;
import java.io.IOException;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public abstract class AbstractServletCacheDisabledAdapterTest extends AbstractServletAuthzFunctionalAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class ServletCacheDisabledAdapterTest extends AbstractServletAuthzFunctionalAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)
public static WebArchive deployment() throws IOException {

View file

@ -16,19 +16,21 @@
*/
package org.keycloak.testsuite.adapter.example.authorization;
import java.io.File;
import java.io.IOException;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.keycloak.representations.idm.authorization.ResourcePermissionRepresentation;
import org.keycloak.representations.idm.authorization.ResourceRepresentation;
import java.io.File;
import java.io.IOException;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public abstract class AbstractServletCacheLifespanAdapterTest extends AbstractServletAuthzFunctionalAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class ServletCacheLifespanAdapterTest extends AbstractServletAuthzFunctionalAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)
public static WebArchive deployment() throws IOException {

View file

@ -44,13 +44,16 @@ import org.keycloak.representations.idm.authorization.ResourcePermissionRepresen
import org.keycloak.representations.idm.authorization.ResourceRepresentation;
import org.keycloak.testsuite.ProfileAssume;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.By;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public abstract class AbstractServletPolicyEnforcerTest extends AbstractExampleAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class ServletPolicyEnforcerTest extends AbstractExampleAdapterTest {
protected static final String REALM_NAME = "servlet-policy-enforcer-authz";
protected static final String RESOURCE_SERVER_ID = "servlet-policy-enforcer";
@ -221,7 +224,7 @@ public abstract class AbstractServletPolicyEnforcerTest extends AbstractExampleA
}
@Test
public void testPattern7() {
public void testPattern7() throws Exception {
performTests(() -> {
login("alice", "alice");
@ -352,6 +355,45 @@ public abstract class AbstractServletPolicyEnforcerTest extends AbstractExampleA
});
}
@Test
public void testPathWithPatternSlashAllAndResourceInstance() {
performTests(() -> {
ResourceRepresentation resource = new ResourceRepresentation("Pattern 15 Instance");
resource.setType("pattern-15");
resource.setUri("/keycloak-7148/1");
resource.setOwner("alice");
getAuthorizationResource().resources().create(resource).close();
login("alice", "alice");
navigateTo("/keycloak-7148/1");
assertFalse(wasDenied());
navigateTo("/keycloak-7148/1/sub-a/2");
assertFalse(wasDenied());
navigateTo("/keycloak-7148/1/sub-a");
assertFalse(wasDenied());
navigateTo("/keycloak-7148/1/sub-a/2/sub-b");
assertFalse(wasDenied());
updatePermissionPolicies("Pattern 15 Permission", "Deny Policy");
login("alice", "alice");
navigateTo("/keycloak-7148/1");
assertTrue(wasDenied());
navigateTo("/keycloak-7148/1/sub-a/2");
assertTrue(wasDenied());
navigateTo("/keycloak-7148/1/sub-a");
assertTrue(wasDenied());
navigateTo("/keycloak-7148/1/sub-a/2/sub-b");
assertTrue(wasDenied());
// does not exist
navigateTo("/keycloak-7148/2");
assertTrue(wasDenied());
});
}
@Test
public void testPriorityOfURIForResource() {
performTests(() -> {
@ -406,45 +448,6 @@ public abstract class AbstractServletPolicyEnforcerTest extends AbstractExampleA
});
}
@Test
public void testPathWithPatternSlashAllAndResourceInstance() {
performTests(() -> {
ResourceRepresentation resource = new ResourceRepresentation("Pattern 15 Instance");
resource.setType("pattern-15");
resource.setUri("/keycloak-7148/1");
resource.setOwner("alice");
getAuthorizationResource().resources().create(resource).close();
login("alice", "alice");
navigateTo("/keycloak-7148/1");
assertFalse(wasDenied());
navigateTo("/keycloak-7148/1/sub-a/2");
assertFalse(wasDenied());
navigateTo("/keycloak-7148/1/sub-a");
assertFalse(wasDenied());
navigateTo("/keycloak-7148/1/sub-a/2/sub-b");
assertFalse(wasDenied());
updatePermissionPolicies("Pattern 15 Permission", "Deny Policy");
login("alice", "alice");
navigateTo("/keycloak-7148/1");
assertTrue(wasDenied());
navigateTo("/keycloak-7148/1/sub-a/2");
assertTrue(wasDenied());
navigateTo("/keycloak-7148/1/sub-a");
assertTrue(wasDenied());
navigateTo("/keycloak-7148/1/sub-a/2/sub-b");
assertTrue(wasDenied());
// does not exist
navigateTo("/keycloak-7148/2");
assertTrue(wasDenied());
});
}
private void navigateTo(String path) {
this.driver.navigate().to(getResourceServerUrl() + path);
}

View file

@ -32,6 +32,8 @@ import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.adapter.page.AngularCorsProductTestApp;
import org.keycloak.testsuite.adapter.page.CorsDatabaseServiceTestApp;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.auth.page.account.Account;
import org.keycloak.testsuite.auth.page.login.OIDCLogin;
import org.keycloak.testsuite.util.JavascriptBrowser;
@ -54,11 +56,12 @@ import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
/**
* Created by fkiss.
*/
public abstract class AbstractCorsExampleAdapterTest extends AbstractExampleAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class CorsExampleAdapterTest extends AbstractExampleAdapterTest {
public static final String CORS = "cors";
public static final String AUTH_SERVER_HOST = "localhost-auth";
private static String hostBackup;
private static final String hostBackup;
@ArquillianResource
private Deployer deployer;
@ -81,12 +84,12 @@ public abstract class AbstractCorsExampleAdapterTest extends AbstractExampleAdap
private Account jsDriverTestRealmAccount;
@Deployment(name = AngularCorsProductTestApp.DEPLOYMENT_NAME)
private static WebArchive angularCorsProductExample() throws IOException {
protected static WebArchive angularCorsProductExample() throws IOException {
return exampleDeployment(AngularCorsProductTestApp.CLIENT_ID);
}
@Deployment(name = CorsDatabaseServiceTestApp.DEPLOYMENT_NAME, managed = false)
private static WebArchive corsDatabaseServiceExample() throws IOException {
protected static WebArchive corsDatabaseServiceExample() throws IOException {
return exampleDeployment(CorsDatabaseServiceTestApp.CLIENT_ID);
}

View file

@ -21,6 +21,7 @@ import static org.keycloak.testsuite.util.IOUtil.loadRealm;
import java.io.IOException;
import java.util.List;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Assume;
@ -30,9 +31,13 @@ import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.adapter.AbstractAdapterTest;
import org.keycloak.testsuite.arquillian.AppServerTestEnricher;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
import org.keycloak.testsuite.pages.AppServerWelcomePage;
import org.keycloak.testsuite.util.DroneUtils;
import org.keycloak.testsuite.util.JavascriptBrowser;
import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.WebDriver;
import org.wildfly.extras.creaper.core.online.CliException;
import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
import org.wildfly.extras.creaper.core.online.operations.Address;
@ -43,14 +48,20 @@ import org.wildfly.extras.creaper.core.online.operations.Operations;
*
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
@AppServerContainer("app-server-wildfly")
//@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflyConsoleProtectionTest extends AbstractAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class ConsoleProtectionTest extends AbstractAdapterTest {
// Javascript browser needed KEYCLOAK-4703
@Drone
@JavascriptBrowser
protected WebDriver jsDriver;
@Page
@JavascriptBrowser
protected AppServerWelcomePage appServerWelcomePage;
@Page
@JavascriptBrowser
protected AccountUpdateProfilePage accountUpdateProfilePage;
@Override
@ -60,12 +71,11 @@ public class WildflyConsoleProtectionTest extends AbstractAdapterTest {
@Before
public void beforeConsoleProtectionTest() throws IOException, OperationException {
try (OnlineManagementClient clientWorkerNodeClient = AppServerTestEnricher.getManagementClient()) {
Operations operations = new Operations(clientWorkerNodeClient);
Assume.assumeTrue(operations.exists(Address.subsystem("elytron")));
Assume.assumeTrue(operations.exists(Address.subsystem("elytron").and("security-domain", "KeycloakDomain")));
// Create a realm for both wildfly console and mgmt interface
clientWorkerNodeClient.execute("/subsystem=keycloak/realm=jboss-infra:add(auth-server-url=http://localhost:8180/auth,realm-public-key=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB)");
@ -91,6 +101,8 @@ public class WildflyConsoleProtectionTest extends AbstractAdapterTest {
} catch (CliException cause) {
throw new RuntimeException("Failed to configure app server", cause);
}
DroneUtils.addWebDriver(jsDriver);
}
private void testLogin() throws InterruptedException {

View file

@ -1,31 +0,0 @@
/*
* Copyright 2018 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.servlet;
import org.junit.Ignore;
import org.junit.Test;
public abstract class AbstractSessionFilterServletAdapterTest extends AbstractSessionServletAdapterTest {
@Test
@Override
@Ignore
public void testAccountManagementSessionsLogout() {
//Can't test this because backchannel logout for filter does not invalidate the session
}
}

View file

@ -55,6 +55,8 @@ import org.keycloak.services.resources.admin.permissions.AdminPermissions;
import org.keycloak.testsuite.AbstractAuthTest;
import org.keycloak.testsuite.adapter.AbstractAdapterTest;
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.broker.BrokerTestTools;
import org.keycloak.testsuite.page.AbstractPageWithInjectedUrl;
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
@ -86,7 +88,9 @@ import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SE
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public abstract class AbstractBrokerLinkAndTokenExchangeTest extends AbstractServletsAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class BrokerLinkAndTokenExchangeTest extends AbstractServletsAdapterTest {
public static final String CHILD_IDP = "child";
public static final String PARENT_IDP = "parent-idp";
public static final String PARENT_USERNAME = "parent";
@ -97,8 +101,7 @@ public abstract class AbstractBrokerLinkAndTokenExchangeTest extends AbstractSer
@Deployment
@TargetsContainer(AUTH_SERVER_CURRENT)
public static WebArchive deploy() {
return RunOnServerDeployment.create(
AbstractBrokerLinkAndTokenExchangeTest.class,
return RunOnServerDeployment.create(BrokerLinkAndTokenExchangeTest.class,
AbstractServletsAdapterTest.class,
AbstractAdapterTest.class,
AbstractAuthTest.class);
@ -295,7 +298,7 @@ public abstract class AbstractBrokerLinkAndTokenExchangeTest extends AbstractSer
@Before
public void createBroker() {
createParentChild();
testingClient.server().run(AbstractBrokerLinkAndTokenExchangeTest::setupRealm);
testingClient.server().run(BrokerLinkAndTokenExchangeTest::setupRealm);
}
public void createParentChild() {
@ -305,7 +308,7 @@ public abstract class AbstractBrokerLinkAndTokenExchangeTest extends AbstractSer
@Test
public void testAccountLink() throws Exception {
testingClient.server().run(AbstractBrokerLinkAndTokenExchangeTest::turnOnTokenStore);
testingClient.server().run(BrokerLinkAndTokenExchangeTest::turnOnTokenStore);
RealmResource realm = adminClient.realms().realm(CHILD_IDP);
List<FederatedIdentityRepresentation> links = realm.users().get(childUserId).getFederatedIdentity();
@ -429,7 +432,7 @@ public abstract class AbstractBrokerLinkAndTokenExchangeTest extends AbstractSer
@Test
public void testAccountLinkNoTokenStore() throws Exception {
testingClient.server().run(AbstractBrokerLinkAndTokenExchangeTest::turnOffTokenStore);
testingClient.server().run(BrokerLinkAndTokenExchangeTest::turnOffTokenStore);
RealmResource realm = adminClient.realms().realm(CHILD_IDP);
List<FederatedIdentityRepresentation> links = realm.users().get(childUserId).getFederatedIdentity();

View file

@ -24,7 +24,6 @@ import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.common.util.Base64Url;
@ -43,6 +42,8 @@ import org.keycloak.testsuite.ActionURIUtils;
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
import org.keycloak.testsuite.admin.ApiUtil;
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.broker.BrokerTestTools;
import org.keycloak.testsuite.page.AbstractPageWithInjectedUrl;
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
@ -71,7 +72,9 @@ import static org.keycloak.testsuite.admin.ApiUtil.createUserAndResetPasswordWit
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public abstract class AbstractClientInitiatedAccountLinkTest extends AbstractServletsAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class ClientInitiatedAccountLinkTest extends AbstractServletsAdapterTest {
public static final String CHILD_IDP = "child";
public static final String PARENT_IDP = "parent-idp";
public static final String PARENT_USERNAME = "parent";

View file

@ -18,11 +18,15 @@ package org.keycloak.testsuite.adapter.servlet;
import org.junit.Ignore;
import org.junit.Test;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.annotation.UseServletFilter;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
@UseServletFilter(filterName = "oidc-filter", filterClass = "org.keycloak.adapters.servlet.KeycloakOIDCFilter",
filterDependency = "org.keycloak:keycloak-servlet-filter-adapter", skipPattern = "/error.html")
public abstract class AbstractDemoFilterServletAdapterTest extends AbstractDemoServletsAdapterTest {
public class DemoFilterServletAdapterTest extends DemoServletsAdapterTest {
@Test
@ -33,7 +37,8 @@ public abstract class AbstractDemoFilterServletAdapterTest extends AbstractDemoS
@Test
@Override
@Ignore(value = "Don't need to test this because HttpServletRequest.authenticate doesn't make sense with filter implementation")
@Ignore(value = "Don't need to test this because HttpServletRequest.authenticate "
+ "doesn't make sense with filter implementation")
public void testAuthenticated() {
}

View file

@ -16,6 +16,31 @@
*/
package org.keycloak.testsuite.adapter.servlet;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
import org.apache.commons.io.FileUtils;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.conn.params.ConnManagerParams;
@ -24,11 +49,14 @@ import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.adapters.OIDCAuthenticationError;
import org.keycloak.common.util.Time;
import org.keycloak.constants.AdapterConstants;
import org.keycloak.events.Details;
@ -61,6 +89,9 @@ import org.keycloak.testsuite.adapter.page.SecurePortal;
import org.keycloak.testsuite.adapter.page.SecurePortalWithCustomSessionConfig;
import org.keycloak.testsuite.adapter.page.TokenMinTTLPage;
import org.keycloak.testsuite.admin.ApiUtil;
import org.keycloak.testsuite.arquillian.AppServerTestEnricher;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.auth.page.account.Applications;
import org.keycloak.testsuite.auth.page.login.OAuthGrant;
import org.keycloak.testsuite.auth.page.login.OIDCLogin;
@ -75,32 +106,11 @@ import org.openqa.selenium.By;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@ -111,15 +121,17 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
import static org.keycloak.testsuite.util.WaitUtils.pause;
import static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;
/**
*
* @author tkyjovsk
*/
public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class DemoServletsAdapterTest extends AbstractServletsAdapterTest {
// Javascript browser needed KEYCLOAK-4703
@Drone
@ -129,7 +141,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
@Page
@JavascriptBrowser
protected OIDCLogin jsDriverTestRealmLoginPage;
@Page
private CustomerPortal customerPortal;
@Page
@ -166,7 +178,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
private ClientSecretJwtSecurePortal clientSecretJwtSecurePortal;
@Page
private CustomerCookiePortal customerCookiePortal;
@Rule
public AssertEvents assertEvents = new AssertEvents(this);
@ -255,10 +267,22 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
tokenMinTTLPage.navigateTo();
driver.manage().deleteAllCookies();
}
private void assumeNotElytronAdapter() {
if (!AppServerTestEnricher.isUndertowAppServer()) {
try {
Assume.assumeFalse(FileUtils.readFileToString(Paths.get(System.getProperty("app.server.home"), "standalone", "configuration", "standalone.xml").toFile(), "UTF-8").contains("<security-domain name=\"KeycloakDomain\""));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
//KEYCLOAK-702
@Test
public void testTokenInCookieSSO() {
assumeNotElytronAdapter();
// Login
String tokenCookie = loginToCustomerCookiePortal();
@ -283,64 +307,59 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
//KEYCLOAK-702
@Test
public void testTokenInCookieRefresh() {
// Set token timeout 3 sec
assumeNotElytronAdapter();
log.debug("Set token timeout 10 sec");
RealmRepresentation demo = adminClient.realm("demo").toRepresentation();
int originalTokenTimeout = demo.getAccessTokenLifespan();
demo.setAccessTokenLifespan(10);
adminClient.realm("demo").update(demo);
try {
// login to customer-cookie-portal
log.debug("login to customer-cookie-portal");
String tokenCookie1 = loginToCustomerCookiePortal();
// Simulate waiting 12 seconds
log.debug("Simulate waiting 12 seconds");
setAdapterAndServerTimeOffset(12, customerCookiePortal.toString());
// assert cookie was refreshed
log.debug("assert cookie was refreshed");
customerCookiePortal.navigateTo();
assertCurrentUrlEquals(customerCookiePortal);
assertLogged();
String tokenCookie2 = driver.manage().getCookieNamed(AdapterConstants.KEYCLOAK_ADAPTER_STATE_COOKIE).getValue();
assertNotEquals(tokenCookie1, tokenCookie2);
// login to 2nd app and logout from it
log.debug("login to 2nd app and logout from it");
customerPortal.navigateTo();
assertCurrentUrlEquals(customerPortal);
assertLogged();
driver.navigate().to(customerCookiePortal.logoutURL());
pause(200); // can't use wait utils as logout page is only TextPage without elements -> can't use By.tagName("body")
assertTrue(driver.getPageSource().contains("servlet logout ok"));
driver.navigate().to(customerPortal.logout());
WaitUtils.waitUntilElement(By.id("customer_portal_logout")).is().present();
customerPortal.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
// Simulate another 12 seconds
log.debug("Simulate another 12 seconds");
setAdapterAndServerTimeOffset(24, customerCookiePortal.toString());
// assert not logged in customer-cookie-portal
log.debug("assert not logged in customer-cookie-portal");
customerCookiePortal.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
} finally {
loginToCustomerCookiePortal();
setAdapterAndServerTimeOffset(0, customerCookiePortal.toString());
driver.navigate().to(customerCookiePortal.logoutURL());
pause(200); // can't use wait utils as logout page is only TextPage without elements -> can't use By.tagName("body")
assertTrue(driver.getPageSource().contains("servlet logout ok"));
// Set token timeout 3 sec
log.debug("Set token timeout to original");
demo.setAccessTokenLifespan(originalTokenTimeout);
adminClient.realm("demo").update(demo);
log.debug("reset time offset");
setAdapterAndServerTimeOffset(0, customerCookiePortal.toString().concat("/unsecured"));
}
}
//KEYCLOAK-702
@Test
public void testInvalidTokenCookie() {
assumeNotElytronAdapter();
// Login
String tokenCookie = loginToCustomerCookiePortal();
String changedTokenCookie = tokenCookie.replace("a", "b");
@ -376,15 +395,20 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
private void logoutFromCustomerCookiePortal() {
String logout = customerCookiePortal.logoutURL();
driver.navigate().to(logout);
assertTrue(driver.getPageSource().contains("servlet logout ok"));
WaitUtils.waitUntilElement(By.id("customer_portal_logout")).is().present();
assertNull(driver.manage().getCookieNamed(AdapterConstants.KEYCLOAK_ADAPTER_STATE_COOKIE));
customerCookiePortal.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
}
private void assertLogged() {
assertPageContains("Bill Burke");
assertPageContains("Stian Thorgersen");
}
private void assertPageContains(String string) {
String pageSource = driver.getPageSource();
Assert.assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
assertThat(pageSource, containsString(string));
}
@Test
@ -398,8 +422,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
testRealmLoginPage.form().login("bburke@redhat.com", "password");
assertCurrentUrlEquals(inputPortal + "/secured/post");
waitForPageToLoad();
String pageSource = driver.getPageSource();
assertThat(pageSource, containsString("parameter=hello"));
assertPageContains("parameter=hello");
String logoutUri = OIDCLoginProtocolService.logoutUrl(authServerPage.createUriBuilder())
.queryParam(OAuth2Constants.REDIRECT_URI, customerPortal.toString())
@ -416,7 +439,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
Form form = new Form();
form.param("parameter", "hello");
String text = client.target(inputPortal + "/unsecured").request().post(Entity.form(form), String.class);
assertTrue(text.contains("parameter=hello"));
assertThat(text, containsString("parameter=hello"));
client.close();
}
@ -428,14 +451,13 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
testRealmLoginPage.form().login("bburke@redhat.com", "password");
assertCurrentUrlEquals(customerPortal);
String pageSource = driver.getPageSource();
assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
assertLogged();
// test SSO
productPortal.navigateTo();
assertCurrentUrlEquals(productPortal);
pageSource = driver.getPageSource();
assertTrue(pageSource.contains("iPhone") && pageSource.contains("iPad"));
assertPageContains("iPhone");
assertPageContains("iPad");
// View stats
List<Map<String, String>> stats = testRealmResource().getClientSessionStats();
@ -463,8 +485,6 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
customerPortal.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
// testRealmLoginPage.form().cancel();
// assertTrue(driver.getPageSource().contains("Error Page"));
}
@Test
@ -474,26 +494,23 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
testRealmLoginPage.form().login("bburke@redhat.com", "password");
assertCurrentUrlEquals(customerPortal);
String pageSource = driver.getPageSource();
assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
assertLogged();
// test SSO
productPortal.navigateTo();
assertCurrentUrlEquals(productPortal);
pageSource = driver.getPageSource();
assertTrue(pageSource.contains("iPhone") && pageSource.contains("iPad"));
assertPageContains("iPhone");
assertPageContains("iPad");
// back
customerPortal.navigateTo();
assertCurrentUrlEquals(customerPortal);
pageSource = driver.getPageSource();
Assert.assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
assertLogged();
// test logout
driver.navigate().to(customerPortal + "/logout");
pageSource = driver.getPageSource();
assertTrue(pageSource.contains("servlet logout ok"));
assertTrue(pageSource.contains("servlet logout from database ok"));
WaitUtils.waitUntilElement(By.id("customer_portal_logout")).is().present();
WaitUtils.waitUntilElement(By.id("customer_database_logout")).is().present();
customerPortal.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
@ -509,8 +526,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
testRealmLoginPage.form().login("bburke@redhat.com", "password");
assertCurrentUrlEquals(customerPortal);
String pageSource = driver.getPageSource();
assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
assertLogged();
RealmRepresentation demoRealmRep = testRealmResource().toRepresentation();
int originalIdle = demoRealmRep.getSsoSessionIdleTimeout();
@ -537,9 +553,6 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
testRealmLoginPage.form().login("bburke@redhat.com", "password");
log.info("Current url: " + driver.getCurrentUrl());
assertCurrentUrlEquals(customerPortal);
String pageSource = driver.getPageSource();
log.info(pageSource);
Assert.assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
RealmRepresentation demoRealmRep = testRealmResource().toRepresentation();
int originalIdle = demoRealmRep.getSsoSessionIdleTimeout();
@ -571,8 +584,6 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
testRealmLoginPage.form().login("bburke@redhat.com", "password");
assertCurrentUrlEquals(customerPortal);
String pageSource = driver.getPageSource();
Assert.assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
RealmRepresentation demoRealmRep = testRealmResource().toRepresentation();
int originalMax = demoRealmRep.getSsoSessionMaxLifespan();
@ -610,19 +621,23 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
public void testNullBearerTokenCustomErrorPage() {
Client client = ClientBuilder.newClient();
WebTarget target = client.target(customerDbErrorPage.toString());
Response response = target.request().get();
assertEquals(401, response.getStatus());
String errorPageResponse = response.readEntity(String.class);
assertThat(errorPageResponse, allOf(containsString("reason=NO_BEARER_TOKEN"), containsString("Error Page")));
assertThat(errorPageResponse, containsString("Error Page"));
assertThat(errorPageResponse, containsString(OIDCAuthenticationError.Reason.NO_BEARER_TOKEN.toString()));
response.close();
response = target.request().header(HttpHeaders.AUTHORIZATION, "Bearer null").get();
assertEquals(401, response.getStatus());
errorPageResponse = response.readEntity(String.class);
assertThat(errorPageResponse, allOf(containsString("Error Page"), containsString("reason=INVALID_TOKEN")));
assertThat(errorPageResponse, containsString("Error Page"));
assertThat(errorPageResponse, containsString(OIDCAuthenticationError.Reason.INVALID_TOKEN.toString()));
response.close();
client.close();
}
@ -684,8 +699,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
testRealmLoginPage.form().login("bburke@redhat.com", "password");
assertCurrentUrlEquals(securePortal);
String pageSource = driver.getPageSource();
assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
assertLogged();
// test logout
String logoutUri = OIDCLoginProtocolService.logoutUrl(authServerPage.createUriBuilder())
.queryParam(OAuth2Constants.REDIRECT_URI, securePortal.toString()).build("demo").toString();
@ -705,8 +719,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
assertThat("Cookie CUSTOM_JSESSION_ID_NAME should exist", driver.manage().getCookieNamed("CUSTOM_JSESSION_ID_NAME"), notNullValue());
String pageSource = driver.getPageSource();
assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
assertLogged();
// test logout
String logoutUri = OIDCLoginProtocolService.logoutUrl(authServerPage.createUriBuilder())
.queryParam(OAuth2Constants.REDIRECT_URI, securePortalWithCustomSessionConfig.toString()).build("demo").toString();
@ -757,9 +770,8 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
testRealmLoginPage.form().login("bburke@redhat.com", "password");
waitForPageToLoad();
assertCurrentUrlEquals(securePortal);
String pageSource = driver.getPageSource();
assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
assertCurrentUrlStartsWith(securePortal);
assertLogged();
int currentTime = Time.currentTime();
setAdapterAndServerTimeOffset(10, securePortal.toString());
@ -771,7 +783,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
testRealmLoginPage.form().login("bburke@redhat.com", "password");
AccessToken token = tokenMinTTLPage.getAccessToken();
int authTime = token.getAuthTime();
Assert.assertTrue(currentTime + 10 <= authTime);
assertThat(authTime, is(greaterThanOrEqualTo(currentTime + 10)));
// Revert times
setAdapterAndServerTimeOffset(0, tokenMinTTLPage.toString());
@ -799,40 +811,46 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
demoRealmRep.setSupportedLocales(Stream.of("en", "de").collect(Collectors.toSet()));
testRealmResource().update(demoRealmRep);
// test login with ui_locales to de+en
String portalUri = securePortal.getUriBuilder().build().toString();
String appUri = securePortal.getUriBuilder().queryParam(OAuth2Constants.UI_LOCALES_PARAM, "de en").build().toString();
URLUtils.navigateToUri(appUri, true);
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
// check the ui_locales param is there
Map<String, String> parameters = getQueryFromUrl(driver.getCurrentUrl());
assertEquals("de en", parameters.get(OAuth2Constants.UI_LOCALES_PARAM));
// check that the page is in german
String pageSource = driver.getPageSource();
assertTrue(pageSource.contains("Passwort"));
testRealmLoginPage.form().login("bburke@redhat.com", "password");
// check no ui_locales in the final url adapter url
assertCurrentUrlEquals(portalUri);
pageSource = driver.getPageSource();
assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
// logout
String logoutUri = OIDCLoginProtocolService.logoutUrl(authServerPage.createUriBuilder())
.queryParam(OAuth2Constants.REDIRECT_URI, securePortal.toString()).build("demo").toString();
driver.navigate().to(logoutUri);
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
securePortal.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
try {
// test login with ui_locales to de+en
String portalUri = securePortal.getUriBuilder().build().toString();
UriBuilder uriBuilder = securePortal.getUriBuilder();
String appUri = uriBuilder.clone().queryParam(OAuth2Constants.UI_LOCALES_PARAM, "de en").build().toString();
URLUtils.navigateToUri(appUri, true);
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
// check the ui_locales param is there
Map<String, String> parameters = getQueryFromUrl(driver.getCurrentUrl());
assertThat(parameters.get(OAuth2Constants.UI_LOCALES_PARAM), allOf(containsString("de"), containsString("en")));
demoRealmRep.setInternationalizationEnabled(enabled);
demoRealmRep.setDefaultLocale(defaultLocale);
demoRealmRep.setSupportedLocales(locales);
testRealmResource().update(demoRealmRep);
String appUriDe = uriBuilder.clone().queryParam(OAuth2Constants.UI_LOCALES_PARAM, "de").build().toString();
URLUtils.navigateToUri(appUriDe, true);
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
// check that the page is in german
assertPageContains("Passwort");
testRealmLoginPage.form().login("bburke@redhat.com", "password");
// check no ui_locales in the final url adapter url
assertCurrentUrlEquals(portalUri);
assertLogged();
// logout
String logoutUri = OIDCLoginProtocolService.logoutUrl(authServerPage.createUriBuilder())
.queryParam(OAuth2Constants.REDIRECT_URI, securePortal.toString()).build("demo").toString();
driver.navigate().to(logoutUri);
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
securePortal.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
} finally {
demoRealmRep.setInternationalizationEnabled(enabled);
demoRealmRep.setDefaultLocale(defaultLocale);
demoRealmRep.setSupportedLocales(locales);
testRealmResource().update(demoRealmRep);
}
}
@Test
public void testBasicAuth() {
String value = "hello";
Client client = ClientBuilder.newBuilder().newClient();
Client client = ClientBuilder.newClient();
//pause(1000000);
@ -877,10 +895,8 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
oAuthGrantPage.accept();
String pageSource = driver.getPageSource();
waitForPageToLoad();
assertThat(pageSource, containsString("Bill Burke"));
assertThat(pageSource, containsString("Stian Thorgersen"));
assertLogged();
String userId = ApiUtil.findUserByUsername(testRealmResource(), "bburke@redhat.com").getId();
@ -937,9 +953,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
testRealmLoginPage.form().login("bburke@redhat.com", "password");
waitForPageToLoad();
String pageSource = driver.getPageSource();
assertThat(pageSource, containsString("Bill Burke"));
assertThat(pageSource, containsString("Stian Thorgersen"));
assertLogged();
String userId = ApiUtil.findUserByUsername(testRealmResource(), "bburke@redhat.com").getId();
@ -998,7 +1012,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
Matcher matcher = pattern.matcher(serverLogContent);
assertTrue(matcher.find());
assertTrue(serverLogContent.contains("User '" + bburke.getId() + "' invoking '" + appServerUrl + "customer-db/' on client 'customer-db'"));
assertThat(serverLogContent, containsString("User '" + bburke.getId() + "' invoking '" + appServerUrl + "customer-db/' on client 'customer-db'"));
} else {
log.info("Checking app server log on app-server: \"" + System.getProperty("app.server") + "\" is not supported.");
}
@ -1008,7 +1022,7 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
public void testWithoutKeycloakConf() {
customerPortalNoConf.navigateTo();
String pageSource = driver.getPageSource();
assertTrue(pageSource.contains("Forbidden") || pageSource.contains("HTTP Status 401"));
assertThat(pageSource, anyOf(containsString("Forbidden"), containsString("HTTP Status 401")));
}
// KEYCLOAK-3509
@ -1022,14 +1036,13 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
System.out.println("Current url: " + driver.getCurrentUrl());
assertCurrentUrlEquals(productPortal + "?encodeTest=a%3Cb");
String pageSource = driver.getPageSource();
Assert.assertTrue(pageSource.contains("iPhone"));
Assert.assertTrue(pageSource.contains("uriEncodeTest=true"));
assertPageContains("iPhone");
assertPageContains("uriEncodeTest=true");
driver.navigate().to(productPortal.getInjectedUrl());
assertCurrentUrlEquals(productPortal);
System.out.println(driver.getCurrentUrl());
Assert.assertTrue(driver.getPageSource().contains("uriEncodeTest=false"));
assertPageContains("uriEncodeTest=false");
// test logout
String logoutUri = OIDCLoginProtocolService.logoutUrl(authServerPage.createUriBuilder())
@ -1078,19 +1091,19 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
// Redirect client to login page if it's not an XHR
response = target.request().header("X-Requested-With", "Dont-Know").header(HttpHeaders.ACCEPT, "*/*").get();
Assert.assertEquals(302, response.getStatus());
Assert.assertTrue(response.getHeaderString(HttpHeaders.LOCATION).contains("response_type=code"));
Assert.assertThat(response.getHeaderString(HttpHeaders.LOCATION), containsString("response_type=code"));
response.close();
// Redirect client to login page if client explicitely understands HTML responses
response = target.request().header(HttpHeaders.ACCEPT, "text/html,application/xhtml+xml,application/xml;q=0.9").get();
Assert.assertEquals(302, response.getStatus());
Assert.assertTrue(response.getHeaderString(HttpHeaders.LOCATION).contains("response_type=code"));
Assert.assertThat(response.getHeaderString(HttpHeaders.LOCATION), containsString("response_type=code"));
response.close();
// Redirect client to login page if client understands all response types
response = target.request().header(HttpHeaders.ACCEPT, "*/*").get();
Assert.assertEquals(302, response.getStatus());
Assert.assertTrue(response.getHeaderString(HttpHeaders.LOCATION).contains("response_type=code"));
Assert.assertThat(response.getHeaderString(HttpHeaders.LOCATION), containsString("response_type=code"));
response.close();
client.close();
}

View file

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.testsuite.adapter.undertow.servlet;
package org.keycloak.testsuite.adapter.servlet;
import java.net.URL;
import java.util.List;
@ -29,14 +29,11 @@ import org.keycloak.protocol.oidc.OIDCLoginProtocolService;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
import org.keycloak.testsuite.adapter.page.MultiTenant;
import org.keycloak.testsuite.adapter.servlet.ErrorServlet;
import org.keycloak.testsuite.adapter.servlet.MultiTenantResolver;
import org.keycloak.testsuite.adapter.servlet.MultiTenantServlet;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.util.URLAssert;
import org.keycloak.testsuite.util.WaitUtils;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.APP_SERVER_DEFAULT;
import static org.keycloak.testsuite.util.IOUtil.loadRealm;
/**
@ -44,7 +41,7 @@ import static org.keycloak.testsuite.util.IOUtil.loadRealm;
*
* @author Juraci Paixão Kröhling <juraci at kroehling.de>
*/
@AppServerContainer(APP_SERVER_DEFAULT)
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
public class MultiTenancyTest extends AbstractServletsAdapterTest {
@Page

View file

@ -58,12 +58,15 @@ import org.keycloak.testsuite.adapter.page.CustomerDb;
import org.keycloak.testsuite.adapter.page.SecurePortal;
import org.keycloak.testsuite.adapter.page.TokenMinTTLPage;
import org.keycloak.testsuite.admin.ApiUtil;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.util.URLAssert;
import org.openqa.selenium.By;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
@ -75,7 +78,9 @@ import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
*
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
public abstract class AbstractOIDCPublicKeyRotationAdapterTest extends AbstractServletsAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class OIDCPublicKeyRotationAdapterTest extends AbstractServletsAdapterTest {
@Page
private SecurePortal securePortal;

View file

@ -1,5 +1,7 @@
package org.keycloak.testsuite.adapter.servlet;
import javax.ws.rs.core.UriBuilder;
import java.util.List;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.shrinkwrap.api.spec.WebArchive;
@ -14,6 +16,8 @@ import org.keycloak.testsuite.AssertEvents;
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
import org.keycloak.testsuite.adapter.filter.AdapterActionsFilter;
import org.keycloak.testsuite.adapter.page.OfflineToken;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.pages.AccountApplicationsPage;
import org.keycloak.testsuite.pages.LoginPage;
import org.keycloak.testsuite.pages.OAuthGrantPage;
@ -21,13 +25,9 @@ import org.keycloak.testsuite.util.ClientManager;
import org.keycloak.util.TokenUtil;
import org.openqa.selenium.By;
import javax.ws.rs.core.UriBuilder;
import java.util.List;
import static org.keycloak.testsuite.auth.page.AuthRealm.TEST;
import static org.keycloak.testsuite.util.IOUtil.loadRealm;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlDoesntStartWith;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
import static org.keycloak.testsuite.util.WaitUtils.pause;
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
@ -35,7 +35,9 @@ import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
/**
* @author <a href="mailto:bruno@abstractj.org">Bruno Oliveira</a>.
*/
public abstract class AbstractOfflineServletsAdapterTest extends AbstractServletsAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class OfflineServletsAdapterTest extends AbstractServletsAdapterTest {
@Rule
public AssertEvents events = new AssertEvents(this);
@ -79,8 +81,8 @@ public abstract class AbstractOfflineServletsAdapterTest extends AbstractServlet
assertCurrentUrlStartsWith(offlineTokenPage);
Assert.assertEquals(offlineTokenPage.getRefreshToken().getType(), TokenUtil.TOKEN_TYPE_OFFLINE);
Assert.assertEquals(offlineTokenPage.getRefreshToken().getExpiration(), 0);
Assert.assertEquals(TokenUtil.TOKEN_TYPE_OFFLINE, offlineTokenPage.getRefreshToken().getType());
Assert.assertEquals(0, offlineTokenPage.getRefreshToken().getExpiration());
String accessTokenId = offlineTokenPage.getAccessToken().getId();
String refreshTokenId = offlineTokenPage.getRefreshToken().getId();
@ -115,7 +117,7 @@ public abstract class AbstractOfflineServletsAdapterTest extends AbstractServlet
loginPage.login("test-user@localhost", "password");
assertCurrentUrlStartsWith(offlineTokenPage);
Assert.assertEquals(offlineTokenPage.getRefreshToken().getType(), TokenUtil.TOKEN_TYPE_OFFLINE);
Assert.assertEquals(TokenUtil.TOKEN_TYPE_OFFLINE, offlineTokenPage.getRefreshToken().getType());
// Assert refresh works with increased time
setAdapterAndServerTimeOffset(9999);
@ -129,11 +131,11 @@ public abstract class AbstractOfflineServletsAdapterTest extends AbstractServlet
accountAppPage.open();
List<String> additionalGrants = accountAppPage.getApplications().get("offline-client").getAdditionalGrants();
Assert.assertEquals(additionalGrants.size(), 1);
Assert.assertEquals(additionalGrants.get(0), "Offline Token");
Assert.assertEquals(1, additionalGrants.size());
Assert.assertEquals("Offline Token", additionalGrants.get(0));
accountAppPage.revokeGrant("offline-client");
pause(500);
Assert.assertEquals(accountAppPage.getApplications().get("offline-client").getAdditionalGrants().size(), 0);
Assert.assertEquals(0, accountAppPage.getApplications().get("offline-client").getAdditionalGrants().size());
events.expect(EventType.REVOKE_GRANT)
.client("account").detail(Details.REVOKED_CLIENT, "offline-client").assertEvent();
@ -171,7 +173,7 @@ public abstract class AbstractOfflineServletsAdapterTest extends AbstractServlet
oauthGrantPage.accept();
assertCurrentUrlStartsWith(offlineTokenPage);
Assert.assertEquals(offlineTokenPage.getRefreshToken().getType(), TokenUtil.TOKEN_TYPE_OFFLINE);
Assert.assertEquals(TokenUtil.TOKEN_TYPE_OFFLINE, offlineTokenPage.getRefreshToken().getType());
accountAppPage.open();
AccountApplicationsPage.AppEntry offlineClient = accountAppPage.getApplications().get("offline-client");

View file

@ -4,15 +4,17 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.annotation.UseServletFilter;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
/**
* @author mhajas
*/
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
@UseServletFilter(filterName = "saml-filter", filterClass = "org.keycloak.adapters.saml.servlet.SamlFilter",
filterDependency = "org.keycloak:keycloak-saml-servlet-filter-adapter")
public abstract class AbstractSAMLFilterServletAdapterTest extends AbstractSAMLServletsAdapterTest {
public class SAMLFilterServletAdapterTest extends SAMLServletsAdapterTest {
@Before
public void checkRoles() {

View file

@ -34,6 +34,8 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
@ -57,7 +59,6 @@ import org.keycloak.representations.idm.ProtocolMapperRepresentation;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.representations.idm.RoleRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.saml.BaseSAML2BindingBuilder;
import org.keycloak.saml.SAML2ErrorResponseBuilder;
import org.keycloak.saml.common.constants.JBossSAMLURIConstants;
import org.keycloak.saml.common.util.XmlKeyInfoKeyNameTransformer;
@ -66,6 +67,8 @@ import org.keycloak.services.resources.RealmsResource;
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
import org.keycloak.testsuite.adapter.page.*;
import org.keycloak.testsuite.admin.ApiUtil;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.auth.page.login.Login;
import org.keycloak.testsuite.auth.page.login.SAMLIDPInitiatedLogin;
import org.keycloak.testsuite.page.AbstractPage;
@ -123,8 +126,6 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@ -149,7 +150,8 @@ import static org.keycloak.testsuite.util.WaitUtils.*;
/**
* @author mhajas
*/
public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class SAMLServletsAdapterTest extends AbstractServletsAdapterTest {
@Page
protected BadClientSalesPostSigServlet badClientSalesPostSigServletPage;
@ -666,7 +668,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
@Test
public void salesMetadataTest() throws Exception {
Document doc = loadXML(AbstractSAMLServletsAdapterTest.class.getResourceAsStream("/adapter-test/keycloak-saml/sp-metadata.xml"));
Document doc = loadXML(SAMLServletsAdapterTest.class.getResourceAsStream("/adapter-test/keycloak-saml/sp-metadata.xml"));
modifyDocElementAttribute(doc, "SingleLogoutService", "Location", "8080", System.getProperty("app.server.http.port", null));
modifyDocElementAttribute(doc, "AssertionConsumerService", "Location", "8080", System.getProperty("app.server.http.port", null));

View file

@ -1,20 +1,40 @@
/*
* 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.servlet;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
import org.keycloak.testsuite.adapter.filter.AdapterActionsFilter;
import org.keycloak.testsuite.adapter.page.CustomerDb;
import org.keycloak.testsuite.adapter.page.CustomerPortalSubsystem;
import org.keycloak.testsuite.adapter.page.ProductPortalSubsystem;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import static org.junit.Assert.assertTrue;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
/**
* OIDC adapter test specific for JBoss-based containers.
* @author tkyjovsk
*/
public abstract class AbstractJBossOIDCServletsAdapterTest extends AbstractDemoServletsAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class SecuredDeploymentsAdapterTest extends AbstractServletsAdapterTest {
@Page
private CustomerPortalSubsystem customerPortalSubsystem;
@ -32,16 +52,24 @@ public abstract class AbstractJBossOIDCServletsAdapterTest extends AbstractDemoS
return servletDeployment(ProductPortalSubsystem.DEPLOYMENT_NAME, ProductServlet.class);
}
@Deployment(name = CustomerDb.DEPLOYMENT_NAME)
protected static WebArchive customerDb() {
return servletDeployment(CustomerDb.DEPLOYMENT_NAME, AdapterActionsFilter.class, CustomerDatabaseServlet.class);
}
@Test
public void testSecureDeployments() {
public void testSecuredDeployments() {
customerPortalSubsystem.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
testRealmLoginPage.form().login("bburke@redhat.com", "password");
assertTrue(driver.getPageSource().contains("Bill Burke") && driver.getPageSource().contains("Stian Thorgersen"));
String pageSource = driver.getPageSource();
log.debug(pageSource);
assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));
productPortalSubsystem.navigateTo();
assertCurrentUrlEquals(productPortalSubsystem);
String pageSource = driver.getPageSource();
pageSource = driver.getPageSource();
log.debug(pageSource);
assertTrue(pageSource.contains("iPhone") && pageSource.contains("iPad"));
}

View file

@ -22,7 +22,6 @@ import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.After;
import org.junit.Assume;
import org.junit.Test;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.resource.ClientResource;
@ -34,6 +33,8 @@ import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
import org.keycloak.testsuite.adapter.page.SessionPortal;
import org.keycloak.testsuite.auth.page.account.Sessions;
import org.keycloak.testsuite.auth.page.login.Login;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.util.SecondBrowser;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
@ -48,7 +49,9 @@ import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLo
*
* @author tkyjovsk
*/
public abstract class AbstractSessionServletAdapterTest extends AbstractServletsAdapterTest {
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class SessionServletAdapterTest extends AbstractServletsAdapterTest {
@Page
private SessionPortal sessionPortalPage;
@ -81,9 +84,9 @@ public abstract class AbstractSessionServletAdapterTest extends AbstractServlets
@Test
public void testSingleSessionInvalidated() {
loginAndCheckSession(driver, testRealmLoginPage);
loginAndCheckSession(testRealmLoginPage);
// cannot pass to loginAndCheckSession becayse loginPage is not working together with driver2, therefore copypasta
// cannot pass to loginAndCheckSession because loginPage is not working together with driver2, therefore copypasta
driver2.navigate().to(sessionPortalPage.toString());
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage, driver2);
driver2.findElement(By.id("username")).sendKeys("bburke@redhat.com");
@ -121,7 +124,7 @@ public abstract class AbstractSessionServletAdapterTest extends AbstractServlets
//KEYCLOAK-741
@Test
public void testSessionInvalidatedAfterFailedRefresh() {
assumeNotOnUndertow();
assumeNotOnAppServerUndertow();
RealmRepresentation testRealmRep = testRealmResource().toRepresentation();
ClientResource sessionPortalRes = null;
for (ClientRepresentation clientRep : testRealmResource().clients().findAll()) {
@ -136,7 +139,7 @@ public abstract class AbstractSessionServletAdapterTest extends AbstractServlets
testRealmResource().update(testRealmRep);
// Login
loginAndCheckSession(driver, testRealmLoginPage);
loginAndCheckSession(testRealmLoginPage);
// Logout
String logoutUri = OIDCLoginProtocolService.logoutUrl(authServerPage.createUriBuilder())
@ -160,7 +163,7 @@ public abstract class AbstractSessionServletAdapterTest extends AbstractServlets
@Test
public void testAdminApplicationLogout() {
// login as bburke
loginAndCheckSession(driver, testRealmLoginPage);
loginAndCheckSession(testRealmLoginPage);
// logout mposolda with admin client
UserRepresentation mposolda = testRealmResource().users().search("mposolda", null, null, null, null, null).get(0);
@ -179,23 +182,16 @@ public abstract class AbstractSessionServletAdapterTest extends AbstractServlets
//KEYCLOAK-1216
@Test
public void testAccountManagementSessionsLogout() {
assumeNotOnUndertow();
assumeNotOnAppServerUndertow();
// login as bburke
loginAndCheckSession(driver, testRealmLoginPage);
loginAndCheckSession(testRealmLoginPage);
testRealmSessions.navigateTo();
testRealmSessions.logoutAll();
// Assert I need to login again (logout was propagated to the app)
loginAndCheckSession(driver, testRealmLoginPage);
loginAndCheckSession(testRealmLoginPage);
}
private void assumeNotOnUndertow() {
Assume.assumeFalse("Not stable on app-server-undertow when whole adapter package is tested. "
+ "It throws: KC-SERVICES0057: Logout for client 'session-portal' failed\n"
+ "org.apache.http.NoHttpResponseException: localhost:8280 failed to respond",
System.getProperty("app.server", "undertow").equals("undertow"));
}
private void loginAndCheckSession(WebDriver driver, Login login) {
private void loginAndCheckSession(Login login) {
sessionPortalPage.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
login.form().login("bburke@redhat.com", "password");

View file

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.testsuite.adapter.undertow.servlet;
package org.keycloak.testsuite.adapter.servlet;
import java.io.IOException;
import java.net.URISyntaxException;
@ -48,15 +48,14 @@ import org.keycloak.testsuite.AbstractAuthTest;
import org.keycloak.testsuite.adapter.AbstractAdapterTest;
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
import org.keycloak.testsuite.adapter.page.ProductPortal;
import org.keycloak.testsuite.adapter.servlet.ProductServlet;
import org.keycloak.testsuite.admin.ApiUtil;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.auth.page.login.PageWithLoginUrl;
import org.keycloak.testsuite.federation.UserMapStorageFactory;
import org.keycloak.testsuite.pages.ConsentPage;
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.APP_SERVER_DEFAULT;
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
@ -65,7 +64,8 @@ import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLo
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
@AppServerContainer(APP_SERVER_DEFAULT)
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
public class UserStorageConsentTest extends AbstractServletsAdapterTest {
@Page
@ -144,6 +144,8 @@ public class UserStorageConsentTest extends AbstractServletsAdapterTest {
*/
@Test
public void testLogin() throws Exception {
assumeNotOnAppServerUndertow();
testingClient.server().run(UserStorageConsentTest::setupConsent);
UserRepresentation memuser = new UserRepresentation();
memuser.setUsername("memuser");

View file

@ -0,0 +1,55 @@
/*
* Copyright 2017 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.servlet.cluster;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.TargetsContainer;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.keycloak.testsuite.adapter.AbstractSAMLAdapterClusteredTest;
import org.keycloak.testsuite.adapter.page.EmployeeServletDistributable;
import org.keycloak.testsuite.adapter.servlet.SendUsernameServlet;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import static org.keycloak.testsuite.adapter.AbstractServletsAdapterTest.samlServletDeployment;
/**
*
* @author hmlnarik
*/
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY_CLUSTER)
public class SAMLAdapterClusterTest extends AbstractSAMLAdapterClusteredTest {
@TargetsContainer(value = TARGET_CONTAINER_NODE_1)
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME, managed = false)
protected static WebArchive employee() {
return samlServletDeployment(EmployeeServletDistributable.DEPLOYMENT_NAME, EmployeeServletDistributable.DEPLOYMENT_NAME + "/WEB-INF/web.xml", SendUsernameServlet.class);
}
@TargetsContainer(value = TARGET_CONTAINER_NODE_2)
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME + "_2", managed = false)
protected static WebArchive employee2() {
return employee();
}
@Override
protected void prepareServerDirectories() throws Exception {
prepareServerDirectory("standalone-cluster", "standalone-" + NODE_1_NAME);
prepareServerDirectory("standalone-cluster", "standalone-" + NODE_2_NAME);
}
}

View file

@ -0,0 +1,78 @@
/*
* Copyright 2017 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.servlet.crossdc;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.TargetsContainer;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.keycloak.testsuite.adapter.page.EmployeeServletDistributable;
import org.keycloak.testsuite.adapter.AbstractSAMLAdapterClusteredTest;
import org.keycloak.testsuite.adapter.servlet.SendUsernameServlet;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.keycloak.testsuite.adapter.AbstractServletsAdapterTest.samlServletDeployment;
/**
*
* @author hmlnarik
*/
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY_CLUSTER)
public class SAMLAdapterCrossDCTest extends AbstractSAMLAdapterClusteredTest {
@BeforeClass
public static void checkCrossDcTest() {
Assume.assumeThat("Seems not to be running cross-DC tests", System.getProperty("cache.server"), not(is("undefined")));
}
private static final String SESSION_CACHE_NAME = EmployeeServletDistributable.DEPLOYMENT_NAME + "-cache";
private static final String JBOSS_WEB_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<jboss-web>\n"
+ " <replication-config>\n"
+ " <replication-granularity>SESSION</replication-granularity>\n"
+ " <cache-name>" + "web." + SESSION_CACHE_NAME + "</cache-name>\n"
+ " </replication-config>\n"
+ "</jboss-web>";
@TargetsContainer(value = TARGET_CONTAINER_NODE_1)
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME, managed = false)
protected static WebArchive employee() {
return samlServletDeployment(EmployeeServletDistributable.DEPLOYMENT_NAME,
EmployeeServletDistributable.DEPLOYMENT_NAME + "/WEB-INF/web.xml",
SendUsernameServlet.class)
.addAsWebInfResource(new StringAsset(JBOSS_WEB_XML), "jboss-web.xml");
}
@TargetsContainer(value = TARGET_CONTAINER_NODE_2)
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME + "_2", managed = false)
protected static WebArchive employee2() {
return employee();
}
@Override
protected void prepareServerDirectories() throws Exception {
prepareServerDirectory("standalone-crossdc", "standalone-" + NODE_1_NAME);
prepareServerDirectory("standalone-crossdc", "standalone-" + NODE_2_NAME);
}
}

View file

@ -1,39 +0,0 @@
/*
* 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.undertow.servlet;
import org.junit.Ignore;
import org.junit.Test;
import org.keycloak.testsuite.adapter.servlet.AbstractBrokerLinkAndTokenExchangeTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.APP_SERVER_DEFAULT;
/**
*
* @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
*/
@AppServerContainer(APP_SERVER_DEFAULT)
public class UndertowBrokerLinkAndTokenExchangeTest extends AbstractBrokerLinkAndTokenExchangeTest {
@Test
@Ignore(value = "testing purpose")
public void testUi() throws Exception {
Thread.sleep(1000000000);
}
}

View file

@ -1,39 +0,0 @@
/*
* 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.undertow.servlet;
import org.junit.Ignore;
import org.junit.Test;
import org.keycloak.testsuite.adapter.servlet.AbstractClientInitiatedAccountLinkTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.APP_SERVER_DEFAULT;
/**
*
* @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
*/
@AppServerContainer(APP_SERVER_DEFAULT)
public class UndertowClientInitiatedAccountLinkTest extends AbstractClientInitiatedAccountLinkTest {
@Test
@Ignore
public void testUi() throws Exception {
Thread.sleep(1000000000);
}
}

View file

@ -1,30 +0,0 @@
/*
* 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.undertow.servlet;
import org.keycloak.testsuite.adapter.servlet.AbstractDemoFilterServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.APP_SERVER_DEFAULT;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@AppServerContainer(APP_SERVER_DEFAULT)
public class UndertowDemoFilterServletAdapterTest extends AbstractDemoFilterServletAdapterTest {
}

View file

@ -1,31 +0,0 @@
/*
* 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.undertow.servlet;
import org.keycloak.testsuite.adapter.servlet.AbstractDemoServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.APP_SERVER_DEFAULT;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@AppServerContainer(APP_SERVER_DEFAULT)
public class UndertowDemoServletsAdapterTest extends AbstractDemoServletsAdapterTest {
}

View file

@ -1,30 +0,0 @@
/*
* 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.undertow.servlet;
import org.keycloak.testsuite.adapter.servlet.AbstractOIDCPublicKeyRotationAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.APP_SERVER_DEFAULT;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@AppServerContainer(APP_SERVER_DEFAULT)
public class UndertowOIDCPublicKeyRotationAdapterTest extends AbstractOIDCPublicKeyRotationAdapterTest {
}

View file

@ -1,30 +0,0 @@
/*
* 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.undertow.servlet;
import org.keycloak.testsuite.adapter.servlet.AbstractOfflineServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.APP_SERVER_DEFAULT;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@AppServerContainer(APP_SERVER_DEFAULT)
public class UndertowOfflineServletsAdapterTest extends AbstractOfflineServletsAdapterTest {
}

View file

@ -1,28 +0,0 @@
/*
* Copyright 2018 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.undertow.servlet;
import org.keycloak.testsuite.adapter.servlet.AbstractSessionFilterServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.APP_SERVER_DEFAULT;
@AppServerContainer(APP_SERVER_DEFAULT)
public class UndertowSessionFilterServletAdapterTest extends AbstractSessionFilterServletAdapterTest {
}

View file

@ -1,30 +0,0 @@
/*
* 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.undertow.servlet;
import org.keycloak.testsuite.adapter.servlet.AbstractSessionServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.APP_SERVER_DEFAULT;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@AppServerContainer(APP_SERVER_DEFAULT)
public class UndertowSessionServletAdapterTest extends AbstractSessionServletAdapterTest {
}

View file

@ -67,6 +67,13 @@
<url-pattern>/error.html</url-pattern>
</web-resource-collection>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Unsecured</web-resource-name>
<url-pattern>/unsecured/*</url-pattern>
</web-resource-collection>
</security-constraint>
<login-config>
<auth-method>KEYCLOAK</auth-method>

View file

@ -233,7 +233,7 @@
<property name="jbossHome">${cache.server.home}</property>
<property name="serverConfig">clustered-1.xml</property>
<property name="jbossArguments">
-Djboss.socket.binding.port-offset=${cache.server.port.offset}
-Djboss.socket.binding.port-offset=${cache.server.1.port.offset}
-Djboss.default.multicast.address=234.56.78.99
-Djboss.node.name=cache-server-dc-1
${adapter.test.props}

View file

@ -16,7 +16,7 @@
*/
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractClientInitiatedAccountLinkTest;
import org.keycloak.testsuite.adapter.servlet.ClientInitiatedAccountLinkTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
@ -24,6 +24,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
*/
@AppServerContainer("app-server-eap")
public class EAPClientInitiatedAccountLinkTest extends AbstractClientInitiatedAccountLinkTest {
public class EAPClientInitiatedAccountLinkTest extends ClientInitiatedAccountLinkTest {
}

View file

@ -1,6 +1,6 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractJBossOIDCServletsAdapterTest;
import org.keycloak.testsuite.adapter.servlet.DemoServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
@ -8,6 +8,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author tkyjovsk
*/
@AppServerContainer("app-server-eap")
public class EAPOIDCAdapterTest extends AbstractJBossOIDCServletsAdapterTest {
public class EAPOIDCAdapterTest extends DemoServletsAdapterTest {
}

View file

@ -17,12 +17,12 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractOIDCPublicKeyRotationAdapterTest;
import org.keycloak.testsuite.adapter.servlet.OIDCPublicKeyRotationAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@AppServerContainer("app-server-eap")
public class EAPOIDCPublicKeyRotationAdapterTest extends AbstractOIDCPublicKeyRotationAdapterTest {
public class EAPOIDCPublicKeyRotationAdapterTest extends OIDCPublicKeyRotationAdapterTest {
}

View file

@ -1,6 +1,6 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSessionServletAdapterTest;
import org.keycloak.testsuite.adapter.servlet.SessionServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
@ -8,6 +8,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author tkyjovsk
*/
@AppServerContainer("app-server-eap")
public class EAPOIDCSessionAdapterTest extends AbstractSessionServletAdapterTest {
public class EAPOIDCSessionAdapterTest extends SessionServletAdapterTest {
}

View file

@ -1,11 +1,11 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractOfflineServletsAdapterTest;
import org.keycloak.testsuite.adapter.servlet.OfflineServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author <a href="mailto:bruno@abstractj.org">Bruno Oliveira</a>.
*/
@AppServerContainer("app-server-eap")
public class EAPOfflineServletsAdapterTest extends AbstractOfflineServletsAdapterTest {
public class EAPOfflineServletsAdapterTest extends OfflineServletsAdapterTest {
}

View file

@ -1,12 +1,12 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSAMLServletsAdapterTest;
import org.keycloak.testsuite.adapter.servlet.SAMLServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author mhajas
*/
@AppServerContainer("app-server-eap")
public class EAPSAMLAdapterTest extends AbstractSAMLServletsAdapterTest {
public class EAPSAMLAdapterTest extends SAMLServletsAdapterTest {
}

View file

@ -1,11 +1,11 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSAMLFilterServletAdapterTest;
import org.keycloak.testsuite.adapter.servlet.SAMLFilterServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author mhajas
*/
@AppServerContainer("app-server-eap")
public class EAPSAMLFilterAdapterTest extends AbstractSAMLFilterServletAdapterTest {
public class EAPSAMLFilterAdapterTest extends SAMLFilterServletAdapterTest {
}

View file

@ -0,0 +1,13 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.SecuredDeploymentsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-eap")
public class EAPSecuredDeploymentsAdapterTest extends SecuredDeploymentsAdapterTest {
}

View file

@ -19,19 +19,12 @@ package org.keycloak.testsuite.adapter.cluster;
import org.keycloak.testsuite.adapter.page.EmployeeServletDistributable;
import org.keycloak.testsuite.arquillian.annotation.*;
import java.io.*;
import java.util.concurrent.TimeoutException;
import org.keycloak.testsuite.adapter.servlet.cluster.AbstractSAMLAdapterClusterTest;
import org.keycloak.testsuite.adapter.AbstractSAMLAdapterClusteredTest;
import org.keycloak.testsuite.adapter.servlet.SendUsernameServlet;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.TargetsContainer;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.wildfly.extras.creaper.core.*;
import org.wildfly.extras.creaper.core.online.*;
import org.wildfly.extras.creaper.core.online.operations.*;
import org.wildfly.extras.creaper.core.online.operations.admin.Administration;
/**
@ -39,7 +32,7 @@ import org.wildfly.extras.creaper.core.online.operations.admin.Administration;
* @author hmlnarik
*/
@AppServerContainer("app-server-eap")
public class EAPSAMLAdapterClusterTest extends AbstractSAMLAdapterClusterTest {
public class EAPSAMLAdapterClusterTest extends AbstractSAMLAdapterClusteredTest {
@TargetsContainer(value = "app-server-eap-" + NODE_1_NAME)
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME, managed = false)
@ -54,45 +47,9 @@ public class EAPSAMLAdapterClusterTest extends AbstractSAMLAdapterClusterTest {
}
@Override
protected void prepareWorkerNode(int nodeIndex, Integer managementPort) throws IOException, NumberFormatException, TimeoutException, InterruptedException {
log.infov("Preparing worker node ({0} @ {1})", nodeIndex, managementPort);
OnlineManagementClient clientWorkerNodeClient = ManagementClient.online(OnlineOptions
.standalone()
.hostAndPort("localhost", managementPort)
.build());
Administration administration = new Administration(clientWorkerNodeClient);
Operations op = new Operations(clientWorkerNodeClient);
Batch b = new Batch();
Address tcppingStack = Address
.subsystem("jgroups")
.and("stack", "tcpping");
b.add(tcppingStack);
b.add(tcppingStack.and("transport", "TCP"), Values.of("socket-binding", "jgroups-tcp"));
b.add(tcppingStack.and("protocol", "TCPPING"));
b.add(tcppingStack.and("protocol", "TCPPING").and("property", "initial_hosts"), Values.of("value", "localhost[" + (7600 + PORT_OFFSET_NODE_1) + "],localhost[" + (7600 + PORT_OFFSET_NODE_2) + "]"));
b.add(tcppingStack.and("protocol", "TCPPING").and("property", "port_range"), Values.of("value", "0"));
b.add(tcppingStack.and("protocol", "MERGE3"));
b.add(tcppingStack.and("protocol", "FD_SOCK"), Values.of("socket-binding", "jgroups-tcp-fd"));
b.add(tcppingStack.and("protocol", "FD"));
b.add(tcppingStack.and("protocol", "VERIFY_SUSPECT"));
b.add(tcppingStack.and("protocol", "pbcast.NAKACK2"));
b.add(tcppingStack.and("protocol", "UNICAST3"));
b.add(tcppingStack.and("protocol", "pbcast.STABLE"));
b.add(tcppingStack.and("protocol", "pbcast.GMS"));
b.add(tcppingStack.and("protocol", "MFC"));
b.add(tcppingStack.and("protocol", "FRAG2"));
b.writeAttribute(Address.subsystem("jgroups").and("channel", "ee"), "stack", "tcpping");
op.batch(b);
op.add(Address.extension("org.keycloak.keycloak-saml-adapter-subsystem"), Values.of("module", "org.keycloak.keycloak-saml-adapter-subsystem"));
op.add(Address.subsystem("keycloak-saml"));
//clientWorkerNodeClient.execute("reload");
administration.reload();
log.infov("Worker node ({0}) Prepared", managementPort);
protected void prepareServerDirectories() throws Exception {
prepareServerDirectory("standalone-cluster", "standalone-" + NODE_1_NAME);
prepareServerDirectory("standalone-cluster", "standalone-" + NODE_2_NAME);
}
}

View file

@ -16,7 +16,7 @@
*/
package org.keycloak.testsuite.adapter.example.authorization;
import org.keycloak.testsuite.adapter.example.authorization.AbstractDefaultAuthzConfigAdapterTest;
import org.keycloak.testsuite.adapter.example.authorization.DefaultAuthzConfigAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
@ -25,6 +25,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
*/
@AppServerContainer("app-server-eap")
//@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class EAPDefaultAuthzConfigAdapterTest extends AbstractDefaultAuthzConfigAdapterTest {
public class EAPDefaultAuthzConfigAdapterTest extends DefaultAuthzConfigAdapterTest {
}

View file

@ -25,6 +25,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
*/
@RunAsClient
@AppServerContainer("app-server-eap")
public class EAPPermissiveModeAdapterTest extends AbstractPermissiveModeAdapterTest {
public class EAPPermissiveModeAdapterTest extends PermissiveModeAdapterTest {
}

View file

@ -7,6 +7,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author tkyjovsk
*/
@AppServerContainer("app-server-eap")
public class EAPCorsExampleAdapterTest extends AbstractCorsExampleAdapterTest {
public class EAPCorsExampleAdapterTest extends CorsExampleAdapterTest {
}

View file

@ -16,7 +16,7 @@
*/
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractClientInitiatedAccountLinkTest;
import org.keycloak.testsuite.adapter.servlet.ClientInitiatedAccountLinkTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
@ -24,6 +24,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
*/
@AppServerContainer("app-server-eap6")
public class EAP6ClientInitiatedAccountLinkTest extends AbstractClientInitiatedAccountLinkTest {
public class EAP6ClientInitiatedAccountLinkTest extends ClientInitiatedAccountLinkTest {
}

View file

@ -1,6 +1,6 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractJBossOIDCServletsAdapterTest;
import org.keycloak.testsuite.adapter.servlet.DemoServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
@ -8,6 +8,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author tkyjovsk
*/
@AppServerContainer("app-server-eap6")
public class EAP6OIDCAdapterTest extends AbstractJBossOIDCServletsAdapterTest {
public class EAP6OIDCAdapterTest extends DemoServletsAdapterTest {
}

View file

@ -17,12 +17,12 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractOIDCPublicKeyRotationAdapterTest;
import org.keycloak.testsuite.adapter.servlet.OIDCPublicKeyRotationAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@AppServerContainer("app-server-eap6")
public class EAP6OIDCPublicKeyRotationAdapterTest extends AbstractOIDCPublicKeyRotationAdapterTest {
public class EAP6OIDCPublicKeyRotationAdapterTest extends OIDCPublicKeyRotationAdapterTest {
}

View file

@ -1,6 +1,6 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSessionServletAdapterTest;
import org.keycloak.testsuite.adapter.servlet.SessionServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
@ -8,6 +8,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author tkyjovsk
*/
@AppServerContainer("app-server-eap6")
public class EAP6OIDCSessionAdapterTest extends AbstractSessionServletAdapterTest {
public class EAP6OIDCSessionAdapterTest extends SessionServletAdapterTest {
}

View file

@ -1,11 +1,11 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractOfflineServletsAdapterTest;
import org.keycloak.testsuite.adapter.servlet.OfflineServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author <a href="mailto:bruno@abstractj.org">Bruno Oliveira</a>.
*/
@AppServerContainer("app-server-eap6")
public class EAP6OfflineServletsAdapterTest extends AbstractOfflineServletsAdapterTest {
public class EAP6OfflineServletsAdapterTest extends OfflineServletsAdapterTest {
}

View file

@ -1,12 +1,12 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSAMLServletsAdapterTest;
import org.keycloak.testsuite.adapter.servlet.SAMLServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author mhajas
*/
@AppServerContainer("app-server-eap6")
public class EAP6SAMLAdapterTest extends AbstractSAMLServletsAdapterTest {
public class EAP6SAMLAdapterTest extends SAMLServletsAdapterTest {
}

View file

@ -1,11 +1,11 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSAMLFilterServletAdapterTest;
import org.keycloak.testsuite.adapter.servlet.SAMLFilterServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author mhajas
*/
@AppServerContainer("app-server-eap6")
public class EAP6SAMLFilterAdapterTest extends AbstractSAMLFilterServletAdapterTest {
public class EAP6SAMLFilterAdapterTest extends SAMLFilterServletAdapterTest {
}

View file

@ -0,0 +1,13 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.SecuredDeploymentsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-wildfly10")
public class EAP6SecuredDeploymentsAdapterTest extends SecuredDeploymentsAdapterTest {
}

View file

@ -22,26 +22,28 @@ import org.keycloak.testsuite.arquillian.annotation.*;
import java.io.*;
import java.util.concurrent.TimeoutException;
import org.keycloak.testsuite.adapter.servlet.cluster.AbstractSAMLAdapterClusterTest;
import org.keycloak.testsuite.adapter.AbstractSAMLAdapterClusteredTest;
import org.keycloak.testsuite.adapter.servlet.SendUsernameServlet;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.TargetsContainer;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Before;
import org.wildfly.extras.creaper.core.*;
import org.wildfly.extras.creaper.core.online.*;
import org.wildfly.extras.creaper.core.online.operations.*;
import org.wildfly.extras.creaper.core.online.operations.admin.Administration;
import static org.keycloak.testsuite.adapter.AbstractServletsAdapterTest.samlServletDeployment;
import org.keycloak.testsuite.arquillian.ContainerInfo;
/**
*
* @author hmlnarik
*/
@AppServerContainer("app-server-eap6")
public class EAP6SAMLAdapterClusterTest extends AbstractSAMLAdapterClusterTest {
public class EAP6SAMLAdapterClusterTest extends AbstractSAMLAdapterClusteredTest {
@TargetsContainer(value = "app-server-eap6-" + NODE_1_NAME)
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME, managed = false)
@ -55,7 +57,6 @@ public class EAP6SAMLAdapterClusterTest extends AbstractSAMLAdapterClusterTest {
return employee();
}
@Override
protected void prepareWorkerNode(int nodeIndex, Integer managementPort) throws IOException, NumberFormatException, TimeoutException, InterruptedException {
log.infov("Preparing worker node ({0} @ {1})", nodeIndex, managementPort);
@ -102,5 +103,27 @@ public class EAP6SAMLAdapterClusterTest extends AbstractSAMLAdapterClusterTest {
log.infov("Worker node ({0}) Prepared", managementPort);
}
@Before
@Override
public void startServers() throws Exception {
prepareServerDirectories();
for (ContainerInfo containerInfo : testContext.getAppServerBackendsInfo()) {
controller.start(containerInfo.getQualifier());
}
prepareWorkerNode(0, Integer.valueOf(System.getProperty("app.server.1.management.port")));
prepareWorkerNode(1, Integer.valueOf(System.getProperty("app.server.2.management.port")));
deployer.deploy(EmployeeServletDistributable.DEPLOYMENT_NAME);
deployer.deploy(EmployeeServletDistributable.DEPLOYMENT_NAME + "_2");
}
@Override
protected void prepareServerDirectories() throws Exception {
prepareServerDirectory("standalone-cluster", "standalone-" + NODE_1_NAME);
prepareServerDirectory("standalone-cluster", "standalone-" + NODE_2_NAME);
}
}

View file

@ -21,7 +21,7 @@ import org.keycloak.testsuite.arquillian.annotation.*;
import java.io.*;
import org.keycloak.testsuite.adapter.servlet.cluster.AbstractSAMLAdapterClusterTest;
import org.keycloak.testsuite.adapter.AbstractSAMLAdapterClusteredTest;
import org.keycloak.testsuite.adapter.servlet.SendUsernameServlet;
import org.apache.commons.lang3.math.NumberUtils;
@ -40,7 +40,9 @@ import org.wildfly.extras.creaper.core.online.operations.*;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import org.junit.Before;
import static org.keycloak.testsuite.adapter.AbstractServletsAdapterTest.samlServletDeployment;
import org.keycloak.testsuite.arquillian.ContainerInfo;
/**
*
@ -48,14 +50,14 @@ import static org.keycloak.testsuite.adapter.AbstractServletsAdapterTest.samlSer
*/
@Ignore("Infinispan version 5 does not support remote cache events, hence this test is left here for development purposes only")
@AppServerContainer("app-server-eap6")
public class EAP6SAMLAdapterCrossDCTest extends AbstractSAMLAdapterClusterTest {
public class EAP6SAMLAdapterCrossDCTest extends AbstractSAMLAdapterClusteredTest {
@BeforeClass
public static void checkCrossDcTest() {
Assume.assumeThat("Seems not to be running cross-DC tests", System.getProperty("cache.server"), not(is("undefined")));
}
protected static final int PORT_OFFSET_CACHE_1 = NumberUtils.toInt(System.getProperty("cache.server.port.offset"), 0);
protected static final int PORT_OFFSET_CACHE_1 = NumberUtils.toInt(System.getProperty("cache.server.1.port.offset"), 0);
protected static final int CACHE_HOTROD_PORT_CACHE_1 = 11222 + PORT_OFFSET_CACHE_1;
protected static final int PORT_OFFSET_CACHE_2 = NumberUtils.toInt(System.getProperty("cache.server.2.port.offset"), 0);
protected static final int CACHE_HOTROD_PORT_CACHE_2 = 11222 + PORT_OFFSET_CACHE_2;
@ -96,7 +98,6 @@ public class EAP6SAMLAdapterCrossDCTest extends AbstractSAMLAdapterClusterTest {
return employee();
}
@Override
protected void prepareWorkerNode(int nodeIndex, Integer managementPort) throws IOException, CliException, NumberFormatException {
log.infov("Preparing worker node ({0} @ {1})", nodeIndex, managementPort);
@ -166,4 +167,26 @@ public class EAP6SAMLAdapterCrossDCTest extends AbstractSAMLAdapterClusterTest {
log.infov("Worker node ({0}) Prepared", managementPort);
}
@Before
@Override
public void startServers() throws Exception {
prepareServerDirectories();
for (ContainerInfo containerInfo : testContext.getAppServerBackendsInfo()) {
controller.start(containerInfo.getQualifier());
}
prepareWorkerNode(0, Integer.valueOf(System.getProperty("app.server.1.management.port")));
prepareWorkerNode(1, Integer.valueOf(System.getProperty("app.server.2.management.port")));
deployer.deploy(EmployeeServletDistributable.DEPLOYMENT_NAME);
deployer.deploy(EmployeeServletDistributable.DEPLOYMENT_NAME + "_2");
}
@Override
protected void prepareServerDirectories() throws Exception {
prepareServerDirectory("standalone-crossdc", "standalone-" + NODE_1_NAME);
prepareServerDirectory("standalone-crossdc", "standalone-" + NODE_2_NAME);
}
}

View file

@ -23,6 +23,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author tkyjovsk
*/
@AppServerContainer("app-server-eap6")
public class EAP6DefaultAuthzConfigAdapterTest extends AbstractDefaultAuthzConfigAdapterTest {
public class EAP6DefaultAuthzConfigAdapterTest extends DefaultAuthzConfigAdapterTest {
}

View file

@ -25,6 +25,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
*/
@RunAsClient
@AppServerContainer("app-server-eap6")
public class EAP6PermissiveModeAdapterTest extends AbstractPermissiveModeAdapterTest {
public class EAP6PermissiveModeAdapterTest extends PermissiveModeAdapterTest {
}

View file

@ -7,5 +7,5 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author tkyjovsk
*/
@AppServerContainer("app-server-eap6")
public class EAP6CorsExampleAdapterTest extends AbstractCorsExampleAdapterTest {
public class EAP6CorsExampleAdapterTest extends CorsExampleAdapterTest {
}

View file

@ -83,12 +83,6 @@
<module>eap6</module>
</modules>
</profile>
<profile>
<id>app-server-wildfly</id>
<modules>
<module>wildfly</module>
</modules>
</profile>
<profile>
<id>app-server-wildfly9</id>
<modules>

View file

@ -1,6 +1,6 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractJBossOIDCServletsAdapterTest;
import org.keycloak.testsuite.adapter.servlet.DemoServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
@ -8,6 +8,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author tkyjovsk
*/
@AppServerContainer("app-server-remote")
public class RemoteOIDCAdapterTest extends AbstractJBossOIDCServletsAdapterTest {
public class RemoteOIDCAdapterTest extends DemoServletsAdapterTest {
}

View file

@ -1,6 +1,6 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSessionServletAdapterTest;
import org.keycloak.testsuite.adapter.servlet.SessionServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
@ -8,6 +8,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author tkyjovsk
*/
@AppServerContainer("app-server-remote")
public class RemoteOIDCSessionAdapterTest extends AbstractSessionServletAdapterTest {
public class RemoteOIDCSessionAdapterTest extends SessionServletAdapterTest {
}

View file

@ -1,11 +1,11 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractOfflineServletsAdapterTest;
import org.keycloak.testsuite.adapter.servlet.OfflineServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author <a href="mailto:bruno@abstractj.org">Bruno Oliveira</a>.
*/
@AppServerContainer("app-server-remote")
public class RemoteOfflineServletsAdapterTest extends AbstractOfflineServletsAdapterTest {
public class RemoteOfflineServletsAdapterTest extends OfflineServletsAdapterTest {
}

View file

@ -1,12 +1,12 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSAMLServletsAdapterTest;
import org.keycloak.testsuite.adapter.servlet.SAMLServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author mhajas
*/
@AppServerContainer("app-server-remote")
public class RemoteSAMLAdapterTest extends AbstractSAMLServletsAdapterTest {
public class RemoteSAMLAdapterTest extends SAMLServletsAdapterTest {
}

View file

@ -1,11 +1,11 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSAMLFilterServletAdapterTest;
import org.keycloak.testsuite.adapter.servlet.SAMLFilterServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author mhajas
*/
@AppServerContainer("app-server-remote")
public class RemoteSAMLFilterAdapterTest extends AbstractSAMLFilterServletAdapterTest {
public class RemoteSAMLFilterAdapterTest extends SAMLFilterServletAdapterTest {
}

View file

@ -23,6 +23,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
* @author tkyjovsk
*/
@AppServerContainer("app-server-remote")
public class RemoteDefaultAuthzConfigAdapterTest extends AbstractDefaultAuthzConfigAdapterTest {
public class RemoteDefaultAuthzConfigAdapterTest extends DefaultAuthzConfigAdapterTest {
}

View file

@ -25,6 +25,6 @@ import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
*/
@RunAsClient
@AppServerContainer("app-server-remote")
public class RemoteServletAuthzAdapterTest extends AbstractServletAuthzAdapterTest {
public class RemoteServletAuthzAdapterTest extends ServletAuthzAdapterTest {
}

View file

@ -1,59 +0,0 @@
<?xml version="1.0"?>
<!--
~ 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.
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-adapters-jboss</artifactId>
<version>4.0.0.Final-SNAPSHOT</version>
</parent>
<artifactId>integration-arquillian-tests-adapters-wildfly</artifactId>
<name>Adapter Tests - JBoss - Wildfly</name>
<dependencies>
<dependency>
<groupId>org.wildfly.extras.creaper</groupId>
<artifactId>creaper-core</artifactId>
<scope>test</scope>
<version>1.6.1</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-controller-client</artifactId>
<scope>test</scope>
<version>${wildfly.core.version}</version>
</dependency>
</dependencies>
<properties>
<app.server>wildfly</app.server>
</properties>
</project>

View file

@ -1,29 +0,0 @@
/*
* 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;
import org.keycloak.testsuite.adapter.servlet.AbstractClientInitiatedAccountLinkTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
*/
@AppServerContainer("app-server-wildfly")
public class WildflyClientInitiatedAccountLinkTest extends AbstractClientInitiatedAccountLinkTest {
}

View file

@ -1,13 +0,0 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractJBossOIDCServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-wildfly")
public class WildflyOIDCAdapterTest extends AbstractJBossOIDCServletsAdapterTest {
}

View file

@ -1,12 +0,0 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractDemoFilterServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* Created by zschwarz on 9/14/16.
*/
@AppServerContainer("app-server-wildfly")
public class WildflyOIDCFilterAdapterTest extends AbstractDemoFilterServletAdapterTest{
}

View file

@ -1,28 +0,0 @@
/*
* 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;
import org.keycloak.testsuite.adapter.servlet.AbstractOIDCPublicKeyRotationAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@AppServerContainer("app-server-wildfly")
public class WildflyOIDCPublicKeyRotationAdapterTest extends AbstractOIDCPublicKeyRotationAdapterTest {
}

View file

@ -1,13 +0,0 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSessionServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-wildfly")
public class WildflyOIDCSessionAdapterTest extends AbstractSessionServletAdapterTest {
}

View file

@ -1,11 +0,0 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractOfflineServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author <a href="mailto:bruno@abstractj.org">Bruno Oliveira</a>.
*/
@AppServerContainer("app-server-wildfly")
public class WildflyOfflineServletsAdapterTest extends AbstractOfflineServletsAdapterTest {
}

View file

@ -1,12 +0,0 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSAMLServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author mhajas
*/
@AppServerContainer("app-server-wildfly")
public class WildflySAMLAdapterTest extends AbstractSAMLServletsAdapterTest {
}

View file

@ -1,11 +0,0 @@
package org.keycloak.testsuite.adapter;
import org.keycloak.testsuite.adapter.servlet.AbstractSAMLFilterServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author mhajas
*/
@AppServerContainer("app-server-wildfly")
public class WildflySAMLFilterAdapterTest extends AbstractSAMLFilterServletAdapterTest {
}

View file

@ -1,99 +0,0 @@
/*
* Copyright 2017 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.cluster;
import org.keycloak.testsuite.adapter.page.EmployeeServletDistributable;
import org.keycloak.testsuite.arquillian.annotation.*;
import java.io.*;
import java.util.concurrent.TimeoutException;
import org.keycloak.testsuite.adapter.servlet.cluster.AbstractSAMLAdapterClusterTest;
import org.keycloak.testsuite.adapter.servlet.SendUsernameServlet;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.TargetsContainer;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.wildfly.extras.creaper.core.*;
import org.wildfly.extras.creaper.core.online.*;
import org.wildfly.extras.creaper.core.online.operations.*;
import org.wildfly.extras.creaper.core.online.operations.admin.Administration;
import static org.keycloak.testsuite.adapter.AbstractServletsAdapterTest.samlServletDeployment;
/**
*
* @author hmlnarik
*/
@AppServerContainer("app-server-wildfly")
public class WildflySAMLAdapterClusterTest extends AbstractSAMLAdapterClusterTest {
@TargetsContainer(value = "app-server-wildfly-" + NODE_1_NAME)
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME, managed = false)
protected static WebArchive employee() {
return samlServletDeployment(EmployeeServletDistributable.DEPLOYMENT_NAME, EmployeeServletDistributable.DEPLOYMENT_NAME + "/WEB-INF/web.xml", SendUsernameServlet.class);
}
@TargetsContainer(value = "app-server-wildfly-" + NODE_2_NAME)
@Deployment(name = EmployeeServletDistributable.DEPLOYMENT_NAME + "_2", managed = false)
protected static WebArchive employee2() {
return employee();
}
@Override
protected void prepareWorkerNode(int nodeIndex, Integer managementPort) throws IOException, NumberFormatException, TimeoutException, InterruptedException {
log.infov("Preparing worker node ({0} @ {1})", nodeIndex, managementPort);
OnlineManagementClient clientWorkerNodeClient = ManagementClient.online(OnlineOptions
.standalone()
.hostAndPort("localhost", managementPort)
.build());
Administration administration = new Administration(clientWorkerNodeClient);
Operations op = new Operations(clientWorkerNodeClient);
Batch b = new Batch();
Address tcppingStack = Address
.subsystem("jgroups")
.and("stack", "tcpping");
b.add(tcppingStack);
b.add(tcppingStack.and("transport", "TCP"), Values.of("socket-binding", "jgroups-tcp"));
b.add(tcppingStack.and("protocol", "TCPPING"));
b.add(tcppingStack.and("protocol", "TCPPING").and("property", "initial_hosts"), Values.of("value", "localhost[" + (7600 + PORT_OFFSET_NODE_1) + "],localhost[" + (7600 + PORT_OFFSET_NODE_2) + "]"));
b.add(tcppingStack.and("protocol", "TCPPING").and("property", "port_range"), Values.of("value", "0"));
b.add(tcppingStack.and("protocol", "MERGE3"));
b.add(tcppingStack.and("protocol", "FD_SOCK"), Values.of("socket-binding", "jgroups-tcp-fd"));
b.add(tcppingStack.and("protocol", "FD"));
b.add(tcppingStack.and("protocol", "VERIFY_SUSPECT"));
b.add(tcppingStack.and("protocol", "pbcast.NAKACK2"));
b.add(tcppingStack.and("protocol", "UNICAST3"));
b.add(tcppingStack.and("protocol", "pbcast.STABLE"));
b.add(tcppingStack.and("protocol", "pbcast.GMS"));
b.add(tcppingStack.and("protocol", "MFC"));
b.add(tcppingStack.and("protocol", "FRAG2"));
b.writeAttribute(Address.subsystem("jgroups").and("channel", "ee"), "stack", "tcpping");
op.batch(b);
op.add(Address.extension("org.keycloak.keycloak-saml-adapter-subsystem"), Values.of("module", "org.keycloak.keycloak-saml-adapter-subsystem"));
op.add(Address.subsystem("keycloak-saml"));
//clientWorkerNodeClient.execute("reload");
administration.reload();
log.infov("Worker node ({0}) Prepared", managementPort);
}
}

Some files were not shown because too many files have changed in this diff Show more