Remove redundant servers from the testsuite

Closes #29089

Signed-off-by: Douglas Palmer <dpalmer@redhat.com>
This commit is contained in:
Douglas Palmer 2024-04-25 10:05:01 -07:00 committed by Marek Posolda
parent 02e2ebf258
commit 8d4d5c1c54
142 changed files with 3 additions and 4918 deletions

View file

@ -23,9 +23,5 @@
ifeval::[{project_community}==true]
* Service Provider Interfaces (SPI) - A number of SPIs to enable customizing various aspects of the server. Authentication flows, user federation providers,
protocol mappers and many more.
* Client adapters for JavaScript applications, WildFly, JBoss EAP, Tomcat, Spring, etc.
endif::[]
ifeval::[{project_product}==true]
* Client adapters for JavaScript applications, JBoss EAP, etc.
endif::[]
* Supports any platform/language that has an OpenID Connect Relying Party library or SAML 2.0 Service Provider library.

View file

@ -125,7 +125,6 @@
<undertow-jakarta.version>2.3.2.Final</undertow-jakarta.version>
<wildfly-elytron.version>2.2.3.Final</wildfly-elytron.version>
<elytron.undertow-server.version>1.9.0.Final</elytron.undertow-server.version>
<jetty94.version>9.4.40.v20210413</jetty94.version>
<woodstox.version>6.0.3</woodstox.version>
<wildfly.common.quarkus.aligned.version>1.5.4.Final-format-001</wildfly.common.quarkus.aligned.version>
<wildfly.common.wildfly.aligned.version>1.6.0.Final</wildfly.common.wildfly.aligned.version>
@ -148,7 +147,6 @@
<com.apicatalog.titanium-json-ld.version>1.3.3</com.apicatalog.titanium-json-ld.version>
<io.setl.rdf-urdna.version>1.1</io.setl.rdf-urdna.version>
<jetty9.version>${jetty94.version}</jetty9.version>
<liquibase.version>4.25.1</liquibase.version>
<!-- matches quarkus 3.7.1 version and but also the pax.web.version, hence we can't rely on quarkus bom -->
<osgi.version>6.0.0</osgi.version>
@ -212,10 +210,6 @@
<surefire.memory.settings>-Xms${surefire.memory.Xms} -Xmx${surefire.memory.Xmx} -XX:MetaspaceSize=${surefire.memory.metaspace} -XX:MaxMetaspaceSize=${surefire.memory.metaspace.max}</surefire.memory.settings>
<surefire.system.args></surefire.system.args>
<!-- Tomcat versions -->
<tomcat8.version>8.5.76</tomcat8.version>
<tomcat9.version>9.0.16</tomcat9.version>
<!-- webauthn support -->
<webauthn4j.version>0.21.5.RELEASE</webauthn4j.version>
<org.apache.kerby.kerby-asn1.version>2.0.3</org.apache.kerby.kerby-asn1.version>

View file

@ -142,19 +142,6 @@ and add packages manually.
-Dtest=org.keycloak.testsuite.adapter.**.*Test
-Papp-server-undertow
### Jetty
At the moment we can run the testsuite with Jetty `9.4`.
Each version has its corresponding profile:
* Jetty `9.4`: `app-server-jetty94`
Here's how to run the tests with Jetty `9.4`:
mvn -f testsuite/integration-arquillian/pom.xml \
-Papp-server-jetty94 \
-Dtest=org.keycloak.testsuite.adapter.**.*Test
### Wildfly
# Run tests
@ -163,19 +150,6 @@ Here's how to run the tests with Jetty `9.4`:
-Papp-server-wildfly \
-Dtest=org.keycloak.testsuite.adapter.**
### Tomcat
We run testsuite with Tomcat 7, 8 and 9. For specific versions see properties `${tomcat[7,8,9].version}` in parent [pom.xml](../../pom.xml).
To run tests on Tomcat:
````
mvn -f testsuite/integration-arquillian/pom.xml \
clean install \
-Papp-server-tomcat[7,8,9] \
-Dtest=org.keycloak.testsuite.adapter.**
````
### JBoss Fuse 6.3
1) Download JBoss Fuse 6.3 to your filesystem. It can be downloaded from http://origin-repository.jboss.org/nexus/content/groups/m2-proxy/org/jboss/fuse/jboss-fuse-karaf

View file

@ -161,7 +161,6 @@ integration-arquillian
│ │
│ ├──app-server
│ │ ├──jboss (wildfly/eap/as)
│ │ ├──tomcat
│ │ └──karaf
│ │
│ └──wildfly-balancer

View file

@ -49,11 +49,8 @@
<arquillian-graphene.version>3.0.0-alpha.3</arquillian-graphene.version>
<arquillian-wildfly-container.version>3.0.1.Final</arquillian-wildfly-container.version>
<arquillian-wls-container.version>1.0.1.Final</arquillian-wls-container.version>
<arquillian-jetty9-container.version>1.0.0.CR3</arquillian-jetty9-container.version>
<arquillian-container-karaf.version>2.2.0.Final</arquillian-container-karaf.version>
<arquillian-infinispan-container.version>1.2.0.Beta3</arquillian-infinispan-container.version>
<arquillian-tomcat8-container-version>1.1.0.Final</arquillian-tomcat8-container-version>
<arquillian-tomcat9-container-version>1.1.0.Final</arquillian-tomcat9-container-version>
<undertow.version>${undertow-jakarta.version}</undertow.version>
<undertow-embedded.version>1.0.0.Final</undertow-embedded.version>
<version.org.wildfly.extras.creaper>1.6.1</version.org.wildfly.extras.creaper>

View file

@ -25,8 +25,6 @@ The artifacts are used by the Arquillian TestSuite.
- Wildfly 8, 9, 10
- EAP 6, 7
- Relative (Wildfly 10 / EAP 7)
- Tomcat
- Tomcat 7, 8, 9
### Load Balancer

View file

@ -27,9 +27,3 @@ Submodules are enabled with profiles: `-Papp-server-MODULE`
### SSL
Configures SSL in `standalone.xml`. See profile `ssl`.
## App Server - Tomcat
Submodules are enabled with profiles: `-Papp-server-MODULE`
### Modules
* __`tomcat8` Tomcat 8__
* __`tomcat9` Tomcat 9__

View file

@ -20,7 +20,6 @@ import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArch
import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.Archive;
import org.keycloak.testsuite.utils.annotation.UseServletFilter;
import org.keycloak.testsuite.utils.arquillian.DeploymentArchiveProcessorUtils;
/**
@ -47,12 +46,7 @@ public class WildflyDeploymentArchiveProcessor implements ApplicationArchiveProc
private void modifyWebXML(Archive<?> archive, TestClass testClass) {
if (!archive.contains(DeploymentArchiveProcessorUtils.WEBXML_PATH)) return;
if (!testClass.getJavaClass().isAnnotationPresent(UseServletFilter.class)) return;
if (!archive.contains(DeploymentArchiveProcessorUtils.JBOSS_DEPLOYMENT_XML_PATH)) return;
log.debug("Modifying WEB.XML in " + archive.getName() + " for Servlet Filter.");
DeploymentArchiveProcessorUtils.modifyWebXMLForServletFilter(archive, testClass);
DeploymentArchiveProcessorUtils.addFilterDependencies(archive, testClass);
}
private void modifyOIDCAdapterConfig(Archive<?> archive, String adapterConfigPath) {

View file

@ -1,79 +0,0 @@
<?xml version="1.0"?>
<!--
~ Copyright 2018 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
<?xml version="1.0"?>
~ 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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-jetty</artifactId>
<version>999.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers-app-server-jetty-94</artifactId>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-jetty-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-jetty-embedded-9</artifactId>
<version>${arquillian-jetty9-container.version}</version>
</dependency>
<!-- Server support -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty94.version}</version>
</dependency>
<!-- Deployer support -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>
<version>${jetty94.version}</version>
</dependency>
<!-- KeycloakJettyAuthenticator support -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jaas</artifactId>
<version>${jetty94.version}</version>
</dependency>
<!-- Web application annotations support -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>${jetty94.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-jetty-common</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<type>test-jar</type>
</dependency>
</dependencies>
<name>App Server - Jetty 9.4</name>
</project>

View file

@ -1,5 +0,0 @@
package org.keycloak.testsuite.arquillian.jetty;
public class Jetty94AppServerTest extends AbstractJettyAppServerTest {
}

View file

@ -1,132 +0,0 @@
<?xml version="1.0"?>
<!--
~ Copyright 2018 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
<?xml version="1.0"?>
~ 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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-jetty</artifactId>
<version>999.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<properties>
<resteasy.version>${resteasy-legacy.version}</resteasy.version>
</properties>
<artifactId>integration-arquillian-servers-app-server-jetty-common</artifactId>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-jetty-embedded-9</artifactId>
<version>${arquillian-jetty9-container.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-core</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
</dependency>
<!-- Server support -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty94.version}</version>
<optional>true</optional>
</dependency>
<!-- Deployer support -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>
<version>${jetty94.version}</version>
<optional>true</optional>
</dependency>
<!-- KeycloakJettyAuthenticator support -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jaas</artifactId>
<version>${jetty94.version}</version>
<optional>true</optional>
</dependency>
<!-- Web application annotations support -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<version>${jetty94.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>${jetty94.version}</version>
<optional>true</optional>
</dependency>
<!-- JSP Support -->
<!-- We can't use Jetty built-in support for JSPs since it conflicts with Undertow -->
<dependency>
<groupId>org.jboss.spec.javax.servlet.jsp</groupId>
<artifactId>jboss-jsp-api_2.3_spec</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
</dependency>
<!-- Test dependiencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<name>App Server - Jetty Common</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,15 +0,0 @@
package org.keycloak.testsuite.arquillian.jetty;
import org.jboss.arquillian.container.jetty.embedded_9.ArquillianAppProvider;
import org.jboss.shrinkwrap.api.Archive;
class JettyAppProvider extends ArquillianAppProvider {
public JettyAppProvider(JettyAppServerConfiguration config) {
super(config);
}
protected KeycloakAdapterApp createApp(final Archive<?> archive) {
return new KeycloakAdapterApp(super.createApp(archive), archive);
}
}

View file

@ -1,324 +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.arquillian.jetty;
import org.eclipse.jetty.annotations.AnnotationConfiguration;
import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.AppLifeCycle;
import org.eclipse.jetty.deploy.DeploymentManager;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlet.ServletMapping;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.webapp.WebAppContext;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
import org.jboss.arquillian.container.spi.client.container.DeploymentException;
import org.jboss.arquillian.container.spi.client.container.LifecycleException;
import org.jboss.arquillian.container.spi.client.protocol.ProtocolDescription;
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext;
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData;
import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet;
import org.jboss.logging.Logger;
import org.jboss.resteasy.core.ResteasyDeploymentImpl;
import org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher;
import org.jboss.resteasy.spi.ResteasyDeployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.asset.ClassAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.descriptor.api.Descriptor;
import org.keycloak.adapters.jetty.KeycloakJettyAuthenticator;
import org.keycloak.adapters.saml.jetty.KeycloakSamlAuthenticator;
import org.keycloak.testsuite.arquillian.jetty.saml.util.RestSamlApplicationConfig;
import org.keycloak.testsuite.utils.tls.TLSUtils;
import javax.ws.rs.Path;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
public class JettyAppServer implements DeployableContainer<JettyAppServerConfiguration> {
private static final Logger log = Logger.getLogger(MethodHandles.lookup().lookupClass());
private JettyAppServerConfiguration configuration;
private JettyAppProvider appProvider;
private DeploymentManager deployer;
private Server server;
Map<String, KeycloakAdapterApp> deployedApps = new ConcurrentHashMap<>();
@Override
public Class<JettyAppServerConfiguration> getConfigurationClass() {
return JettyAppServerConfiguration.class;
}
@Override
public void setup(JettyAppServerConfiguration configuration) {
this.configuration = configuration;
appProvider = new JettyAppProvider(this.configuration);
}
@Override
public void start() throws LifecycleException {
if (configuration == null) {
log.warn("Starting Jetty with default setup.");
setup(new JettyAppServerConfiguration());
}
long start = System.currentTimeMillis();
server = new Server(configuration.getBindHttpPort());
setupSSL();
ContextHandlerCollection contexts = new ContextHandlerCollection();
deployer = new DeploymentManager();
deployer.setContexts(contexts);
deployer.addAppProvider(appProvider);
server.addBean(deployer);
HandlerCollection handlers = new HandlerCollection();
handlers.addHandler(contexts);
handlers.addHandler(new DefaultHandler());
server.setHandler(handlers);
try {
server.start();
} catch (Exception e) {
throw new LifecycleException("Unable to start Jetty", e);
}
log.infof("App server started in %dms on http://%s:%d/", (System.currentTimeMillis() - start), configuration.getBindAddress(), configuration.getBindHttpPort());
}
private void setupSSL() {
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setSslContext(TLSUtils.initializeTLS());
ServerConnector connector = new ServerConnector(server);
connector.setPort(configuration.getBindHttpPort());
HttpConfiguration https = new HttpConfiguration();
ServerConnector sslConnector = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory, "http/1.1"),
new HttpConnectionFactory(https));
sslConnector.setPort(configuration.getBindHttpsPort());
server.setConnectors(new Connector[] { connector, sslConnector });
}
@Override
public void stop() throws LifecycleException {
try {
server.stop();
} catch (Exception e) {
throw new LifecycleException("Unable to stop Jetty", e);
}
log.info("App Server stopped.");
}
@Override
public ProtocolDescription getDefaultProtocol() {
return new ProtocolDescription("Servlet 3.1");
}
@Override
public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
log.info("Deploying archive " + archive.getName());
if (!(archive instanceof WebArchive)) {
throw new IllegalArgumentException("JettyContainer only supports WebArchives.");
}
WebArchive webArchive = (WebArchive) archive;
try {
KeycloakAdapterApp app = appProvider.createApp(webArchive);
WebAppContext webAppContext = (WebAppContext) app.getContextHandler();
addAdditionalConfigurations(webAppContext);
setContextRoot(webArchive, app, webAppContext);
if (app.usesOIDCAuthenticator()) {
addOIDCAuthenticator(webAppContext);
}
if (app.usesSAMLAuthenticator()) {
addSAMLAuthenticator(webAppContext);
}
if (app.usesJaxrs()) {
addRestEasyServlet(webArchive, webAppContext);
}
setEmbeddedClassloaderForDeployment(webAppContext);
deployer.addApp(app);
deployer.requestAppGoal(app, AppLifeCycle.STARTED);
deployedApps.put(archive.getId(), app);
HTTPContext httpContext = new HTTPContext(configuration.getBindAddress(), configuration.getBindHttpPort());
ServletHandler servletHandler = webAppContext.getServletHandler();
for (ServletHolder servlet : servletHandler.getServlets()) {
log.debugf("Servlet context mapping: %s => %s", servlet.getName(), servlet.getContextPath());
httpContext.add(new Servlet(servlet.getName(), servlet.getContextPath()));
}
if (log.isInfoEnabled()) {
for (ServletMapping mapping : server.getChildHandlerByClass(ServletHandler.class).getServletMappings()) {
log.debugf("Servlet mapping: %s => %s", mapping.getServletName(), Arrays.toString(mapping.getPathSpecs()));
}
}
return new ProtocolMetaData().addContext(httpContext);
} catch (Exception e) {
throw new DeploymentException("Unable to deploy archive", e);
}
}
private void addAdditionalConfigurations(WebAppContext webAppContext) {
List<String> configurations = new ArrayList<>();
configurations.add(AnnotationConfiguration.class.getName());
//due to Jetty incompatibility between 8 and 9, we need to use reflections here
try {
Method m = webAppContext.getClass().getDeclaredMethod("getDefaultConfigurationClasses", null);
configurations.addAll(Arrays.asList((String[]) m.invoke(webAppContext)));
} catch (Exception e) {
throw new IllegalStateException("Critical Jetty incompatibility detected", e);
}
webAppContext.setConfigurationClasses(configurations.toArray(new String[0]));
}
private void setContextRoot(WebArchive archive, KeycloakAdapterApp app, WebAppContext webAppContext) {
if ("ROOT.war".equals(archive.getName())) {
webAppContext.setContextPath("/");
} else {
webAppContext.setContextPath("/" + app.getApplicationName());
}
}
private void addRestEasyServlet(WebArchive archive, WebAppContext webAppContext) {
log.debug("Starting Resteasy deployment");
boolean addServlet = true;
ServletHolder resteasyServlet = new ServletHolder("javax.ws.rs.core.Application", new HttpServlet30Dispatcher());
String jaxrsApplication = getJaxRsApplication(archive);
Set<Class<?>> pathAnnotatedClasses = getPathAnnotatedClasses(archive);
if (jaxrsApplication != null) {
log.debug("App has an Application.class: " + jaxrsApplication);
resteasyServlet.setInitParameter("javax.ws.rs.Application", jaxrsApplication);
} else if (!pathAnnotatedClasses.isEmpty()) {
log.debug("App has @Path annotated classes: " + pathAnnotatedClasses);
ResteasyDeployment deployment = new ResteasyDeploymentImpl();
deployment.setApplication(new RestSamlApplicationConfig(pathAnnotatedClasses));
webAppContext.setAttribute(ResteasyDeployment.class.getName(), deployment);
} else {
log.debug("An application doesn't have Application.class, nor @Path annotated classes. Skipping Resteasy initialization.");
addServlet = false;
}
if (addServlet) {
// this should be /* in general. However Jetty 9.2 (this is bug specific to this version),
// can not merge two instances of javax.ws.rs.Application together (one from web.xml
// and the other one added here). In 9.1 and 9.4 this works fine.
// Once we stop supporting 9.2, this should replaced with /* and this comment should be removed.
webAppContext.addServlet(resteasyServlet, "/");
}
log.debug("Finished Resteasy deployment");
}
private String getJaxRsApplication(WebArchive archive) {
return archive.getContent(archivePath ->
archivePath.get().startsWith("/WEB-INF/classes/") && archivePath.get().endsWith("Application.class"))
.values().stream().findFirst().map(node -> node.getPath().get()).orElse(null);
}
private void addSAMLAuthenticator(WebAppContext webAppContext) {
webAppContext.getSecurityHandler().setAuthenticator(new KeycloakSamlAuthenticator());
}
private void addOIDCAuthenticator(WebAppContext webAppContext) {
webAppContext.getSecurityHandler().setAuthenticator(new KeycloakJettyAuthenticator());
}
private void setEmbeddedClassloaderForDeployment(WebAppContext webAppContext) {
ClassLoader parentCl = Thread.currentThread().getContextClassLoader();
webAppContext.setClassLoader(parentCl);
}
private Set<Class<?>> getPathAnnotatedClasses(WebArchive webArchive) {
return webArchive.getContent(archivePath ->
archivePath.get().startsWith("/WEB-INF/classes/") &&
archivePath.get().endsWith(".class")
).values().stream()
.filter(node -> node.getAsset() instanceof ClassAsset)
.map(node -> ((ClassAsset)node.getAsset()).getSource())
.filter(clazz -> clazz.isAnnotationPresent(Path.class))
.collect(Collectors.toSet());
}
@Override
public void undeploy(Archive<?> archive) {
log.info("Undeploying archive " + archive.getName());
App app = deployedApps.get(archive.getId());
if (app != null) {
deployer.requestAppGoal(app, AppLifeCycle.UNDEPLOYED);
} else {
log.warnf("Deployment '%s' (name=%s) not found", archive.getId(), archive.getName());
}
}
@Override
public void deploy(Descriptor descriptor) {
throw new UnsupportedOperationException("Not implemented");
}
@Override
public void undeploy(Descriptor descriptor) {
throw new UnsupportedOperationException("Not implemented");
}
public String getJettyVersion() {
return Server.getVersion();
}
/*
* This is a non-public method that should not be used. Only for testing.
*/
protected Server getServer() {
return server;
}
}

View file

@ -1,34 +0,0 @@
/*
* Copyright 2019 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.arquillian.jetty;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.core.spi.LoadableExtension;
import org.keycloak.testsuite.arquillian.jetty.container.JettyDeploymentArchiveProcessor;
public class JettyAppServerArquillianExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder builder) {
builder
.service(DeployableContainer.class, JettyAppServer.class)
.service(ApplicationArchiveProcessor.class, JettyDeploymentArchiveProcessor.class);
}
}

View file

@ -1,77 +0,0 @@
/*
* Copyright 2019 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.arquillian.jetty;
import org.jboss.arquillian.container.jetty.embedded_9.JettyEmbeddedConfiguration;
import org.jboss.arquillian.container.spi.ConfigurationException;
import org.jboss.arquillian.container.spi.client.container.ContainerConfiguration;
public class JettyAppServerConfiguration extends JettyEmbeddedConfiguration {
private int bindHttpPortOffset = 0;
private int bindHttpsPortOffset = 0;
private int bindHttpPort = 8280;
private int bindHttpsPort = 8643;
private String bindAddress = "localhost";
@Override
public void validate() throws ConfigurationException {
setBindHttpPort(bindHttpPort + bindHttpPortOffset);
setBindHttpsPort(bindHttpsPort + bindHttpsPortOffset);
}
public int getBindHttpPortOffset() {
return bindHttpPortOffset;
}
public void setBindHttpPortOffset(int bindHttpPortOffset) {
this.bindHttpPortOffset = bindHttpPortOffset;
}
public int getBindHttpsPortOffset() {
return bindHttpsPortOffset;
}
public void setBindHttpsPortOffset(int bindHttpsPortOffset) {
this.bindHttpsPortOffset = bindHttpsPortOffset;
}
public int getBindHttpPort() {
return bindHttpPort;
}
public void setBindHttpPort(int bindHttpPort) {
this.bindHttpPort = bindHttpPort;
}
public int getBindHttpsPort() {
return bindHttpsPort;
}
public void setBindHttpsPort(int bindHttpsPort) {
this.bindHttpsPort = bindHttpsPort;
}
public String getBindAddress() {
return bindAddress;
}
public void setBindAddress(String bindAddress) {
this.bindAddress = bindAddress;
}
}

View file

@ -1,92 +0,0 @@
package org.keycloak.testsuite.arquillian.jetty;
import org.apache.commons.io.IOUtils;
import org.eclipse.jetty.deploy.App;
import org.jboss.shrinkwrap.api.Archive;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class KeycloakAdapterApp extends App {
public static final String WEB_XML_PATH = "/WEB-INF/web.xml";
private static final Pattern modulePattern = Pattern.compile("<module-name>(.*)</module-name>");
private static final Pattern authMethodPattern = Pattern.compile("<auth-method>(.*)</auth-method>");
private final boolean usesOIDCAuthenticator;
private final boolean usesSAMLAuthenticator;
private final boolean usesJaxrs;
private final String applicationName;
public KeycloakAdapterApp(App app, Archive<?> archive) {
super(app.getDeploymentManager(), app.getAppProvider(), app.getOriginId());
boolean usesJaxRS = false;
boolean usesOIDCAuthenticator = false;
boolean usesSAMLAuthenticator = false;
String applicationName = archive.getName();
if (archive.contains(WEB_XML_PATH)) {
try {
try (InputStream is = archive.get(WEB_XML_PATH).getAsset().openStream()) {
String webXml = IOUtils.toString(is, StandardCharsets.UTF_8);
usesJaxRS = webXml.contains("javax.ws.rs.core.Application");
for(String line : webXml.split("\n")) {
line = line.trim();
if (!usesOIDCAuthenticator && !usesSAMLAuthenticator) {
Matcher m = authMethodPattern.matcher(line);
if (m.find()) {
String authMethod = m.group(1);
switch (authMethod) {
case "KEYCLOAK": {
usesOIDCAuthenticator = true;
break;
}
case "KEYCLOAK-SAML": {
usesSAMLAuthenticator = true;
break;
}
default: {
throw new IllegalArgumentException("Unknown auth-method" + authMethod);
}
}
}
}
Matcher m = modulePattern.matcher(line.trim());
if (m.find()) {
applicationName = m.group(1);
}
}
}
} catch (IOException ignored) {
}
}
this.applicationName = applicationName;
this.usesJaxrs = usesJaxRS;
this.usesOIDCAuthenticator = usesOIDCAuthenticator;
this.usesSAMLAuthenticator = usesSAMLAuthenticator;
}
public boolean usesOIDCAuthenticator() {
return usesOIDCAuthenticator;
}
public boolean usesJaxrs() {
return usesJaxrs;
}
public boolean usesSAMLAuthenticator() {
return usesSAMLAuthenticator;
}
public String getApplicationName() {
return applicationName;
}
}

View file

@ -1,25 +0,0 @@
package org.keycloak.testsuite.arquillian.jetty.container;
import org.eclipse.jetty.util.Jetty;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public enum AppServerVersion {
INSTANCE;
private String appServerVersion;
AppServerVersion() {
Pattern versionExtraction = Pattern.compile("(\\d\\.\\d).*");
Matcher m = versionExtraction.matcher(Jetty.VERSION);
if (!m.find()) {
throw new IllegalStateException("Could not parse Jetty version: " + Jetty.VERSION);
}
appServerVersion = m.group(1).replaceAll("\\.", "");
}
public String getAppServerVersion() {
return appServerVersion;
}
}

View file

@ -1,83 +0,0 @@
/*
* Copyright 2019 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.arquillian.jetty.container;
import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.keycloak.testsuite.arquillian.container.AppServerContainerProvider;
import org.keycloak.testsuite.arquillian.jetty.JettyAppServer;
import java.util.ArrayList;
import java.util.List;
public class JettyAppServerProvider implements AppServerContainerProvider {
private Node configuration;
private static final String containerName = "jetty" + AppServerVersion.INSTANCE.getAppServerVersion();
@Override
public String getName() {
return containerName;
}
@Override
public List<Node> getContainers() {
List<Node> containers = new ArrayList<>();
containers.add(standaloneContainer());
//not supported yet
// containers.add(haNodeContainer(1));
// containers.add(haNodeContainer(2));
return containers;
}
private void createChild(String name, String text) {
configuration.createChild("property").attribute("name", name).text(text);
}
private Node standaloneContainer() {
Node container = new Node("container");
container.attribute("mode", "manual");
container.attribute("qualifier", AppServerContainerProvider.APP_SERVER + "-" + containerName);
configuration = container.createChild("configuration");
createChild("enabled", "true");
createChild("bindAddress", "0.0.0.0");
createChild("bindHttpPort", "8280");
createChild("adapterImplClass", JettyAppServer.class.getName());
return container;
}
private Node haNodeContainer(int number) {
Node container = new Node("container");
container.attribute("mode", "manual");
container.attribute("qualifier", AppServerContainerProvider.APP_SERVER + "-" + containerName + "-ha-node-" + number);
configuration = container.createChild("configuration");
createChild("enabled", "true");
createChild("bindAddress", "localhost");
createChild("bindHttpPort", "8280");
createChild("bindHttpPortOffset", Integer.toString(number));
createChild("adapterImplClass", JettyAppServer.class.getName());
return container;
}
}

View file

@ -1,68 +0,0 @@
/*
* Copyright 2019 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.arquillian.jetty.container;
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.Archive;
import org.keycloak.testsuite.utils.annotation.UseServletFilter;
import org.keycloak.testsuite.utils.arquillian.DeploymentArchiveProcessorUtils;
public class JettyDeploymentArchiveProcessor implements ApplicationArchiveProcessor {
private final Logger log = Logger.getLogger(JettyDeploymentArchiveProcessor.class);
@Override
public void process(Archive<?> archive, TestClass testClass) {
if (DeploymentArchiveProcessorUtils.checkRunOnServerDeployment(archive)) return;
if (!System.getProperty("app.server", "jetty").contains("jetty")) return;
modifyWebXML(archive, testClass);
modifyOIDCAdapterConfig(archive, DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH);
modifySAMLAdapterConfig(archive, DeploymentArchiveProcessorUtils.SAML_ADAPTER_CONFIG_PATH);
modifySAMLAdapterConfig(archive, DeploymentArchiveProcessorUtils.SAML_ADAPTER_CONFIG_PATH_TENANT1);
modifySAMLAdapterConfig(archive, DeploymentArchiveProcessorUtils.SAML_ADAPTER_CONFIG_PATH_TENANT2);
modifyOIDCAdapterConfig(archive, DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH_JS);
}
private void modifyWebXML(Archive<?> archive, TestClass testClass) {
if (!archive.contains(DeploymentArchiveProcessorUtils.WEBXML_PATH)) return;
if (!testClass.getJavaClass().isAnnotationPresent(UseServletFilter.class)) return;
log.debug("Modifying WEB.XML in " + archive.getName() + " for Servlet Filter.");
DeploymentArchiveProcessorUtils.modifyWebXMLForServletFilter(archive, testClass);
}
private void modifyOIDCAdapterConfig(Archive<?> archive, String adapterConfigPath) {
if (!archive.contains(adapterConfigPath)) return;
log.debug("Modifying adapter config " + adapterConfigPath + " in " + archive.getName());
DeploymentArchiveProcessorUtils.modifyOIDCAdapterConfig(archive, adapterConfigPath);
}
private void modifySAMLAdapterConfig(Archive<?> archive, String adapterConfigPath) {
if (!archive.contains(adapterConfigPath)) return;
log.debug("Modifying adapter config " + adapterConfigPath + " in " + archive.getName());
DeploymentArchiveProcessorUtils.modifySAMLAdapterConfig(archive, adapterConfigPath);
}
}

View file

@ -1,47 +0,0 @@
/*
* Copyright 2019 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.arquillian.jetty.saml.util;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import java.util.Set;
/**
* Wildfly JAX-RS Integration has support for scanning deployment for annotations.
*
* https://github.com/wildfly/wildfly/blob/14.0.1.Final/jaxrs/src/main/java/org/jboss/as/jaxrs/deployment/JaxrsAnnotationProcessor.java
*
* On undertow we have to set Application Class manually:
*
* ResteasyDeployment deployment = new ResteasyDeployment();
* deployment.setApplication(application);
*/
@ApplicationPath("/")
public class RestSamlApplicationConfig extends Application {
private final Set<Class<?>> classes;
public RestSamlApplicationConfig(Set<Class<?>> classes) {
this.classes = classes;
}
@Override
public Set<Class<?>> getClasses() {
return classes;
}
}

View file

@ -1 +0,0 @@
org.keycloak.testsuite.arquillian.jetty.JettyAppServerArquillianExtension

View file

@ -1,248 +0,0 @@
package org.keycloak.testsuite.arquillian.jetty;
import org.eclipse.jetty.deploy.DeploymentManager;
import org.eclipse.jetty.security.Authenticator;
import org.eclipse.jetty.security.SecurityHandler;
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext;
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
import org.keycloak.adapters.jetty.KeycloakJettyAuthenticator;
import org.keycloak.adapters.saml.jetty.KeycloakSamlAuthenticator;
import org.keycloak.testsuite.arquillian.jetty.container.JettyAppServerProvider;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.URI;
import java.net.URL;
/**
* This is a basic set of sanity tests for checking Jetty server compatibility.
* If this test suite is green, it is OK to integrate it with the Arquillian testsuite.
*/
public abstract class AbstractJettyAppServerTest {
public static final String TEST_SERVLET_NAME = "TestServlet";
public static final String TEST_SERVLET_URL_MAPPING = "test-servlet";
@Test
public void testServerStartupAndShutdown() throws Exception {
// given
int httpPort = 8081;
int httpsPort = 8082;
JettyAppServerConfiguration configuration = new JettyAppServerConfiguration();
configuration.setBindHttpPort(httpPort);
configuration.setBindHttpsPort(httpsPort);
JettyAppServer server = new JettyAppServer();
server.setup(configuration);
// when
server.start();
boolean wasFreeOnHTTPPortWhenServerStarted = isFree("localhost", httpPort);
boolean wasFreeOnHTTPSPortWhenServerStarted = isFree("localhost", httpsPort);
server.stop();
boolean wasFreeOnHTTPWhenServerStopped = isFree("localhost", httpPort);
boolean wasFreeOnHTTPSWhenServerStopped = isFree("localhost", httpsPort);
// then
Assert.assertFalse(wasFreeOnHTTPPortWhenServerStarted);
Assert.assertTrue(wasFreeOnHTTPWhenServerStopped);
Assert.assertFalse(wasFreeOnHTTPSPortWhenServerStarted);
Assert.assertTrue(wasFreeOnHTTPSWhenServerStopped);
}
@Test
public void testDeployingServletApp() throws Exception {
// given
WebArchive archive = ShrinkWrap.create(WebArchive.class,"archive.war")
.addClasses(ExampleServlet.class);
JettyAppServer server = new JettyAppServer();
Response responseFromTheApp = null;
// when
try {
server.start();
ProtocolMetaData data = server.deploy(archive);
HTTPContext servletContext = data.getContexts(HTTPContext.class).iterator().next();
URI appURI = servletContext.getServletByName(TEST_SERVLET_NAME).getBaseURI().resolve(TEST_SERVLET_URL_MAPPING);
Client client = ClientBuilder.newClient();
responseFromTheApp = client.target(appURI).request().get();
} finally {
server.stop();
}
// assert
Assert.assertNotNull(responseFromTheApp);
Assert.assertEquals(200, responseFromTheApp.getStatus());
}
@Test
public void testDeployingRESTApp() throws Exception {
// given
WebArchive archive = ShrinkWrap.create(WebArchive.class,"archive.war")
.addClasses(ExampleRest.class);
JettyAppServer server = new JettyAppServer();
Response responseFromTheApp = null;
// when
try {
server.start();
ProtocolMetaData data = server.deploy(archive);
HTTPContext servletContext = data.getContexts(HTTPContext.class).iterator().next();
URI appURI = servletContext.getServlets().get(0).getBaseURI();
Client client = ClientBuilder.newClient();
responseFromTheApp = client.target(appURI).request().get();
} finally {
server.stop();
}
// assert
Assert.assertNotNull(responseFromTheApp);
Assert.assertEquals(200, responseFromTheApp.getStatus());
}
@Test
public void testDeployingAndUndeploying() throws Exception {
// given
WebArchive archive = ShrinkWrap.create(WebArchive.class,"archive.war")
.addClasses(ExampleRest.class);
JettyAppServer server = new JettyAppServer();
Response responseFromTheApp = null;
// when
try {
server.start();
ProtocolMetaData data = server.deploy(archive);
HTTPContext servletContext = data.getContexts(HTTPContext.class).iterator().next();
URI appURI = servletContext.getServlets().get(0).getBaseURI();
server.undeploy(archive);
Client client = ClientBuilder.newClient();
responseFromTheApp = client.target(appURI).request().get();
} finally {
server.stop();
}
// assert
Assert.assertNotNull(responseFromTheApp);
Assert.assertEquals(404, responseFromTheApp.getStatus());
}
@Test
public void testDetectingSAML() throws Exception {
// given
URL webXml = AbstractJettyAppServerTest.class.getResource("/web-saml.xml");
WebArchive archive = ShrinkWrap.create(WebArchive.class,"archive.war")
.addAsWebInfResource(webXml, "web.xml");
JettyAppServer server = new JettyAppServer();
// when
Authenticator installedAuthenticator = null;
try {
server.start();
server.deploy(archive);
installedAuthenticator = server.getServer()
.getBean(DeploymentManager.class).getApps().iterator().next()
.getContextHandler().getChildHandlerByClass(SecurityHandler.class).getAuthenticator();
} finally {
server.stop();
}
// assert
Assert.assertTrue(installedAuthenticator instanceof KeycloakSamlAuthenticator);
}
@Test
public void testDetectingOIDC() throws Exception {
// given
URL webXml = AbstractJettyAppServerTest.class.getResource("/web-oidc.xml");
WebArchive archive = ShrinkWrap.create(WebArchive.class,"archive.war")
.addAsWebInfResource(webXml, "web.xml");
JettyAppServer server = new JettyAppServer();
// when
Authenticator installedAuthenticator = null;
try {
server.start();
server.deploy(archive);
installedAuthenticator = server.getServer()
.getBean(DeploymentManager.class).getApps().iterator().next()
.getContextHandler().getChildHandlerByClass(SecurityHandler.class).getAuthenticator();
} finally {
server.stop();
}
// assert
Assert.assertTrue(installedAuthenticator instanceof KeycloakJettyAuthenticator);
}
@Test
public void testJettyVersion() throws Exception {
// given
String versionRegexp = "jetty\\d\\d";
// when
String appServerName = new JettyAppServerProvider().getName();
// assert
Assert.assertTrue(appServerName.matches(versionRegexp));
}
@WebServlet(name = TEST_SERVLET_NAME, urlPatterns = "/" + TEST_SERVLET_URL_MAPPING)
public static class ExampleServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.getWriter().println("ok");
}
}
@Path("/")
public static class ExampleRest extends HttpServlet {
@GET
public Response doGet() {
return Response.ok().build();
}
}
public static boolean isFree(String hostName, int port) {
SocketAddress socketAddress = new InetSocketAddress(hostName, port);
Socket socket = new Socket();
try {
socket.connect(socketAddress, 2000);
socket.close();
return false;
} catch (Exception exception) {
return true;
}
}
}

View file

@ -1,5 +0,0 @@
log4j.rootLogger=info, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %t [%c] %m%n

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<login-config>
<auth-method>KEYCLOAK</auth-method>
<realm-name>demo</realm-name>
</login-config>
</web-app>

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<login-config>
<auth-method>KEYCLOAK-SAML</auth-method>
<realm-name>demo</realm-name>
</login-config>
</web-app>

View file

@ -1,47 +0,0 @@
<?xml version="1.0"?>
<!--
~ Copyright 2018 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
<?xml version="1.0"?>
~ 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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server</artifactId>
<version>999.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers-app-server-jetty</artifactId>
<packaging>pom</packaging>
<name>App Server - Jetty Parent</name>
<profiles>
<profile>
<id>app-server-jetty94</id>
<activation>
<property>
<name>app.server</name>
<value>jetty94</value>
</property>
</activation>
<modules>
<module>common</module>
<module>94</module>
</modules>
</profile>
</profiles>
</project>

View file

@ -45,9 +45,7 @@
<modules>
<module>jboss</module>
<module>karaf</module>
<module>tomcat</module>
<module>undertow</module>
<module>jetty</module>
</modules>
</profile>
</profiles>

View file

@ -1,46 +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.
-->
<assembly>
<id>${app.server.tomcat}</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${app.server.tomcat.home}</directory>
<outputDirectory>app-server-${app.server.tomcat}</outputDirectory>
<excludes>
<exclude>**/*.sh</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${app.server.tomcat.home}</directory>
<outputDirectory>app-server-${app.server.tomcat}</outputDirectory>
<includes>
<include>**/*.sh</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</assembly>

View file

@ -1,43 +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.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
version="2.0"
exclude-result-prefixes="xalan">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no" />
<xsl:strip-space elements="*"/>
<xsl:template match="//*[local-name()='Service']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<Connector port="8643" maxThreads="500"
server="Apache"
scheme="https" secure="true" SSLEnabled="true" acceptCount="500"
keystoreFile="lib/adapter.jks" keystorePass="secret"
truststoreFile="lib/keycloak.truststore" truststorePass="secret"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

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.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
version="2.0"
exclude-result-prefixes="xalan">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no" />
<xsl:strip-space elements="*"/>
<xsl:template match="//*[local-name()='tomcat-users']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<user username="manager" password="arquillian" roles="manager-script,manager-gui"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>integration-arquillian-servers-app-server-tomcat</artifactId>
<groupId>org.keycloak.testsuite</groupId>
<version>999.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers-app-server-tomcat-common</artifactId>
<name>App Server - Tomcat common classes</name>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View file

@ -1,12 +0,0 @@
package org.keycloak.testsuite.adapter.servlet;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
* Basic auth app.
*/
@ApplicationPath("/")
public class TomcatConfigApplication extends Application {
}

View file

@ -1,81 +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.arquillian.tomcat.container;
import org.jboss.arquillian.core.spi.Validate;
import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.keycloak.testsuite.arquillian.container.AppServerContainerProvider;
import org.keycloak.testsuite.utils.arquillian.tomcat.TomcatAppServerConfigurationUtils;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractTomcatAppServerProvider implements AppServerContainerProvider {
private final String catalinaHome;
private final String bindHttpPort;
private final String jmxPort;
private final String startupTimeoutInSeconds;
private final String USER = "manager";
private final String PASS = "arquillian";
public AbstractTomcatAppServerProvider() {
catalinaHome = System.getProperty("app.server.home");
bindHttpPort = determineHttpPort();
jmxPort = System.getProperty("app.server.management.port");
startupTimeoutInSeconds = System.getProperty("app.server.startup.timeout");
Validate.notNullOrEmpty(catalinaHome, "app.server.home is not set.");
Validate.notNullOrEmpty(bindHttpPort, "app.server.http.port is not set.");
Validate.notNullOrEmpty(jmxPort, "app.server.management.port is not set.");
Validate.notNullOrEmpty(startupTimeoutInSeconds, "app.server.startup.timeout is not set.");
}
protected abstract String getContainerClassName();
private String determineHttpPort() {
String httpPort = System.getProperty("app.server.http.port");
String portOffset = System.getProperty("app.server.port.offset", "0");
if (!portOffset.equals("0")) {
httpPort = String.valueOf(Integer.valueOf(httpPort) + Integer.valueOf(portOffset));
}
return httpPort;
}
@Override
public List<Node> getContainers() {
List<Node> containers = new ArrayList<>();
containers.add(standaloneContainer());
return containers;
}
private Node standaloneContainer() {
Node container = new Node("container");
container.attribute("mode", "manual");
container.attribute("qualifier", AppServerContainerProvider.APP_SERVER + "-" + getName());
return TomcatAppServerConfigurationUtils
.getStandaloneConfiguration(container, getContainerClassName(), catalinaHome,
bindHttpPort, jmxPort, USER, PASS, startupTimeoutInSeconds);
}
}

View file

@ -1,78 +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.arquillian.tomcat.container;
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.keycloak.testsuite.adapter.servlet.TomcatConfigApplication;
import org.keycloak.testsuite.utils.arquillian.DeploymentArchiveProcessorUtils;
import org.keycloak.testsuite.utils.arquillian.tomcat.TomcatDeploymentArchiveProcessorUtils;
public class CommonTomcatDeploymentArchiveProcessor implements ApplicationArchiveProcessor {
private final Logger log = Logger.getLogger(CommonTomcatDeploymentArchiveProcessor.class);
@Override
public void process(Archive<?> archive, TestClass testClass) {
if (DeploymentArchiveProcessorUtils.checkRunOnServerDeployment(archive)) return;
modifyOIDCAdapterConfig(archive, DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH);
DeploymentArchiveProcessorUtils.SAML_CONFIGS.forEach(path -> modifySAMLAdapterConfig(archive, path));
TomcatDeploymentArchiveProcessorUtils.copyWarClasspathFilesToCommonTomcatClasspath(archive);
// KEYCLOAK-9606 - might be unnecessary, however for now we need to test what is in docs
TomcatDeploymentArchiveProcessorUtils.replaceKEYCLOAKMethodWithBASIC(archive);
if (containsSAMLAdapterConfig(archive)) {
TomcatDeploymentArchiveProcessorUtils.replaceOIDCValveWithSAMLValve(archive);
}
if (TomcatDeploymentArchiveProcessorUtils.isJaxRSApp(archive)) {
TomcatDeploymentArchiveProcessorUtils.removeServletConfigurationInWebXML(archive);
if (!TomcatDeploymentArchiveProcessorUtils.containsApplicationConfigClass(archive)) {
((WebArchive) archive).addClass(TomcatConfigApplication.class);
}
}
}
private boolean containsSAMLAdapterConfig(Archive<?> archive) {
return DeploymentArchiveProcessorUtils.SAML_CONFIGS
.stream()
.anyMatch(archive::contains);
}
private void modifyOIDCAdapterConfig(Archive<?> archive, String adapterConfigPath) {
if (!archive.contains(adapterConfigPath)) return;
log.debug("Modifying adapter config " + adapterConfigPath + " in " + archive.getName());
DeploymentArchiveProcessorUtils.modifyOIDCAdapterConfig(archive, adapterConfigPath);
}
private void modifySAMLAdapterConfig(Archive<?> archive, String adapterConfigPath) {
if (!archive.contains(adapterConfigPath)) return;
log.debug("Modifying adapter config " + adapterConfigPath + " in " + archive.getName());
DeploymentArchiveProcessorUtils.modifySAMLAdapterConfig(archive, adapterConfigPath);
}
}

View file

@ -1,375 +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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server</artifactId>
<version>999.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers-app-server-tomcat</artifactId>
<packaging>pom</packaging>
<name>App Server - Tomcat</name>
<properties>
<common.resources>${project.parent.basedir}/common/common-files</common.resources>
<assembly.xml>${project.parent.basedir}/assembly.xml</assembly.xml>
<app.server.tomcat.home>${containers.home}/${app.server.tomcat.unpacked.folder.name}</app.server.tomcat.home>
<tomcat.resteasy.version>${resteasy.version}</tomcat.resteasy.version>
<skip.dependencies.for.tomcat>false</skip.dependencies.for.tomcat>
<tomcat.reactive-streams.version>1.0.2</tomcat.reactive-streams.version>
<tomcat.javax.json.bind-api.version>1.0</tomcat.javax.json.bind-api.version>
<tomcat.validation-api.version>1.0.0.GA</tomcat.validation-api.version>
</properties>
<profiles>
<profile>
<id>app-server-tomcat-submodules</id>
<activation>
<file>
<exists>src/tomcat-submodule</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>app.server.tomcat</property>
<property>app.server.tomcat.groupId</property>
<property>app.server.tomcat.artifactId</property>
<property>app.server.tomcat.version</property>
<property>app.server.tomcat.unpacked.folder.name</property>
<property>app.server.oidc.adapter.artifactId</property>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-tomcat-and-adapter</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${app.server.tomcat.groupId}</groupId>
<artifactId>${app.server.tomcat.artifactId}</artifactId>
<version>${app.server.tomcat.version}</version>
<type>zip</type>
<outputDirectory>${containers.home}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>${app.server.oidc.adapter.artifactId}</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${app.server.tomcat.home}/lib</outputDirectory>
</artifactItem>
</artifactItems>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
<execution>
<id>libs-for-tomcat-8-and-9</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<skip>${skip.dependencies.for.tomcat}</skip>
<artifactItems>
<artifactItem>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
<version>${jboss-jaxrs-api_2.1_spec}</version>
</artifactItem>
<artifactItem>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-core</artifactId>
<version>${tomcat.resteasy.version}</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
<version>${tomcat.reactive-streams.version}</version>
</artifactItem>
<artifactItem>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</artifactItem>
<artifactItem>
<groupId>javax.json.bind</groupId>
<artifactId>javax.json.bind-api</artifactId>
<version>${tomcat.javax.json.bind-api.version}</version>
</artifactItem>
<artifactItem>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${tomcat.validation-api.version}</version>
</artifactItem>
</artifactItems>
<outputDirectory>${app.server.tomcat.home}/lib</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>add-tomcat-manager-user</id>
<phase>process-test-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${app.server.tomcat.home}/conf</dir>
<stylesheet>${common.resources}/tomcat-users.xsl</stylesheet>
<includes>
<include>tomcat-users.xml</include>
</includes>
<outputDir>${app.server.tomcat.home}/conf</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>create-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>${assembly.xml}</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>app-server-saml-supported</id>
<activation>
<file>
<exists>src/saml-adapter-supported</exists>
</file>
</activation>
<properties>
<app.server.saml.adapter.supported>true</app.server.saml.adapter.supported>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>app.server.saml.adapter.artifactId</property>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-saml-adapter</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>${app.server.saml.adapter.artifactId}</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${app.server.tomcat.home}/lib</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-keycloak-truststore</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${app.server.tomcat.home}/lib</outputDirectory>
<resources>
<resource>
<directory>${common.resources}</directory>
<includes>
<include>keycloak.truststore</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>truststore</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>app-server-tomcat8</id>
<modules>
<module>tomcat8</module>
<module>common</module>
</modules>
</profile>
<profile>
<id>app-server-tomcat9</id>
<modules>
<module>tomcat9</module>
<module>common</module>
</modules>
</profile>
<profile>
<id>configure-ssl</id>
<activation>
<property>
<name>app.server.ssl.required</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>configure-https-connector</id>
<phase>process-test-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${app.server.tomcat.home}/conf</dir>
<stylesheet>${common.resources}/tomcat-add-connector.xsl</stylesheet>
<includes>
<include>server.xml</include>
</includes>
<outputDir>${app.server.tomcat.home}/conf</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-keycloak-truststore</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${app.server.tomcat.home}/lib</outputDirectory>
<resources>
<resource>
<directory>${common.resources}/keystore</directory>
<includes>
<include>keycloak.truststore</include>
<include>adapter.jks</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>truststore</nonFilteredFileExtension>
<nonFilteredFileExtension>jks</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -1,55 +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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-tomcat</artifactId>
<version>999.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers-app-server-tomcat8</artifactId>
<name>App Server - Tomcat 8</name>
<properties>
<app.server.tomcat>tomcat8</app.server.tomcat>
<app.server.tomcat.groupId>org.apache.tomcat</app.server.tomcat.groupId>
<app.server.tomcat.artifactId>tomcat</app.server.tomcat.artifactId>
<app.server.tomcat.version>${tomcat8.version}</app.server.tomcat.version>
<app.server.tomcat.unpacked.folder.name>apache-tomcat-${tomcat8.version}</app.server.tomcat.unpacked.folder.name>
<skip.dependencies.for.tomcat8>false</skip.dependencies.for.tomcat8>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-tomcat-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-tomcat-managed-8</artifactId>
<version>${arquillian-tomcat8-container-version}</version>
</dependency>
</dependencies>
</project>

View file

@ -1,30 +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.arquillian.tomcat;
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.core.spi.LoadableExtension;
import org.keycloak.testsuite.arquillian.tomcat.container.CommonTomcatDeploymentArchiveProcessor;
public class Tomcat8AppServerArquillianExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder builder) {
builder.service(ApplicationArchiveProcessor.class, CommonTomcatDeploymentArchiveProcessor.class);
}
}

View file

@ -1,40 +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.arquillian.tomcat.container;
import java.util.ArrayList;
import java.util.List;
import org.jboss.arquillian.container.tomcat.managed.Tomcat8ManagedContainer;
import org.jboss.arquillian.core.spi.Validate;
import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.keycloak.testsuite.arquillian.container.AppServerContainerProvider;
import org.keycloak.testsuite.utils.arquillian.tomcat.TomcatAppServerConfigurationUtils;
public class Tomcat8AppServerProvider extends AbstractTomcatAppServerProvider {
@Override
public String getName() {
return "tomcat8";
}
@Override
protected String getContainerClassName() {
return Tomcat8ManagedContainer.class.getName();
}
}

View file

@ -1 +0,0 @@
org.keycloak.testsuite.arquillian.tomcat.Tomcat8AppServerArquillianExtension

View file

@ -1,56 +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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-tomcat</artifactId>
<version>999.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers-app-server-tomcat9</artifactId>
<name>App Server - Tomcat 9</name>
<properties>
<app.server.tomcat>tomcat9</app.server.tomcat>
<app.server.tomcat.groupId>org.apache.tomcat</app.server.tomcat.groupId>
<app.server.tomcat.artifactId>tomcat</app.server.tomcat.artifactId>
<app.server.tomcat.version>${tomcat9.version}</app.server.tomcat.version>
<app.server.tomcat.unpacked.folder.name>apache-tomcat-${tomcat9.version}</app.server.tomcat.unpacked.folder.name>
<skip.dependencies.for.tomcat8>false</skip.dependencies.for.tomcat8>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-tomcat-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<!-- There is no arquillian container for Tomcat 9 yet, for now we use container for Tomcat 8 -->
<artifactId>arquillian-tomcat-managed-8</artifactId>
<version>${arquillian-tomcat9-container-version}</version>
</dependency>
</dependencies>
</project>

View file

@ -1,30 +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.arquillian.tomcat;
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.core.spi.LoadableExtension;
import org.keycloak.testsuite.arquillian.tomcat.container.CommonTomcatDeploymentArchiveProcessor;
public class Tomcat9AppServerArquillianExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder builder) {
builder.service(ApplicationArchiveProcessor.class, CommonTomcatDeploymentArchiveProcessor.class);
}
}

View file

@ -1,33 +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.arquillian.tomcat.container;
import org.jboss.arquillian.container.tomcat.managed.Tomcat8ManagedContainer;
public class Tomcat9AppServerProvider extends AbstractTomcatAppServerProvider {
@Override
public String getName() {
return "tomcat9";
}
@Override
protected String getContainerClassName() {
return Tomcat8ManagedContainer.class.getName();
}
}

View file

@ -1 +0,0 @@
org.keycloak.testsuite.arquillian.tomcat.Tomcat9AppServerArquillianExtension

View file

@ -20,7 +20,6 @@ import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArch
import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.Archive;
import org.keycloak.testsuite.utils.annotation.UseServletFilter;
import org.keycloak.testsuite.utils.arquillian.DeploymentArchiveProcessorUtils;
/**
@ -49,10 +48,6 @@ public class UndertowDeploymentArchiveProcessor implements ApplicationArchivePro
private void modifyWebXML(Archive<?> archive, TestClass testClass) {
if (!archive.contains(DeploymentArchiveProcessorUtils.WEBXML_PATH)) return;
if (!testClass.getJavaClass().isAnnotationPresent(UseServletFilter.class)) return;
log.debug("Modifying WEB.XML in " + archive.getName() + " for Servlet Filter.");
DeploymentArchiveProcessorUtils.modifyWebXMLForServletFilter(archive, testClass);
}
private void modifyOIDCAdapterConfig(Archive<?> archive, String adapterConfigPath) {

View file

@ -48,9 +48,6 @@
<hotrod.sasl.mechanism>DIGEST-MD5</hotrod.sasl.mechanism>
<jboss.cli.executable>jboss-cli.sh</jboss.cli.executable>
<!-- Tomcat versions needs to be overwritten to newer versions because of https://issues.redhat.com/browse/KEYCLOAK-14103 -->
<tomcat9.version>9.0.29</tomcat9.version>
</properties>
<modules>

View file

@ -1,20 +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.
-->
<Context path="/hello-world-authz-service">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -1,20 +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.
-->
<Context path="/servlet-authz-app">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -1,20 +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.
-->
<Context path="/servlet-policy-enforcer">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -471,35 +471,6 @@
</build>
</profile>
<profile>
<id>app-server-jetty94</id>
<activation>
<property>
<name>app.server</name>
<value>jetty94</value>
</property>
</activation>
<properties>
<app.server>jetty94</app.server> <!--in case the profile is called directly-->
<app.server.skip.unpack>true</app.server.skip.unpack>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-jetty-94</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>app-server-undertow</id>
<activation>
@ -880,74 +851,6 @@
</profile>
<!-- EAP6, Fuse 6.x and Fuse 7.x adapter profiles END -->
<profile>
<id>app-server-tomcat8</id>
<activation>
<property>
<name>app.server</name>
<value>tomcat8</value>
</property>
</activation>
<properties>
<app.server>tomcat8</app.server> <!--in case the profile is called directly-->
<app.server.skip.unpack>false</app.server.skip.unpack>
<app.server.artifactId>integration-arquillian-servers-app-server-tomcat8</app.server.artifactId><!-- Need to override -->
<app.server.port.offset>0</app.server.port.offset>
<app.server.http.port>8080</app.server.http.port>
<app.server.management.port>9990</app.server.management.port>
<app.server.keystore.dir>${app.server.home}/lib</app.server.keystore.dir>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-tomcat8</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>app-server-tomcat9</id>
<activation>
<property>
<name>app.server</name>
<value>tomcat9</value>
</property>
</activation>
<properties>
<app.server>tomcat9</app.server> <!--in case the profile is called directly-->
<app.server.skip.unpack>false</app.server.skip.unpack>
<app.server.artifactId>integration-arquillian-servers-app-server-tomcat9</app.server.artifactId><!-- Need to override -->
<app.server.port.offset>0</app.server.port.offset>
<app.server.http.port>8080</app.server.http.port>
<app.server.management.port>9990</app.server.management.port>
<app.server.keystore.dir>${app.server.home}/lib</app.server.keystore.dir>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-tomcat9</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>auth-servers-crossdc-undertow</id>
<properties>

View file

@ -367,10 +367,6 @@ public class AppServerTestEnricher {
return CURRENT_APP_SERVER.equals("wildfly9");
}
public static boolean isTomcatAppServer() {
return CURRENT_APP_SERVER.startsWith("tomcat");
}
public static boolean isEAP6AppServer() {
return CURRENT_APP_SERVER.equals("eap6");
}

View file

@ -17,49 +17,32 @@
package org.keycloak.testsuite.arquillian;
import org.keycloak.testsuite.utils.arquillian.KeycloakDependenciesResolver;
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.core.api.InstanceProducer;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.arquillian.test.spi.annotation.ClassScoped;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.Node;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.jboss.shrinkwrap.resolver.api.maven.MavenFormatStage;
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem;
import org.keycloak.representations.adapters.config.AdapterConfig;
import org.keycloak.testsuite.utils.annotation.UseServletFilter;
import org.keycloak.testsuite.utils.io.IOUtil;
import org.keycloak.util.JsonSerialization;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.DOMException;
import org.w3c.dom.NodeList;
import java.io.File;
import java.io.IOException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.jboss.logging.Logger;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isRelative;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isTomcatAppServer;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isWLSAppServer;
import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isWASAppServer;
import static org.keycloak.testsuite.utils.io.IOUtil.appendChildInDocument;
import static org.keycloak.testsuite.utils.io.IOUtil.documentToString;
import static org.keycloak.testsuite.utils.io.IOUtil.getElementTextContent;
import static org.keycloak.testsuite.utils.io.IOUtil.loadJson;
import static org.keycloak.testsuite.utils.io.IOUtil.loadXML;
import static org.keycloak.testsuite.utils.io.IOUtil.modifyDocElementAttribute;
import static org.keycloak.testsuite.utils.io.IOUtil.modifyDocElementValue;
import static org.keycloak.testsuite.utils.io.IOUtil.removeElementsFromDoc;
import static org.keycloak.testsuite.utils.io.IOUtil.removeNodeByAttributeValue;
import static org.keycloak.testsuite.util.ServerURLs.getAuthServerContextRoot;
@ -112,8 +95,7 @@ public class DeploymentArchiveProcessor implements ApplicationArchiveProcessor {
((WebArchive) archive)
.addAsLibraries(dependencies.asFile())
.addClass(org.keycloak.testsuite.arquillian.annotation.AppServerContainer.class)
.addClass(org.keycloak.testsuite.utils.annotation.UseServletFilter.class);
.addClass(org.keycloak.testsuite.arquillian.annotation.AppServerContainer.class);
}
}
@ -181,30 +163,6 @@ public class DeploymentArchiveProcessor implements ApplicationArchiveProcessor {
}
}
public void addFilterDependencies(Archive<?> archive, TestClass testClass) {
TestContext testContext = testContextProducer.get();
if (testContext.getAppServerInfo().isUndertow()) {
return;
}
Node jbossDeploymentStructureXml = archive.get(JBOSS_DEPLOYMENT_XML_PATH);
if (jbossDeploymentStructureXml == null) {
log.debug("Archive doesn't contain " + JBOSS_DEPLOYMENT_XML_PATH);
return;
}
log.info("Adding filter dependencies to " + archive.getName());
String dependency = testClass.getAnnotation(UseServletFilter.class).filterDependency();
((WebArchive) archive).addAsLibraries(KeycloakDependenciesResolver.resolveDependencies((dependency + ":" + System.getProperty("project.version"))));
Document jbossXmlDoc = loadXML(jbossDeploymentStructureXml.getAsset().openStream());
removeNodeByAttributeValue(jbossXmlDoc, "dependencies", "module", "name", "org.keycloak.keycloak-saml-core");
removeNodeByAttributeValue(jbossXmlDoc, "dependencies", "module", "name", "org.keycloak.keycloak-adapter-spi");
archive.add(new StringAsset((documentToString(jbossXmlDoc))), JBOSS_DEPLOYMENT_XML_PATH);
}
protected void modifyWebXml(Archive<?> archive, TestClass testClass) {
if (!archive.contains(WEBXML_PATH)) return;
@ -215,102 +173,7 @@ public class DeploymentArchiveProcessor implements ApplicationArchiveProcessor {
} catch (IllegalArgumentException ex) {
throw new RuntimeException("Error when processing " + archive.getName(), ex);
}
if (isTomcatAppServer()) {
modifyDocElementValue(webXmlDoc, "auth-method", "KEYCLOAK", "BASIC");
}
if (testClass.getJavaClass().isAnnotationPresent(UseServletFilter.class) && archive.contains(JBOSS_DEPLOYMENT_XML_PATH)) {
addFilterDependencies(archive, testClass);
//We need to add filter declaration to web.xml
log.info("Adding filter to " + testClass.getAnnotation(UseServletFilter.class).filterClass() + " with mapping " + testClass.getAnnotation(UseServletFilter.class).filterPattern() + " for " + archive.getName());
Element filter = webXmlDoc.createElement("filter");
Element filterName = webXmlDoc.createElement("filter-name");
Element filterClass = webXmlDoc.createElement("filter-class");
filterName.setTextContent(testClass.getAnnotation(UseServletFilter.class).filterName());
filterClass.setTextContent(testClass.getAnnotation(UseServletFilter.class).filterClass());
filter.appendChild(filterName);
filter.appendChild(filterClass);
// check if there was a resolver for OIDC and set as a filter param
String keycloakResolverClass = getKeycloakResolverClass(webXmlDoc);
if (keycloakResolverClass != null) {
Element initParam = webXmlDoc.createElement("init-param");
Element paramName = webXmlDoc.createElement("param-name");
paramName.setTextContent("keycloak.config.resolver");
Element paramValue = webXmlDoc.createElement("param-value");
paramValue.setTextContent(keycloakResolverClass);
initParam.appendChild(paramName);
initParam.appendChild(paramValue);
filter.appendChild(initParam);
}
appendChildInDocument(webXmlDoc, "web-app", filter);
Element filterMapping = webXmlDoc.createElement("filter-mapping");
Element urlPattern = webXmlDoc.createElement("url-pattern");
filterName = webXmlDoc.createElement("filter-name");
filterName.setTextContent(testClass.getAnnotation(UseServletFilter.class).filterName());
urlPattern.setTextContent(getElementTextContent(webXmlDoc, "web-app/security-constraint/web-resource-collection/url-pattern"));
filterMapping.appendChild(filterName);
filterMapping.appendChild(urlPattern);
if (!testClass.getAnnotation(UseServletFilter.class).dispatcherType().isEmpty()) {
Element dispatcher = webXmlDoc.createElement("dispatcher");
dispatcher.setTextContent(testClass.getAnnotation(UseServletFilter.class).dispatcherType());
filterMapping.appendChild(dispatcher);
}
appendChildInDocument(webXmlDoc, "web-app", filterMapping);
//finally we need to remove all keycloak related configuration from web.xml
removeElementsFromDoc(webXmlDoc, "web-app", "security-constraint");
removeElementsFromDoc(webXmlDoc, "web-app", "login-config");
removeElementsFromDoc(webXmlDoc, "web-app", "security-role");
}
archive.add(new StringAsset((documentToString(webXmlDoc))), WEBXML_PATH);
}
private void addInitParam(Document webXmlDoc, Element filter, String initParamName, String initParamValue) {
// Limitation that all deployments of annotated class use same skipPattern. Refactor if something more flexible is needed (would require more tricky web.xml parsing though...)
if (initParamValue != null && !initParamValue.isEmpty()) {
Element initParam = webXmlDoc.createElement("init-param");
Element paramName = webXmlDoc.createElement("param-name");
paramName.setTextContent(initParamName);
Element paramValue = webXmlDoc.createElement("param-value");
paramValue.setTextContent(initParamValue);
initParam.appendChild(paramName);
initParam.appendChild(paramValue);
filter.appendChild(initParam);
}
}
private String getKeycloakResolverClass(Document doc) {
try {
XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
XPathExpression expr = xpath.compile("//web-app/context-param[param-name='keycloak.config.resolver']/param-value/text()");
NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
if (nodes != null && nodes.getLength() > 0) {
return nodes.item(0).getNodeValue();
}
} catch(DOMException e) {
throw new IllegalStateException(e);
} catch (XPathExpressionException e) {
throw new IllegalStateException(e);
}
return null;
}
}

View file

@ -64,9 +64,6 @@ public abstract class AbstractAdapterTest extends AbstractAuthTest {
public static final String UNDERTOW_HANDLERS_CONF = "undertow-handlers.conf";
public static final URL undertowHandlersConf = AbstractServletsAdapterTest.class
.getResource("/adapter-test/samesite/undertow-handlers.conf");
public static final String TOMCAT_CONTEXT_XML = "context.xml";
public static final URL tomcatContext = AbstractServletsAdapterTest.class
.getResource("/adapter-test/" + TOMCAT_CONTEXT_XML);
protected static boolean sslConfigured = false;
@ -262,16 +259,6 @@ public abstract class AbstractAdapterTest extends AbstractAuthTest {
}
}
public static void addContextXml(Archive archive, String contextPath) {
try {
String contextXmlContent = IOUtils.toString(tomcatContext.openStream(), "UTF-8")
.replace("%CONTEXT_PATH%", contextPath);
archive.add(new StringAsset(contextXmlContent), "/META-INF/context.xml");
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
public static void addSameSiteUndertowHandlers(WebArchive archive) {
if (SuiteContext.BROWSER_STRICT_COOKIES) {
archive.addAsWebInfResource(undertowHandlersConf, UNDERTOW_HANDLERS_CONF);

View file

@ -93,8 +93,6 @@ public abstract class AbstractServletsAdapterTest extends AbstractAdapterTest {
deployment.addAsWebInfResource(keycloakJSON, "keycloak.json");
}
addContextXml(deployment, name);
return deployment;
}
@ -154,8 +152,6 @@ public abstract class AbstractServletsAdapterTest extends AbstractAdapterTest {
deployment.addAsWebInfResource(keystore, "keystore.jks");
}
addContextXml(deployment, name);
if (AppServerTestEnricher.isJBossJakartaAppServer()) {
DeploymentArchiveProcessorUtils.useJakartaEEServletClass(deployment, "/WEB-INF/web.xml");
}
@ -202,8 +198,6 @@ public abstract class AbstractServletsAdapterTest extends AbstractAdapterTest {
Assert.assertNotNull("keystore2Url should be in " + webInfPath + keystore2, keystore2Url);
deployment.add(new UrlAsset(keystore2Url), "/WEB-INF/classes/" + keystore2);
addContextXml(deployment, name);
return deployment;
}

View file

@ -53,8 +53,6 @@ import static org.keycloak.testsuite.utils.io.IOUtil.loadRealm;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class DefaultAuthzConfigAdapterTest extends AbstractExampleAdapterTest {
private static final String REALM_NAME = "hello-world-authz";

View file

@ -40,8 +40,6 @@ import static org.hamcrest.Matchers.is;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class PermissiveModeAdapterTest extends AbstractBaseServletAuthzAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)
@ -56,12 +54,8 @@ public class PermissiveModeAdapterTest extends AbstractBaseServletAuthzAdapterTe
login("jdoe", "jdoe");
driver.navigate().to(getResourceServerUrl() + "/enforcing/resource");
if (AppServerTestEnricher.isEAP6AppServer() || AppServerTestEnricher.isTomcatAppServer()) {
assertThat(driver.getPageSource(), containsString("HTTP Status 404"));
} else {
assertThat(driver.getTitle(), is(equalTo("Error")));
assertThat(driver.getPageSource(), containsString("Not Found"));
}
assertThat(driver.getTitle(), is(equalTo("Error")));
assertThat(driver.getPageSource(), containsString("Not Found"));
driver.navigate().to(getResourceServerUrl() + "/protected/admin");
assertWasDenied();

View file

@ -52,29 +52,6 @@ public class ServletAuthzCIPAdapterTest extends AbstractServletAuthzAdapterTest
}
@Test
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public void testClaimInformationPoint() {
performTests(() -> {
login("alice", "alice");
assertWasNotDenied();
this.driver.navigate().to(getResourceServerUrl() + "/protected/context/context.jsp?request-claim=unexpected-value");
assertWasDenied();
this.driver.navigate().to(getResourceServerUrl() + "/protected/context/context.jsp?request-claim=expected-value");
assertWasNotDenied();
hasText("Access granted: true");
this.driver.navigate().to(getResourceServerUrl() + "/protected/context/context.jsp");
assertWasDenied();
});
}
@Test
// This test doesn't work with Tomcat, because KEYCLOAK-11712 was done only for wildfly
public void testReuseBodyAfterClaimProcessing() {
performTests(() -> {
OAuthClient.AccessTokenResponse response = oauth.realm("servlet-authz").clientId("servlet-authz-app")

View file

@ -35,8 +35,6 @@ import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class ServletAuthzCacheDisabledAdapterTest extends AbstractServletAuthzAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)

View file

@ -34,8 +34,6 @@ import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class ServletAuthzCacheLifespanAdapterTest extends AbstractServletAuthzAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)

View file

@ -33,8 +33,6 @@ import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class ServletAuthzLazyLoadPathsAdapterTest extends AbstractServletAuthzAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)

View file

@ -31,8 +31,6 @@ import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class ServletAuthzNoLazyLoadPathsAdapterTest extends AbstractServletAuthzAdapterTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)

View file

@ -31,8 +31,6 @@ import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class ServletPolicyEnforcerLifespanTest extends AbstractServletPolicyEnforcerTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)

View file

@ -29,8 +29,6 @@ import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class ServletPolicyEnforcerTest extends AbstractServletPolicyEnforcerTest {
@Deployment(name = RESOURCE_SERVER_ID, managed = false)

View file

@ -142,8 +142,6 @@ import static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class DemoServletsAdapterTest extends AbstractServletsAdapterTest {
@Page

View file

@ -39,7 +39,6 @@ import static org.hamcrest.Matchers.not;
import org.jboss.arquillian.graphene.page.Page;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.keycloak.testsuite.adapter.AbstractServletsAdapterTest.samlServletDeployment;
import org.keycloak.testsuite.adapter.page.SalesPostClockSkewServlet;
import static org.keycloak.testsuite.util.SamlClient.Binding.POST;
@ -50,7 +49,6 @@ import static org.keycloak.testsuite.util.SamlClient.Binding.POST;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP8)
@AppServerContainer(ContainerConstants.APP_SERVER_JETTY94)
public class SAMLClockSkewAdapterTest extends AbstractSAMLServletAdapterTest {
@Page protected SalesPostClockSkewServlet salesPostClockSkewServletPage;
@ -131,32 +129,4 @@ public class SAMLClockSkewAdapterTest extends AbstractSAMLServletAdapterTest {
deployer.undeploy(DEPLOYMENT_NAME_30_SEC);
}
}
@Test
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
@AppServerContainer(value = ContainerConstants.APP_SERVER_UNDERTOW, skip = true)
@AppServerContainer(value = ContainerConstants.APP_SERVER_WILDFLY, skip = true)
@AppServerContainer(value = ContainerConstants.APP_SERVER_EAP, skip = true)
@AppServerContainer(value = ContainerConstants.APP_SERVER_EAP6, skip = true)
@AppServerContainer(value = ContainerConstants.APP_SERVER_EAP71, skip = true)
@AppServerContainer(value = ContainerConstants.APP_SERVER_EAP8, skip = true)
@AppServerContainer(value = ContainerConstants.APP_SERVER_JETTY94, skip = true)
public void testClockSkewTomcat() throws Exception {
/*
* Tomcat by default determines context path from name of hot deployed war,
* because of that we need to have this specific test for tomcat containers
*/
deployer.deploy(SalesPostClockSkewServlet.DEPLOYMENT_NAME);
try {
assertOutcome(-4, allOf(containsString("request-path:"), containsString("principal=bburke")));
assertTokenIsNotValid(65);
assertTokenIsNotValid(-65);
} finally {
deployer.undeploy(SalesPostClockSkewServlet.DEPLOYMENT_NAME);
}
}
}

View file

@ -60,9 +60,6 @@ import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
@AppServerContainer(ContainerConstants.APP_SERVER_JETTY94)
public class SAMLLoginResponseHandlingTest extends AbstractSAMLServletAdapterTest {
@Page

View file

@ -55,8 +55,6 @@ import static org.keycloak.testsuite.util.SamlClient.Binding.REDIRECT;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class SAMLLogoutAdapterTest extends AbstractServletsAdapterTest {
private static final String SP_PROVIDED_ID = "spProvidedId";

View file

@ -198,8 +198,6 @@ import org.xml.sax.SAXException;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class SAMLServletAdapterTest extends AbstractSAMLServletAdapterTest {
@Page
protected BadClientSalesPostSigServlet badClientSalesPostSigServletPage;

View file

@ -39,9 +39,6 @@ import static org.keycloak.testsuite.util.Matchers.bodyHC;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
@AppServerContainer(ContainerConstants.APP_SERVER_JETTY94)
public class SAMLServletSessionTimeoutTest extends AbstractSAMLServletAdapterTest {
@Page

View file

@ -82,8 +82,6 @@ import static org.keycloak.testsuite.saml.AbstractSamlTest.REALM_SIGNING_CERTIFI
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class SamlSignatureTest extends AbstractAdapterTest {
private static final String REQUIRED_ROLE_NAME = "manager";

View file

@ -39,8 +39,6 @@ import static org.keycloak.testsuite.util.Matchers.statusCodeIsHC;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class SamlXMLAttacksTest extends AbstractSamlTest {
@Test

View file

@ -58,8 +58,6 @@ import static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;
@AppServerContainer(ContainerConstants.APP_SERVER_EAP)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT8)
@AppServerContainer(ContainerConstants.APP_SERVER_TOMCAT9)
public class SessionServletAdapterTest extends AbstractServletsAdapterTest {
@Page

View file

@ -1,64 +0,0 @@
package org.keycloak.testsuite.adapter.servlet.jetty;
import org.junit.Ignore;
import org.keycloak.testsuite.adapter.servlet.DemoServletsAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
@AppServerContainer(ContainerConstants.APP_SERVER_JETTY94)
public class JettyDemoServletAdapterTest extends DemoServletsAdapterTest {
@Ignore("KEYCLOAK-9614")
@Override
public void testAuthenticated() {
}
@Ignore("KEYCLOAK-9614")
@Override
public void testAuthenticatedWithCustomSessionConfig() {
}
@Ignore("KEYCLOAK-9616")
@Override
public void testOIDCParamsForwarding() {
}
@Ignore("KEYCLOAK-9616")
@Override
public void testOIDCUiLocalesParamForwarding() {
}
@Ignore("KEYCLOAK-9615")
@Override
public void testInvalidTokenCookie() {
}
@Ignore("KEYCLOAK-9615")
@Override
public void testTokenInCookieRefresh() {
}
@Ignore("KEYCLOAK-9615")
@Override
public void testTokenInCookieSSO() {
}
@Ignore("KEYCLOAK-9615")
@Override
public void testTokenInCookieSSORoot() {
}
@Ignore("KEYCLOAK-9617")
@Override
public void testWithoutKeycloakConf() {
}
}

View file

@ -1,22 +0,0 @@
package org.keycloak.testsuite.adapter.servlet.jetty;
import org.junit.Ignore;
import org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
@AppServerContainer(ContainerConstants.APP_SERVER_JETTY94)
public class JettySAMLServletAdapterTest extends SAMLServletAdapterTest {
@Ignore("KEYCLOAK-9687")
@Override
public void multiTenant1SamlTest() throws Exception {
}
@Ignore("KEYCLOAK-9687")
@Override
public void multiTenant2SamlTest() throws Exception {
}
}

View file

@ -35,11 +35,6 @@ import java.nio.charset.Charset;
public class AdapterServletDeployment {
public static final String JBOSS_DEPLOYMENT_STRUCTURE_XML = "jboss-deployment-structure.xml";
public static final String TOMCAT_CONTEXT_XML = "context.xml";
// hardcoded for now
public static final URL tomcatContext = AdapterServletDeployment.class
.getResource("/adapter-test/" + TOMCAT_CONTEXT_XML);
public static WebArchive oidcDeployment(String name, String configRoot, Class... servletClasses) {
return oidcDeployment(name, configRoot, "keycloak.json");
@ -73,22 +68,6 @@ public class AdapterServletDeployment {
}
if (jbossDeploymentStructure != null) deployment.addAsWebInfResource(jbossDeploymentStructure, JBOSS_DEPLOYMENT_STRUCTURE_XML);
addContextXml(deployment, name);
return deployment;
}
public static void addContextXml(Archive archive, String contextPath) {
// hardcoded for now
try {
String contextXmlContent = IOUtils.toString(tomcatContext.openStream(), Charset.defaultCharset())
.replace("%CONTEXT_PATH%", contextPath);
archive.add(new StringAsset(contextXmlContent), "/META-INF/context.xml");
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}

View file

@ -1,20 +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.
-->
<Context path="/basic-auth">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -1,46 +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.
-->
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="securityHandler">
<Set name="authenticator">
<New class="org.keycloak.adapters.jetty.KeycloakJettyAuthenticator">
<!--
<Set name="adapterConfig">
<New class="org.keycloak.representations.adapters.config.AdapterConfig">
<Set name="realm">tomcat</Set>
<Set name="resource">customer-portal</Set>
<Set name="authServerUrl">http://localhost:8180/auth</Set>
<Set name="sslRequired">external</Set>
<Set name="credentials">
<Map>
<Entry>
<Item>secret</Item>
<Item>password</Item>
</Entry>
</Map>
</Set>
<Set name="realmKey">MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB</Set>
</New>
</Set>
-->
</New>
</Set>
</Get>
</Configure>

View file

@ -1,20 +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.
-->
<Context path="/customer-portal">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -1,46 +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.
-->
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="securityHandler">
<Set name="authenticator">
<New class="org.keycloak.adapters.jetty.KeycloakJettyAuthenticator">
<!--
<Set name="adapterConfig">
<New class="org.keycloak.representations.adapters.config.AdapterConfig">
<Set name="realm">tomcat</Set>
<Set name="resource">customer-portal</Set>
<Set name="authServerUrl">http://localhost:8180/auth</Set>
<Set name="sslRequired">external</Set>
<Set name="credentials">
<Map>
<Entry>
<Item>secret</Item>
<Item>password</Item>
</Entry>
</Map>
</Set>
<Set name="realmKey">MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB</Set>
</New>
</Set>
-->
</New>
</Set>
</Get>
</Configure>

View file

@ -1,20 +0,0 @@
<!--
~ Copyright 2020 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.
-->
<Context path="/customer-portal">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<!--
~ Copyright 2020 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.
-->
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="securityHandler">
<Set name="authenticator">
<New class="org.keycloak.adapters.jetty.KeycloakJettyAuthenticator">
<!--
<Set name="adapterConfig">
<New class="org.keycloak.representations.adapters.config.AdapterConfig">
<Set name="realm">tomcat</Set>
<Set name="resource">customer-portal</Set>
<Set name="authServerUrl">http://localhost:8180/auth</Set>
<Set name="sslRequired">external</Set>
<Set name="credentials">
<Map>
<Entry>
<Item>secret</Item>
<Item>password</Item>
</Entry>
</Map>
</Set>
<Set name="realmKey">MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB</Set>
</New>
</Set>
-->
</New>
</Set>
</Get>
</Configure>

View file

@ -1,20 +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.
-->
<Context path="/customer-portal">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -1,46 +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.
-->
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="securityHandler">
<Set name="authenticator">
<New class="org.keycloak.adapters.jetty.KeycloakJettyAuthenticator">
<!--
<Set name="adapterConfig">
<New class="org.keycloak.representations.adapters.config.AdapterConfig">
<Set name="realm">tomcat</Set>
<Set name="resource">customer-portal</Set>
<Set name="authServerUrl">http://localhost:8180/auth</Set>
<Set name="sslRequired">external</Set>
<Set name="credentials">
<Map>
<Entry>
<Item>secret</Item>
<Item>password</Item>
</Entry>
</Map>
</Set>
<Set name="realmKey">MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB</Set>
</New>
</Set>
-->
</New>
</Set>
</Get>
</Configure>

View file

@ -1,21 +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.
-->
<Context path="/%CONTEXT_PATH%">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
<CookieProcessor sameSiteCookies="None" />
</Context>

View file

@ -1,20 +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.
-->
<Context path="/customer-portal">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -1,46 +0,0 @@
<?xml version="1.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.
-->
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="securityHandler">
<Set name="authenticator">
<New class="org.keycloak.adapters.jetty.KeycloakJettyAuthenticator">
<!--
<Set name="adapterConfig">
<New class="org.keycloak.representations.adapters.config.AdapterConfig">
<Set name="realm">tomcat</Set>
<Set name="resource">customer-portal</Set>
<Set name="authServerUrl">http://localhost:8180/auth</Set>
<Set name="sslRequired">external</Set>
<Set name="credentials">
<Map>
<Entry>
<Item>secret</Item>
<Item>password</Item>
</Entry>
</Map>
</Set>
<Set name="realmKey">MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB</Set>
</New>
</Set>
-->
</New>
</Set>
</Get>
</Configure>

View file

@ -1,20 +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.
-->
<Context path="/customer-portal">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -1,46 +0,0 @@
<?xml version="1.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.
-->
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="securityHandler">
<Set name="authenticator">
<New class="org.keycloak.adapters.jetty.KeycloakJettyAuthenticator">
<!--
<Set name="adapterConfig">
<New class="org.keycloak.representations.adapters.config.AdapterConfig">
<Set name="realm">tomcat</Set>
<Set name="resource">customer-portal</Set>
<Set name="authServerUrl">http://localhost:8180/auth</Set>
<Set name="sslRequired">external</Set>
<Set name="credentials">
<Map>
<Entry>
<Item>secret</Item>
<Item>password</Item>
</Entry>
</Map>
</Set>
<Set name="realmKey">MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB</Set>
</New>
</Set>
-->
</New>
</Set>
</Get>
</Configure>

View file

@ -1,20 +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.
-->
<Context path="/customer-portal">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -1,46 +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.
-->
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="securityHandler">
<Set name="authenticator">
<New class="org.keycloak.adapters.jetty.KeycloakJettyAuthenticator">
<!--
<Set name="adapterConfig">
<New class="org.keycloak.representations.adapters.config.AdapterConfig">
<Set name="realm">tomcat</Set>
<Set name="resource">customer-portal</Set>
<Set name="authServerUrl">http://localhost:8180/auth</Set>
<Set name="sslRequired">external</Set>
<Set name="credentials">
<Map>
<Entry>
<Item>secret</Item>
<Item>password</Item>
</Entry>
</Map>
</Set>
<Set name="realmKey">MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB</Set>
</New>
</Set>
-->
</New>
</Set>
</Get>
</Configure>

View file

@ -1,20 +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.
-->
<Context path="/customer-db-error-page">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>

View file

@ -1,46 +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.
-->
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="securityHandler">
<Set name="authenticator">
<New class="org.keycloak.adapters.jetty.KeycloakJettyAuthenticator">
<!--
<Set name="adapterConfig">
<New class="org.keycloak.representations.adapters.config.AdapterConfig">
<Set name="realm">tomcat</Set>
<Set name="resource">customer-portal</Set>
<Set name="authServerUrl">http://localhost:8180/auth</Set>
<Set name="sslRequired">external</Set>
<Set name="credentials">
<Map>
<Entry>
<Item>secret</Item>
<Item>password</Item>
</Entry>
</Map>
</Set>
<Set name="realmKey">MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB</Set>
</New>
</Set>
-->
</New>
</Set>
</Get>
</Configure>

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