KEYCLOAK-9509 Upgrade to Wildfly 15

KEYCLOAK-9584 Update Wildfly Arquillian version

KEYCLOAK-9581: Fix CookiePathTests

KEYCLOAK-9607 CLI sripts and configuration files update

KEYCLOAK-9580 Fix component registration error

KEYCLOAK-9590 Update JDG to newest version

* Infinispan is using whatever version is set in root pom.xml.

KEYCLOAK-9509 Fix Undertow tests

Co-Authored-By: vramik <vramik@redhat.com>
Co-Authored-By: sebastienblanc <scm.blanc@gmail.com>
This commit is contained in:
Hynek Mlnarik 2019-02-15 21:00:46 +01:00 committed by Stian Thorgersen
parent 99f8e5f808
commit 37ef47d6ab
22 changed files with 100 additions and 55 deletions

View file

@ -17,7 +17,7 @@
~ limitations under the License.
-->
<domain xmlns="urn:jboss:domain:8.0">
<domain xmlns="urn:jboss:domain:9.0">
<extensions>
<?EXTENSIONS?>

View file

@ -22,7 +22,7 @@
is also started by this host controller file. The other instance must be started
via host-slave.xml
-->
<host name="master" xmlns="urn:jboss:domain:8.0">
<host name="master" xmlns="urn:jboss:domain:9.0">
<extensions>
<?EXTENSIONS?>
</extensions>

View file

@ -17,7 +17,7 @@
~ limitations under the License.
-->
<host xmlns="urn:jboss:domain:8.0">
<host xmlns="urn:jboss:domain:9.0">
<extensions>
<?EXTENSIONS?>
</extensions>

View file

@ -23,7 +23,7 @@
via host-slave.xml
-->
<host name="master" xmlns="urn:jboss:domain:8.0">
<host name="master" xmlns="urn:jboss:domain:9.0">
<extensions>
<?EXTENSIONS?>
</extensions>

View file

@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:8.0">
<server xmlns="urn:jboss:domain:9.0">
<extensions>
<?EXTENSIONS?>

View file

@ -571,4 +571,11 @@ if (outcome == success) of /profile=$clusteredProfile/subsystem=jgroups/stack=tc
end-try
end-if
# Migrate from 4.8.3 to 5.0.0
if (outcome == failed) of /profile=$clusteredProfile/subsystem=logging/logger=io.jaegertracing.Configuration/:read-resource
echo Adding io.jaegertracing.Configuration logger
/profile=$clusteredProfile/subsystem=logging/logger=io.jaegertracing.Configuration/:add(category=io.jaegertracing.Configuration,level=WARN)
echo
end-if
echo *** End Migration of /profile=$clusteredProfile ***

View file

@ -496,4 +496,11 @@ if (outcome == success) of /profile=$standaloneProfile/subsystem=jgroups/stack=t
end-try
end-if
# Migrate from 4.8.3 to 5.0.0
if (outcome == failed) of /profile=$standaloneProfile/subsystem=logging/logger=io.jaegertracing.Configuration/:read-resource
echo Adding io.jaegertracing.Configuration logger
/profile=$standaloneProfile/subsystem=logging/logger=io.jaegertracing.Configuration/:add(category=io.jaegertracing.Configuration,level=WARN)
echo
end-if
echo *** End Migration of /profile=$standaloneProfile ***

View file

@ -567,4 +567,11 @@ if (outcome == success) of /subsystem=jgroups/stack=tcp/transport=TCP/property=p
end-try
end-if
# Migrate from 4.8.3 to 5.0.0
if (outcome == failed) of /subsystem=logging/logger=io.jaegertracing.Configuration/:read-resource
echo Adding io.jaegertracing.Configuration logger
/subsystem=logging/logger=io.jaegertracing.Configuration/:add(category=io.jaegertracing.Configuration,level=WARN)
echo
end-if
echo *** End Migration ***

View file

@ -456,4 +456,11 @@ if (result == undefined) of /subsystem=transactions/:read-attribute(name=node-id
echo
end-if
# Migrate from 4.8.3 to 5.0.0
if (outcome == failed) of /subsystem=logging/logger=io.jaegertracing.Configuration/:read-resource
echo Adding io.jaegertracing.Configuration logger
/subsystem=logging/logger=io.jaegertracing.Configuration/:add(category=io.jaegertracing.Configuration,level=WARN)
echo
end-if
echo *** End Migration ***

View file

@ -16,7 +16,8 @@
*/
package org.keycloak.client.admin.cli.httpcomponents;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import java.net.URI;
@ -24,7 +25,7 @@ import java.net.URI;
/**
* @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
*/
@NotThreadSafe
@Contract(threading = ThreadingBehavior.UNSAFE)
public class HttpDelete extends HttpEntityEnclosingRequestBase {
public HttpDelete(final String uri) {

View file

@ -33,6 +33,8 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.infinispan.commons.CacheConfigurationException;
import org.infinispan.factories.ComponentRegistry;
/**
* Startup initialization for reading persistent userSessions to be filled into infinispan/memory . In cluster,
@ -48,7 +50,6 @@ public class InfinispanCacheInitializer extends BaseCacheInitializer {
private final int maxErrors;
public InfinispanCacheInitializer(KeycloakSessionFactory sessionFactory, Cache<String, Serializable> workCache, SessionLoader sessionLoader, String stateKeySuffix, int sessionsPerSegment, int maxErrors) {
super(sessionFactory, workCache, sessionLoader, stateKeySuffix, sessionsPerSegment);
this.maxErrors = maxErrors;
@ -56,7 +57,14 @@ public class InfinispanCacheInitializer extends BaseCacheInitializer {
@Override
public void initCache() {
this.workCache.getAdvancedCache().getComponentRegistry().registerComponent(sessionFactory, KeycloakSessionFactory.class);
final ComponentRegistry cr = this.workCache.getAdvancedCache().getComponentRegistry();
try {
cr.registerComponent(sessionFactory, KeycloakSessionFactory.class);
} catch (UnsupportedOperationException | CacheConfigurationException ex) {
if (cr.getComponent(KeycloakSessionFactory.class) != sessionFactory) {
throw ex;
}
}
}

55
pom.xml
View file

@ -41,56 +41,58 @@
<product.build-time>${timestamp}</product.build-time>
<wildfly.version>14.0.1.Final</wildfly.version>
<wildfly.version>15.0.1.Final</wildfly.version>
<wildfly.build-tools.version>1.2.10.Final</wildfly.build-tools.version>
<eap.version>7.2.0.GA-redhat-00005</eap.version>
<eap.build-tools.version>1.2.10.Final</eap.build-tools.version>
<wildfly.core.version>6.0.2.Final</wildfly.core.version>
<wildfly.core.version>7.0.0.Final</wildfly.core.version>
<jboss.as.version>7.2.0.Final</jboss.as.version>
<!-- Versions used mostly for Undertow server, aligned with WildFly -->
<jboss.aesh.version>0.66.19</jboss.aesh.version>
<aesh.version>1.7</aesh.version>
<aesh.readline.version>1.10</aesh.readline.version>
<apache.httpcomponents.version>4.5.2</apache.httpcomponents.version>
<apache.httpcomponents.httpcore.version>4.4.4</apache.httpcomponents.httpcore.version>
<aesh.version>1.8</aesh.version>
<aesh.readline.version>1.11</aesh.readline.version>
<apache.httpcomponents.version>4.5.4</apache.httpcomponents.version>
<apache.httpcomponents.httpcore.version>4.4.5</apache.httpcomponents.httpcore.version>
<apache.mime4j.version>0.6</apache.mime4j.version>
<jboss.dmr.version>1.5.0.Final</jboss.dmr.version>
<bouncycastle.version>1.60</bouncycastle.version>
<cxf.version>3.2.0</cxf.version>
<dom4j.version>1.6.1</dom4j.version>
<github.relaxng.version>2011.1</github.relaxng.version>
<cxf.version>3.2.5-jbossorg-1</cxf.version>
<dom4j.version>2.1.1</dom4j.version>
<github.relaxng.version>2.3.1</github.relaxng.version>
<h2.version>1.4.193</h2.version>
<javax.persistence.version>2.2</javax.persistence.version>
<hibernate.core.version>5.3.6.Final</hibernate.core.version>
<hibernate.c3p0.version>5.3.6.Final</hibernate.c3p0.version>
<infinispan.version>9.3.1.Final</infinispan.version>
<hibernate.core.version>5.3.7.Final</hibernate.core.version>
<hibernate.c3p0.version>5.3.7.Final</hibernate.c3p0.version>
<infinispan.version>9.4.3.Final</infinispan.version>
<jackson.version>2.9.5</jackson.version>
<javax.mail.version>1.6.1</javax.mail.version>
<javax.mail.version>1.6.2</javax.mail.version>
<jboss.logging.version>3.3.2.Final</jboss.logging.version>
<jboss.logging.tools.version>2.1.0.Final</jboss.logging.tools.version>
<jboss.logging.tools.wf8.version>1.2.0.Final</jboss.logging.tools.wf8.version>
<jboss-jaxrs-api_2.1_spec>1.0.1.Final</jboss-jaxrs-api_2.1_spec>
<jboss-jaxrs-api_2.1_spec>1.0.2.Final</jboss-jaxrs-api_2.1_spec>
<jboss-transaction-api_1.2_spec>1.1.1.Final</jboss-transaction-api_1.2_spec>
<jboss.spec.javax.xml.bind.jboss-jaxb-api_2.3_spec.version>1.0.1.Final</jboss.spec.javax.xml.bind.jboss-jaxb-api_2.3_spec.version>
<jboss.spec.javax.servlet.jsp.jboss-jsp-api_2.3_spec.version>1.0.3.Final</jboss.spec.javax.servlet.jsp.jboss-jsp-api_2.3_spec.version>
<log4j.version>1.2.17</log4j.version>
<resteasy.version>3.6.1.Final</resteasy.version>
<resteasy.undertow.version>3.6.1.Final</resteasy.undertow.version>
<resteasy.version>3.6.2.Final</resteasy.version>
<resteasy.undertow.version>3.6.2.Final</resteasy.undertow.version>
<owasp.html.sanitizer.version>20180219.1</owasp.html.sanitizer.version>
<slf4j-api.version>1.7.22</slf4j-api.version>
<slf4j.version>1.7.22</slf4j.version>
<sun.istack.version>3.0.5</sun.istack.version>
<sun.jaxb.version>2.3.0</sun.jaxb.version>
<sun.xsom.version>20140925</sun.xsom.version>
<undertow.version>2.0.13.Final</undertow.version>
<elytron.version>1.6.0.Final</elytron.version>
<elytron.undertow-server.version>1.2.3.Final</elytron.undertow-server.version>
<sun.istack.version>3.0.7</sun.istack.version>
<sun.jaxb.version>2.3.1</sun.jaxb.version>
<org.glassfish.jaxb.xsom.version>2.3.1</org.glassfish.jaxb.xsom.version>
<undertow.version>2.0.15.Final</undertow.version>
<elytron.version>1.7.0.Final</elytron.version>
<elytron.undertow-server.version>1.3.0.Final</elytron.undertow-server.version>
<woodstox.version>5.0.3</woodstox.version>
<xmlsec.version>2.1.2</xmlsec.version>
<glassfish.json.version>1.1.2</glassfish.json.version>
<wildfly.common.version>1.4.0.Final</wildfly.common.version>
<picketbox.version>5.0.3.Final</picketbox.version>
<google.guava.version>25.0-jre</google.guava.version>
<!-- Authorization Drools Policy Provider -->
<version.org.drools>7.11.0.Final</version.org.drools>
@ -104,9 +106,6 @@
<google.zxing.version>3.2.1</google.zxing.version>
<freemarker.version>2.3.26-incubating</freemarker.version>
<!-- Same version as ships with wildfly. -->
<google.guava.version>25.0-jre</google.guava.version>
<jetty9.version>9.1.0.v20131115</jetty9.version>
<liquibase.version>3.5.5</liquibase.version>
<mysql.version>5.1.29</mysql.version>
@ -243,9 +242,9 @@
<version>${sun.jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xsom</groupId>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>xsom</artifactId>
<version>${sun.xsom.version}</version>
<version>${org.glassfish.jaxb.xsom.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
@ -561,7 +560,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>${dom4j.version}</version>
<scope>test</scope>

View file

@ -529,7 +529,6 @@ After you build the distribution, you run this command to setup servers and run
-Dfrontend.console.output=true \
-Dtest=org.keycloak.testsuite.cluster.**.*Test clean install
### Cluster tests with Keycloak on embedded undertow
mvn -f testsuite/integration-arquillian/tests/base/pom.xml \
@ -541,6 +540,9 @@ After you build the distribution, you run this command to setup servers and run
-Dfrontend.console.output=true \
-Dtest=org.keycloak.testsuite.cluster.**.*Test clean install
Note that after update, you might encounter `org.infinispan.commons.CacheException: Initial state transfer timed out for cache org.infinispan.CONFIG`
error in some environments. This can be fixed by adding `-Djava.net.preferIPv4Stack=true` parameter to the command above.
#### Run cluster tests from IDE on embedded undertow
The test uses Undertow loadbalancer on `http://localhost:8180` and two embedded backend Undertow servers with Keycloak on `http://localhost:8181` and `http://localhost:8182` .
@ -582,6 +584,13 @@ For an example of a test, see [org.keycloak.testsuite.crossdc.ActionTokenCrossDC
The cross DC requires setting a profile specifying used cache server by specifying
`cache-server-infinispan` or `cache-server-jdg` profile in maven.
Since JDG does not distribute `infinispan-server` zip artifact anymore, for `cache-server-jdg` profile it is
necessary to download the artifact and install it to local Maven repository. For JDG 7.3.0, the command is the following:
mvn install:install-file \
-DgroupId=org.infinispan.server -DartifactId=infinispan-server -Dpackaging=zip -Dclassifier=bin -DgeneratePom=true \
-Dversion=9.4.6.Final-redhat-00002 -Dfile=jboss-datagrid-7.3.0-server.zip
#### Run Cross-DC Tests from Maven
a) Prepare the environment. Compile the infinispan server and eventually Keycloak on JBoss server.

View file

@ -42,8 +42,8 @@
<app.server>undertow</app.server>
<!-- Wildfly deprecated versions -->
<wildfly.deprecated.version>13.0.0.Final</wildfly.deprecated.version>
<wildfly.deprecated.wildfly.core.version>5.0.0.Final</wildfly.deprecated.wildfly.core.version>
<wildfly.deprecated.version>14.0.1.Final</wildfly.deprecated.version>
<wildfly.deprecated.wildfly.core.version>6.0.2.Final</wildfly.deprecated.wildfly.core.version>
<wildfly.deprecated.arquillian.wildfly.container>2.1.0.Final</wildfly.deprecated.arquillian.wildfly.container>
<!--component versions-->
@ -59,7 +59,7 @@
<selenium.version>3.14.0</selenium.version>
<arquillian-drone.version>2.5.1</arquillian-drone.version>
<arquillian-graphene.version>2.3.2</arquillian-graphene.version>
<arquillian-wildfly-container.version>2.1.0.Final</arquillian-wildfly-container.version>
<arquillian-wildfly-container.version>2.1.1.Final</arquillian-wildfly-container.version>
<arquillian-wls-container.version>1.0.1.Final</arquillian-wls-container.version>
<arquillian-container-karaf.version>2.2.0.Final</arquillian-container-karaf.version>
<arquillian-infinispan-container.version>1.2.0.Beta2</arquillian-infinispan-container.version>

View file

@ -69,6 +69,8 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.xnio.Options;
import org.xnio.SslClientAuthMode;
public class KeycloakOnUndertow implements DeployableContainer<KeycloakOnUndertowConfiguration> {
@ -195,6 +197,7 @@ public class KeycloakOnUndertow implements DeployableContainer<KeycloakOnUnderto
undertow.start(Undertow.builder()
.addHttpListener(configuration.getBindHttpPort(), configuration.getBindAddress())
.addHttpsListener(configuration.getBindHttpsPort(), configuration.getBindAddress(), TLSUtils.initializeTLS())
.setSocketOption(Options.SSL_CLIENT_AUTH_MODE, SslClientAuthMode.REQUESTED)
.setWorkerThreads(configuration.getWorkerThreads())
.setIoThreads(configuration.getWorkerThreads() / 8)
);

View file

@ -46,7 +46,7 @@
<!-- cache server versions -->
<!--<infinispan.version>8.2.8.Final</infinispan.version>--><!-- Use same infinspan-server version as our version -->
<jdg.version>8.5.3.Final-redhat-00002</jdg.version><!-- JDG 7.2.3 -->
<jdg.version>9.4.6.Final-redhat-00002</jdg.version><!-- JDG 7.3.0 -->
<jboss.default.worker.io-threads>16</jboss.default.worker.io-threads>
<jboss.default.worker.task-max-threads>128</jboss.default.worker.task-max-threads>

View file

@ -129,10 +129,10 @@ public class CookiesPathTest extends AbstractKeycloakTest {
// old cookie has been removed
// now we have AUTH_SESSION_ID, KEYCLOAK_IDENTITY, KEYCLOAK_SESSION
Assert.assertThat(cookieStore.getCookies().stream().map(org.apache.http.cookie.Cookie::getName).collect(Collectors.toList()),
Matchers.containsInAnyOrder("AUTH_SESSION_ID", "KEYCLOAK_IDENTITY", "KEYCLOAK_SESSION"));
Matchers.containsInAnyOrder("AUTH_SESSION_ID", "KEYCLOAK_IDENTITY", "KEYCLOAK_SESSION", "OAuth_Token_Request_State"));
// does each cookie's path end with "/"
cookieStore.getCookies().stream().map(org.apache.http.cookie.Cookie::getPath).forEach(path ->Assert.assertThat(path, Matchers.endsWith("/")));
cookieStore.getCookies().stream().filter(c -> !"OAuth_Token_Request_State".equals(c.getName())).map(org.apache.http.cookie.Cookie::getPath).forEach(path ->Assert.assertThat(path, Matchers.endsWith("/")));
// KEYCLOAK_SESSION should end by AUTH_SESSION_ID value
String authSessionId = cookieStore.getCookies().stream().filter(c -> "AUTH_SESSION_ID".equals(c.getName())).findFirst().get().getValue();
@ -194,10 +194,10 @@ public class CookiesPathTest extends AbstractKeycloakTest {
// old cookie has been removed
// now we have AUTH_SESSION_ID, KEYCLOAK_IDENTITY, KEYCLOAK_SESSION, OAuth_Token_Request_State
Assert.assertThat(cookieStore.getCookies().stream().map(org.apache.http.cookie.Cookie::getName).collect(Collectors.toList()),
Matchers.containsInAnyOrder("AUTH_SESSION_ID", "KEYCLOAK_IDENTITY", "KEYCLOAK_SESSION"));
Matchers.containsInAnyOrder("AUTH_SESSION_ID", "KEYCLOAK_IDENTITY", "KEYCLOAK_SESSION", "OAuth_Token_Request_State"));
// does each cookie's path end with "/"
cookieStore.getCookies().stream().map(org.apache.http.cookie.Cookie::getPath).forEach(path ->Assert.assertThat(path, Matchers.endsWith("/")));
cookieStore.getCookies().stream().filter(c -> !"OAuth_Token_Request_State".equals(c.getName())).map(org.apache.http.cookie.Cookie::getPath).forEach(path ->Assert.assertThat(path, Matchers.endsWith("/")));
// KEYCLOAK_SESSION should end by AUTH_SESSION_ID value
String authSessionId = cookieStore.getCookies().stream().filter(c -> "AUTH_SESSION_ID".equals(c.getName())).findFirst().get().getValue();

View file

@ -42,10 +42,6 @@
<module>springboot-tests</module>
</modules>
<properties>
<skip.unpack.test.resources>false</skip.unpack.test.resources>
</properties>
<build>
<pluginManagement>
<plugins>
@ -59,7 +55,6 @@
<goal>unpack</goal>
</goals>
<configuration>
<skip>${skip.unpack.test.resources}</skip>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>

View file

@ -35,7 +35,7 @@
<properties>
<skip.add.user.json>true</skip.add.user.json>
<skip.unpack.test.resources>true</skip.unpack.test.resources>
<skip.copy.example.wars>true</skip.copy.example.wars>
<skip.rename.configs>false</skip.rename.configs>
<jbossHome>${project.build.directory}/keycloak-${project.version}</jbossHome>

View file

@ -146,6 +146,7 @@
<examples.home>${project.build.directory}/examples</examples.home>
<examples.basedir>${keycloak-parent.basedir}/examples</examples.basedir> <!--keycloak/examples directory-->
<examples.version.suffix>${project.version}</examples.version.suffix>
<skip.copy.example.wars>false</skip.copy.example.wars>
<browser>htmlUnit</browser>
<webdriverDownloadBinaries>true</webdriverDownloadBinaries>
@ -247,6 +248,7 @@
<goal>copy</goal>
</goals>
<configuration>
<skip>${skip.copy.example.wars}</skip>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>

View file

@ -67,7 +67,7 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<scope>compile</scope>
</dependency>

View file

@ -24,7 +24,7 @@
<!-- See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->
<config>
<extension-module>org.wildfly.extension.undertow</extension-module>
<subsystem xmlns="urn:jboss:domain:undertow:7.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
<subsystem xmlns="urn:jboss:domain:undertow:8.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
<buffer-cache name="default"/>
<server name="default-server">
<?AJP?>