From 37ef47d6ab617d33d4146b5369326470107c90e0 Mon Sep 17 00:00:00 2001 From: Hynek Mlnarik Date: Fri, 15 Feb 2019 21:00:46 +0100 Subject: [PATCH] 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 Co-Authored-By: sebastienblanc --- .../configuration/domain/template.xml | 2 +- .../configuration/host/host-master.xml | 2 +- .../configuration/host/host-slave.xml | 2 +- .../resources/configuration/host/host.xml | 2 +- .../configuration/standalone/template.xml | 2 +- .../content/bin/migrate-domain-clustered.cli | 7 +++ .../content/bin/migrate-domain-standalone.cli | 7 +++ .../content/bin/migrate-standalone-ha.cli | 7 +++ .../content/bin/migrate-standalone.cli | 7 +++ .../admin/cli/httpcomponents/HttpDelete.java | 5 +- .../InfinispanCacheInitializer.java | 12 +++- pom.xml | 55 +++++++++---------- .../integration-arquillian/HOW-TO-RUN.md | 13 ++++- testsuite/integration-arquillian/pom.xml | 6 +- .../undertow/KeycloakOnUndertow.java | 3 + .../integration-arquillian/servers/pom.xml | 2 +- .../testsuite/cookies/CookiesPathTest.java | 8 +-- .../tests/other/pom.xml | 5 -- .../other/server-config-migration/pom.xml | 2 +- .../integration-arquillian/tests/pom.xml | 2 + testsuite/utils/pom.xml | 2 +- .../subsystem-templates/keycloak-undertow.xml | 2 +- 22 files changed, 100 insertions(+), 55 deletions(-) diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/domain/template.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/domain/template.xml index 40be86964c..94504f41b2 100755 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/domain/template.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/domain/template.xml @@ -17,7 +17,7 @@ ~ limitations under the License. --> - + diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-master.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-master.xml index 0035e0352b..458266d44a 100755 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-master.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-master.xml @@ -22,7 +22,7 @@ is also started by this host controller file. The other instance must be started via host-slave.xml --> - + diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-slave.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-slave.xml index bb6dbc14ad..ac7b60edde 100755 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-slave.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-slave.xml @@ -17,7 +17,7 @@ ~ limitations under the License. --> - + diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host.xml index c7afbf016c..541340c1e0 100755 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host.xml @@ -23,7 +23,7 @@ via host-slave.xml --> - + diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/template.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/template.xml index 4d78f99eb9..b664a61cf9 100644 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/template.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/template.xml @@ -1,6 +1,6 @@ - + diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli index 5dfe0719f3..a4ad6c263a 100644 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli @@ -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 *** diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli index e61d43d891..743de2246e 100644 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli @@ -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 *** diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli index bc54a70ddb..1c016aa17f 100644 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli @@ -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 *** diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli index 13e9a6f248..9c37cc4acb 100644 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli @@ -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 *** diff --git a/integration/client-cli/admin-cli/src/main/java/org/keycloak/client/admin/cli/httpcomponents/HttpDelete.java b/integration/client-cli/admin-cli/src/main/java/org/keycloak/client/admin/cli/httpcomponents/HttpDelete.java index 7d553ea87c..51c1bcaa38 100644 --- a/integration/client-cli/admin-cli/src/main/java/org/keycloak/client/admin/cli/httpcomponents/HttpDelete.java +++ b/integration/client-cli/admin-cli/src/main/java/org/keycloak/client/admin/cli/httpcomponents/HttpDelete.java @@ -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 Marko Strukelj */ -@NotThreadSafe +@Contract(threading = ThreadingBehavior.UNSAFE) public class HttpDelete extends HttpEntityEnclosingRequestBase { public HttpDelete(final String uri) { diff --git a/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/initializer/InfinispanCacheInitializer.java b/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/initializer/InfinispanCacheInitializer.java index afbd37ecfe..d4964448b2 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/initializer/InfinispanCacheInitializer.java +++ b/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/initializer/InfinispanCacheInitializer.java @@ -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 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; + } + } } diff --git a/pom.xml b/pom.xml index 11e8d46c30..969e190e78 100755 --- a/pom.xml +++ b/pom.xml @@ -41,56 +41,58 @@ ${timestamp} - 14.0.1.Final + 15.0.1.Final 1.2.10.Final 7.2.0.GA-redhat-00005 1.2.10.Final - 6.0.2.Final + 7.0.0.Final 7.2.0.Final + 0.66.19 - 1.7 - 1.10 - 4.5.2 - 4.4.4 + 1.8 + 1.11 + 4.5.4 + 4.4.5 0.6 1.5.0.Final 1.60 - 3.2.0 - 1.6.1 - 2011.1 + 3.2.5-jbossorg-1 + 2.1.1 + 2.3.1 1.4.193 2.2 - 5.3.6.Final - 5.3.6.Final - 9.3.1.Final + 5.3.7.Final + 5.3.7.Final + 9.4.3.Final 2.9.5 - 1.6.1 + 1.6.2 3.3.2.Final 2.1.0.Final 1.2.0.Final - 1.0.1.Final + 1.0.2.Final 1.1.1.Final 1.0.1.Final 1.0.3.Final 1.2.17 - 3.6.1.Final - 3.6.1.Final + 3.6.2.Final + 3.6.2.Final 20180219.1 1.7.22 1.7.22 - 3.0.5 - 2.3.0 - 20140925 - 2.0.13.Final - 1.6.0.Final - 1.2.3.Final + 3.0.7 + 2.3.1 + 2.3.1 + 2.0.15.Final + 1.7.0.Final + 1.3.0.Final 5.0.3 2.1.2 1.1.2 1.4.0.Final 5.0.3.Final + 25.0-jre 7.11.0.Final @@ -104,9 +106,6 @@ 3.2.1 2.3.26-incubating - - 25.0-jre - 9.1.0.v20131115 3.5.5 5.1.29 @@ -243,9 +242,9 @@ ${sun.jaxb.version} - com.sun.xsom + org.glassfish.jaxb xsom - ${sun.xsom.version} + ${org.glassfish.jaxb.xsom.version} org.bouncycastle @@ -561,7 +560,7 @@ test - dom4j + org.dom4j dom4j ${dom4j.version} test diff --git a/testsuite/integration-arquillian/HOW-TO-RUN.md b/testsuite/integration-arquillian/HOW-TO-RUN.md index cd2eb265bc..d7f934457f 100644 --- a/testsuite/integration-arquillian/HOW-TO-RUN.md +++ b/testsuite/integration-arquillian/HOW-TO-RUN.md @@ -528,8 +528,7 @@ After you build the distribution, you run this command to setup servers and run -Dauth.server.log.check=false \ -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. diff --git a/testsuite/integration-arquillian/pom.xml b/testsuite/integration-arquillian/pom.xml index 2bed0e2e68..6c79166234 100644 --- a/testsuite/integration-arquillian/pom.xml +++ b/testsuite/integration-arquillian/pom.xml @@ -42,8 +42,8 @@ undertow - 13.0.0.Final - 5.0.0.Final + 14.0.1.Final + 6.0.2.Final 2.1.0.Final @@ -59,7 +59,7 @@ 3.14.0 2.5.1 2.3.2 - 2.1.0.Final + 2.1.1.Final 1.0.1.Final 2.2.0.Final 1.2.0.Beta2 diff --git a/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/KeycloakOnUndertow.java b/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/KeycloakOnUndertow.java index ff0127b37e..49bc24b4fb 100644 --- a/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/KeycloakOnUndertow.java +++ b/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/KeycloakOnUndertow.java @@ -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 { @@ -195,6 +197,7 @@ public class KeycloakOnUndertow implements DeployableContainer - 8.5.3.Final-redhat-00002 + 9.4.6.Final-redhat-00002 16 128 diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookiesPathTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookiesPathTest.java index f0cb0c9e8c..36c2818bf8 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookiesPathTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookiesPathTest.java @@ -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(); diff --git a/testsuite/integration-arquillian/tests/other/pom.xml b/testsuite/integration-arquillian/tests/other/pom.xml index 05884d438b..e685be8bc5 100644 --- a/testsuite/integration-arquillian/tests/other/pom.xml +++ b/testsuite/integration-arquillian/tests/other/pom.xml @@ -42,10 +42,6 @@ springboot-tests - - false - - @@ -59,7 +55,6 @@ unpack - ${skip.unpack.test.resources} org.keycloak.testsuite diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml b/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml index fcffcbd600..9d69707cb4 100644 --- a/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml +++ b/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml @@ -35,7 +35,7 @@ true - true + true false ${project.build.directory}/keycloak-${project.version} diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index c36405c92c..249dae5f97 100755 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -146,6 +146,7 @@ ${project.build.directory}/examples ${keycloak-parent.basedir}/examples ${project.version} + false htmlUnit true @@ -247,6 +248,7 @@ copy + ${skip.copy.example.wars} org.keycloak.testsuite diff --git a/testsuite/utils/pom.xml b/testsuite/utils/pom.xml index 286661fffc..40f843760a 100755 --- a/testsuite/utils/pom.xml +++ b/testsuite/utils/pom.xml @@ -67,7 +67,7 @@ compile - dom4j + org.dom4j dom4j compile diff --git a/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-undertow.xml b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-undertow.xml index ed1ab2563e..ff5a695f3a 100644 --- a/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-undertow.xml +++ b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-undertow.xml @@ -24,7 +24,7 @@ org.wildfly.extension.undertow - +