From 3d4283fac9a809666c9ddd22f05d38a61756f1d4 Mon Sep 17 00:00:00 2001 From: Hynek Mlnarik Date: Sat, 22 Jun 2019 10:58:13 +0200 Subject: [PATCH] KEYCLOAK-9987 Upgrade to Wildfly17 Co-Authored-By: hmlnarik --- adapters/oidc/as7-eap6/as7-subsystem/pom.xml | 16 +- .../subsystem/as7/logging/KeycloakLogger.java | 6 +- .../as7/logging/KeycloakMessages.java | 2 +- adapters/saml/as7-eap6/subsystem/pom.xml | 12 +- .../saml/as7/logging/KeycloakLogger.java | 6 +- .../saml/as7/logging/KeycloakMessages.java | 2 +- boms/pom.xml | 2 +- .../org/keycloak/util/JsonSerialization.java | 4 +- .../standalone/subsystems-ha.xml | 1 + .../configuration/standalone/subsystems.xml | 1 + .../content/bin/migrate-domain-clustered.cli | 64 ++++-- .../content/bin/migrate-domain-standalone.cli | 40 ++-- .../content/bin/migrate-standalone-ha.cli | 64 +++++- .../content/bin/migrate-standalone.cli | 40 +++- pom.xml | 71 ++---- testsuite/integration-arquillian/pom.xml | 4 +- .../lb/SimpleUndertowLoadBalancer.java | 29 ++- .../test-apps/cors/database-service/pom.xml | 8 - .../DeploymentArchiveProcessor.java | 6 - .../testsuite/adduser/AddUserTest.java | 3 +- wildfly/adduser/pom.xml | 4 - .../org/keycloak/wildfly/adduser/AddUser.java | 209 ++++++++---------- .../keycloak-infinispan.xml | 10 + .../subsystem-templates/keycloak-undertow.xml | 2 +- 24 files changed, 348 insertions(+), 258 deletions(-) diff --git a/adapters/oidc/as7-eap6/as7-subsystem/pom.xml b/adapters/oidc/as7-eap6/as7-subsystem/pom.xml index c1bcafb480..3861ffaf20 100755 --- a/adapters/oidc/as7-eap6/as7-subsystem/pom.xml +++ b/adapters/oidc/as7-eap6/as7-subsystem/pom.xml @@ -63,40 +63,26 @@ org.jboss.as jboss-as-naming - ${jboss.as.version} org.jboss.as jboss-as-server - ${jboss.as.version} org.jboss.as jboss-as-ee - ${jboss.as.version} org.jboss.as jboss-as-web - ${jboss.as.version} org.jboss.logging - jboss-logging - - - - org.jboss.logging - jboss-logging-processor - - provided - true - 1.0.0.Final + jboss-logging-annotations diff --git a/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/logging/KeycloakLogger.java b/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/logging/KeycloakLogger.java index fb4bc0f3a3..e7971ed922 100755 --- a/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/logging/KeycloakLogger.java +++ b/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/logging/KeycloakLogger.java @@ -17,10 +17,10 @@ package org.keycloak.subsystem.as7.logging; import org.jboss.logging.BasicLogger; -import org.jboss.logging.LogMessage; +import org.jboss.logging.annotations.LogMessage; import org.jboss.logging.Logger; -import org.jboss.logging.Message; -import org.jboss.logging.MessageLogger; +import org.jboss.logging.annotations.Message; +import org.jboss.logging.annotations.MessageLogger; import static org.jboss.logging.Logger.Level.DEBUG; import static org.jboss.logging.Logger.Level.INFO; diff --git a/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/logging/KeycloakMessages.java b/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/logging/KeycloakMessages.java index 10c8e6f02a..1861b26bf2 100755 --- a/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/logging/KeycloakMessages.java +++ b/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/logging/KeycloakMessages.java @@ -16,7 +16,7 @@ */ package org.keycloak.subsystem.as7.logging; -import org.jboss.logging.MessageBundle; +import org.jboss.logging.annotations.MessageBundle; import org.jboss.logging.Messages; /** diff --git a/adapters/saml/as7-eap6/subsystem/pom.xml b/adapters/saml/as7-eap6/subsystem/pom.xml index 7ccbf2258b..3463e5fd06 100755 --- a/adapters/saml/as7-eap6/subsystem/pom.xml +++ b/adapters/saml/as7-eap6/subsystem/pom.xml @@ -87,17 +87,7 @@ org.jboss.logging - jboss-logging - - - - org.jboss.logging - jboss-logging-processor - - provided - true - 1.0.0.Final + jboss-logging-annotations diff --git a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/logging/KeycloakLogger.java b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/logging/KeycloakLogger.java index b7e235493e..8197eec5bb 100755 --- a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/logging/KeycloakLogger.java +++ b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/logging/KeycloakLogger.java @@ -17,10 +17,10 @@ package org.keycloak.subsystem.saml.as7.logging; import org.jboss.logging.BasicLogger; -import org.jboss.logging.LogMessage; +import org.jboss.logging.annotations.LogMessage; import org.jboss.logging.Logger; -import org.jboss.logging.Message; -import org.jboss.logging.MessageLogger; +import org.jboss.logging.annotations.Message; +import org.jboss.logging.annotations.MessageLogger; import static org.jboss.logging.Logger.Level.DEBUG; import static org.jboss.logging.Logger.Level.INFO; diff --git a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/logging/KeycloakMessages.java b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/logging/KeycloakMessages.java index 58501b157f..68872e7110 100755 --- a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/logging/KeycloakMessages.java +++ b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/logging/KeycloakMessages.java @@ -16,7 +16,7 @@ */ package org.keycloak.subsystem.saml.as7.logging; -import org.jboss.logging.MessageBundle; +import org.jboss.logging.annotations.MessageBundle; import org.jboss.logging.Messages; /** diff --git a/boms/pom.xml b/boms/pom.xml index d4adc02937..6f3be7524e 100644 --- a/boms/pom.xml +++ b/boms/pom.xml @@ -21,7 +21,7 @@ org.jboss jboss-parent - 28 + 34 org.keycloak.bom diff --git a/core/src/main/java/org/keycloak/util/JsonSerialization.java b/core/src/main/java/org/keycloak/util/JsonSerialization.java index a32ff733e9..e321d11151 100755 --- a/core/src/main/java/org/keycloak/util/JsonSerialization.java +++ b/core/src/main/java/org/keycloak/util/JsonSerialization.java @@ -108,14 +108,14 @@ public class JsonSerialization { } ObjectNode objectNode = createObjectNode(); - JsonParser jsonParser = mapper.getJsonFactory().createJsonParser(writeValueAsBytes(pojo)); + JsonParser jsonParser = mapper.getFactory().createParser(writeValueAsBytes(pojo)); JsonNode jsonNode = jsonParser.readValueAsTree(); if (!jsonNode.isObject()) { throw new RuntimeException("JsonNode [" + jsonNode + "] is not a object."); } - objectNode.putAll((ObjectNode) jsonNode); + objectNode.setAll((ObjectNode) jsonNode); return objectNode; } diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems-ha.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems-ha.xml index 533c2fd963..3055d3ffd6 100755 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems-ha.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems-ha.xml @@ -42,6 +42,7 @@ elytron.xml security.xml transactions.xml + weld.xml microprofile-config-smallrye.xml microprofile-health-smallrye.xml microprofile-metrics-smallrye.xml diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems.xml index d237de7d72..cf9a6ba15b 100755 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems.xml @@ -40,6 +40,7 @@ elytron.xml security.xml transactions.xml + weld.xml microprofile-config-smallrye.xml microprofile-health-smallrye.xml microprofile-metrics-smallrye.xml 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 8744fe45dd..aed13ba7f2 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 @@ -299,8 +299,13 @@ if (outcome == failed) of /profile=$clusteredProfile/subsystem=elytron/:read-res end-if if (outcome == failed) of /profile=$clusteredProfile/subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:read-resource - echo Adding channel-creation-options READ_TIMEOUT and MAX_OUTBOUND_MESSAGES to ejb3 remote + echo Adding channel-creation-options READ_TIMEOUT to ejb3 remote /profile=$clusteredProfile/subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:add(value="${prop.remoting-connector.read.timeout:20}",type=xnio) + echo +end-if + +if (outcome == failed) of /profile=$clusteredProfile/subsystem=ejb3/service=remote/channel-creation-options=MAX_OUTBOUND_MESSAGES/:read-resource + echo Adding channel-creation-options MAX_OUTBOUND_MESSAGES to ejb3 remote /profile=$clusteredProfile/subsystem=ejb3/service=remote/channel-creation-options=MAX_OUTBOUND_MESSAGES/:add(value=1234,type=remoting) echo end-if @@ -364,18 +369,6 @@ if (outcome == failed) of /profile=$clusteredProfile/subsystem=undertow/server=d echo end-if -if (outcome == success) of /socket-binding-group=ha-sockets/socket-binding=jgroups-tcp-fd/:read-resource - echo Removing socket-binding jgroups-tcp-fd - /socket-binding-group=ha-sockets/socket-binding=jgroups-tcp-fd/:remove - echo -end-if - -if (outcome == success) of /socket-binding-group=ha-sockets/socket-binding=jgroups-udp-fd/:read-resource - echo Removing socket-binding jgroups-udp-fd - /socket-binding-group=ha-sockets/socket-binding=jgroups-udp-fd/:remove - echo -end-if - if (result == 224.0.1.105) of /socket-binding-group=ha-sockets/socket-binding=modcluster/:read-attribute(name=multicast-address) echo Adding jboss.modcluster.multicast.address property to modcluster multicast-address /socket-binding-group=ha-sockets/socket-binding=modcluster/:write-attribute(name=multicast-address,value=${jboss.modcluster.multicast.address:224.0.1.105}) @@ -621,4 +614,49 @@ if (result == false) of /profile=$clusteredProfile/subsystem=webservices/:read-a echo end-if +# Migrate from 6.0.1 to 7.0.0 +if (outcome == success) of /profile=$clusteredProfile/subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:read-resource + echo Removing READ_TIMEOUT option from remote service from ejb3 subsystem + /profile=$clusteredProfile/subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:remove + echo +end-if + +if (outcome == failed) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=web/distributed-cache=routing:read-resource + echo Adding distributed cache routing to web cache container to infinispan subsystem + /profile=$clusteredProfile/subsystem=infinispan/cache-container=web/distributed-cache=routing/:add + echo +end-if + +if (outcome == failed) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=web/replicated-cache=sso:read-resource + echo Adding replicated cache sso to web cache container to infinispan subsystem + /profile=$clusteredProfile/subsystem=infinispan/cache-container=web/replicated-cache=sso/:add + /profile=$clusteredProfile/subsystem=infinispan/cache-container=web/replicated-cache=sso/component=locking/:add(isolation=REPEATABLE_READ) + /profile=$clusteredProfile/subsystem=infinispan/cache-container=web/replicated-cache=sso/component=transaction/:add(mode=BATCH) + echo +end-if + +if (outcome == failed) of /socket-binding-group=ha-sockets/socket-binding=jgroups-tcp-fd/:read-resource + echo Adding jgroups-tcp-fd socket binding to ha-sockets binding group + /socket-binding-group=ha-sockets/socket-binding=jgroups-tcp-fd/:add(interface=private,port=57600) + echo +end-if + +if (outcome == failed) of /socket-binding-group=ha-sockets/socket-binding=jgroups-udp-fd/:read-resource + echo Adding jgroups-udp-fd socket binding to ha-sockets binding group + /socket-binding-group=ha-sockets/socket-binding=jgroups-udp-fd/:add(interface=private,port=54200) + echo +end-if + +if (result == undefined) of /profile=$clusteredProfile/subsystem=jgroups/stack=tcp/protocol=FD_SOCK/:read-attribute(name=socket-binding) + echo Adding socket-binding for FD_SOCK protocol for tcp stack in jgroups subsystem + /profile=$clusteredProfile/subsystem=jgroups/stack=tcp/protocol=FD_SOCK/:write-attribute(name=socket-binding,value=jgroups-tcp-fd) + echo +end-if + +if (result == undefined) of /profile=$clusteredProfile/subsystem=jgroups/stack=udp/protocol=FD_SOCK/:read-attribute(name=socket-binding) + echo Adding socket-binding for FD_SOCK protocol for udp stack in jgroups subsystem + /profile=$clusteredProfile/subsystem=jgroups/stack=udp/protocol=FD_SOCK/:write-attribute(name=socket-binding,value=jgroups-udp-fd) + 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 89e165d4c4..ec52f9ff6d 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 @@ -281,8 +281,13 @@ if (outcome == failed) of /profile=$standaloneProfile/subsystem=elytron/:read-re end-if if (outcome == failed) of /profile=$standaloneProfile/subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:read-resource - echo Adding channel-creation-options READ_TIMEOUT and MAX_OUTBOUND_MESSAGES to ejb3 remote + echo Adding channel-creation-options READ_TIMEOUT to ejb3 remote /profile=$standaloneProfile/subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:add(value="${prop.remoting-connector.read.timeout:20}",type=xnio) + echo +end-if + +if (outcome == failed) of /profile=$standaloneProfile/subsystem=ejb3/service=remote/channel-creation-options=MAX_OUTBOUND_MESSAGES/:read-resource + echo Adding channel-creation-options MAX_OUTBOUND_MESSAGES to ejb3 remote /profile=$standaloneProfile/subsystem=ejb3/service=remote/channel-creation-options=MAX_OUTBOUND_MESSAGES/:add(value=1234,type=remoting) echo end-if @@ -323,18 +328,6 @@ if (outcome == failed) of /profile=$standaloneProfile/subsystem=undertow/server= echo end-if -if (outcome == success) of /socket-binding-group=ha-sockets/socket-binding=jgroups-tcp-fd/:read-resource - echo Removing socket-binding jgroups-tcp-fd - /socket-binding-group=ha-sockets/socket-binding=jgroups-tcp-fd/:remove - echo -end-if - -if (outcome == success) of /socket-binding-group=ha-sockets/socket-binding=jgroups-udp-fd/:read-resource - echo Removing socket-binding jgroups-udp-fd - /socket-binding-group=ha-sockets/socket-binding=jgroups-udp-fd/:remove - echo -end-if - if (result == 224.0.1.105) of /socket-binding-group=ha-sockets/socket-binding=modcluster/:read-attribute(name=multicast-address) echo Adding jboss.modcluster.multicast.address property to modcluster multicast-address /socket-binding-group=ha-sockets/socket-binding=modcluster/:write-attribute(name=multicast-address,value=${jboss.modcluster.multicast.address:224.0.1.105}) @@ -546,4 +539,25 @@ if (result == false) of /profile=$standaloneProfile/subsystem=webservices/:read- echo end-if +# Migrate from 6.0.1 to 7.0.0 +if (outcome == success) of /profile=$standaloneProfile/subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:read-resource + echo Removing READ_TIMEOUT option from remote service from ejb3 subsystem + /profile=$standaloneProfile/subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:remove + echo +end-if + +if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=web/local-cache=routing:read-resource + echo Adding local cache routing to web cache container to infinispan subsystem + /profile=$standaloneProfile/subsystem=infinispan/cache-container=web/local-cache=routing/:add + echo +end-if + +if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=web/local-cache=sso:read-resource + echo Adding local cache sso to web cache container to infinispan subsystem + /profile=$standaloneProfile/subsystem=infinispan/cache-container=web/local-cache=sso/:add + /profile=$standaloneProfile/subsystem=infinispan/cache-container=web/local-cache=sso/component=locking/:add(isolation=REPEATABLE_READ) + /profile=$standaloneProfile/subsystem=infinispan/cache-container=web/local-cache=sso/component=transaction/:add(mode=BATCH) + 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 9ac2d9c16f..72424aaba4 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 @@ -297,8 +297,13 @@ if (outcome == failed) of /subsystem=elytron/:read-resource end-if if (outcome == failed) of /subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:read-resource - echo Adding channel-creation-options READ_TIMEOUT and MAX_OUTBOUND_MESSAGES to ejb3 remote + echo Adding channel-creation-options READ_TIMEOUT to ejb3 remote /subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:add(value="${prop.remoting-connector.read.timeout:20}",type=xnio) + echo +end-if + +if (outcome == failed) of /subsystem=ejb3/service=remote/channel-creation-options=MAX_OUTBOUND_MESSAGES/:read-resource + echo Adding channel-creation-options MAX_OUTBOUND_MESSAGES to ejb3 remote /subsystem=ejb3/service=remote/channel-creation-options=MAX_OUTBOUND_MESSAGES/:add(value=1234,type=remoting) echo end-if @@ -617,6 +622,18 @@ if (result == false) of /subsystem=webservices/:read-attribute(name=statistics-e echo end-if +if (outcome == failed) of /extension=org.jboss.as.weld/:read-resource + echo Adding weld extension + /extension=org.jboss.as.weld/:add + echo +end-if + +if (outcome == failed) of /subsystem=weld/:read-resource + echo Adding weld subsystem + /subsystem=weld/:add + echo +end-if + if (outcome == failed) of /extension=org.wildfly.extension.microprofile.config-smallrye/:read-resource echo Adding microprofile.config-smallrye extension... /extension=org.wildfly.extension.microprofile.config-smallrye/:add(module=org.wildfly.extension.microprofile.config-smallrye) @@ -657,4 +674,49 @@ if (outcome == failed) of /subsystem=microprofile-metrics-smallrye/:read-resourc echo end-if +# Migrate from 6.0.1 to 7.0.0 +if (outcome == success) of /subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:read-resource + echo Removing READ_TIMEOUT option from remote service from ejb3 subsystem + /subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:remove + echo +end-if + +if (outcome == failed) of /subsystem=infinispan/cache-container=web/distributed-cache=routing:read-resource + echo Adding distributed cache routing to web cache container to infinispan subsystem + /subsystem=infinispan/cache-container=web/distributed-cache=routing/:add + echo +end-if + +if (outcome == failed) of /subsystem=infinispan/cache-container=web/replicated-cache=sso:read-resource + echo Adding replicated cache sso to web cache container to infinispan subsystem + /subsystem=infinispan/cache-container=web/replicated-cache=sso/:add + /subsystem=infinispan/cache-container=web/replicated-cache=sso/component=locking/:add(isolation=REPEATABLE_READ) + /subsystem=infinispan/cache-container=web/replicated-cache=sso/component=transaction/:add(mode=BATCH) + echo +end-if + +if (outcome == failed) of /socket-binding-group=standard-sockets/socket-binding=jgroups-tcp-fd/:read-resource + echo Adding jgroups-tcp-fd socket binding to socket binding group + /socket-binding-group=standard-sockets/socket-binding=jgroups-tcp-fd/:add(interface=private,port=57600) + echo +end-if + +if (outcome == failed) of /socket-binding-group=standard-sockets/socket-binding=jgroups-udp-fd/:read-resource + echo Adding jgroups-udp-fd socket binding to socket binding group + /socket-binding-group=standard-sockets/socket-binding=jgroups-udp-fd/:add(interface=private,port=54200) + echo +end-if + +if (result == undefined) of /subsystem=jgroups/stack=tcp/protocol=FD_SOCK/:read-attribute(name=socket-binding) + echo Adding socket-binding for FD_SOCK protocol for tcp stack in jgroups subsystem + /subsystem=jgroups/stack=tcp/protocol=FD_SOCK/:write-attribute(name=socket-binding,value=jgroups-tcp-fd) + echo +end-if + +if (result == undefined) of /subsystem=jgroups/stack=udp/protocol=FD_SOCK/:read-attribute(name=socket-binding) + echo Adding socket-binding for FD_SOCK protocol for udp stack in jgroups subsystem + /subsystem=jgroups/stack=udp/protocol=FD_SOCK/:write-attribute(name=socket-binding,value=jgroups-udp-fd) + 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 05ed40d757..db1593c6df 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 @@ -282,8 +282,13 @@ if (outcome == failed) of /subsystem=elytron/:read-resource end-if if (outcome == failed) of /subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:read-resource - echo Adding channel-creation-options READ_TIMEOUT and MAX_OUTBOUND_MESSAGES to ejb3 remote + echo Adding channel-creation-options READ_TIMEOUT to ejb3 remote /subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:add(value="${prop.remoting-connector.read.timeout:20}",type=xnio) + echo +end-if + +if (outcome == failed) of /subsystem=ejb3/service=remote/channel-creation-options=MAX_OUTBOUND_MESSAGES/:read-resource + echo Adding channel-creation-options MAX_OUTBOUND_MESSAGES to ejb3 remote /subsystem=ejb3/service=remote/channel-creation-options=MAX_OUTBOUND_MESSAGES/:add(value=1234,type=remoting) echo end-if @@ -506,6 +511,18 @@ if (result == false) of /subsystem=webservices/:read-attribute(name=statistics-e echo end-if +if (outcome == failed) of /extension=org.jboss.as.weld/:read-resource + echo Adding weld extension + /extension=org.jboss.as.weld/:add + echo +end-if + +if (outcome == failed) of /subsystem=weld/:read-resource + echo Adding weld subsystem + /subsystem=weld/:add + echo +end-if + if (outcome == failed) of /extension=org.wildfly.extension.microprofile.health-smallrye/:read-resource echo Adding microprofile.health-smallrye extension... /extension=org.wildfly.extension.microprofile.health-smallrye/:add(module=org.wildfly.extension.microprofile.health-smallrye) @@ -546,4 +563,25 @@ if (outcome == failed) of /subsystem=microprofile-metrics-smallrye/:read-resourc echo end-if +# Migrate from 6.0.1 to 7.0.0 +if (outcome == success) of /subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:read-resource + echo Removing READ_TIMEOUT option from remote service from ejb3 subsystem + /subsystem=ejb3/service=remote/channel-creation-options=READ_TIMEOUT/:remove + echo +end-if + +if (outcome == failed) of /subsystem=infinispan/cache-container=web/local-cache=routing:read-resource + echo Adding local cache routing to web cache container to infinispan subsystem + /subsystem=infinispan/cache-container=web/local-cache=routing/:add + echo +end-if + +if (outcome == failed) of /subsystem=infinispan/cache-container=web/local-cache=sso:read-resource + echo Adding local cache sso to web cache container to infinispan subsystem + /subsystem=infinispan/cache-container=web/local-cache=sso/:add + /subsystem=infinispan/cache-container=web/local-cache=sso/component=locking/:add(isolation=REPEATABLE_READ) + /subsystem=infinispan/cache-container=web/local-cache=sso/component=transaction/:add(mode=BATCH) + echo +end-if + echo *** End Migration *** diff --git a/pom.xml b/pom.xml index 0caf3acd6f..0fd2ab2620 100755 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.jboss jboss-parent - 29 + 34 Keycloak @@ -41,61 +41,60 @@ ${timestamp} - 16.0.0.Final + 17.0.1.Final 1.2.10.Final 7.3.0.CD16-redhat-00001 1.2.10.Final - 8.0.0.Final + 9.0.2.Final 7.2.0.Final 0.66.19 - 1.11 - 1.14 + 2.3 4.5.4 4.4.5 0.6 1.5.0.Final 1.60 - 3.2.7 - 3.2.7 - 3.2.7 - 3.2.7 + 3.3.2 + 3.3.2 + 3.3.2 + 3.3.2 2.1.1 2.3.1 1.4.193 2.2 - 5.3.9.Final - 5.3.9.Final - 9.4.8.Final - 2.9.8 + 5.3.10.Final + 5.3.10.Final + 9.4.14.Final + 2.9.9 1.6.2 - 3.3.2.Final - 2.1.0.Final + 3.4.0.Final + 2.2.0.Final 1.0.2.Final 1.1.1.Final 1.0.1.Final 1.0.3.Final 1.2.17 - 3.6.3.Final - 3.6.3.Final + 3.7.0.Final + 3.7.0.Final 20180219.1 1.7.22 1.7.22 3.0.7 2.3.1 2.3.1 - 2.0.19.Final - 1.8.0.Final - 1.4.0.Final + 2.0.21.Final + 1.9.1.Final + 1.5.0.Final 9.2.4.v20141103 9.3.9.v20160517 9.4.2.v20170220 5.0.3 - 2.1.2 + 2.1.3 1.1.2 - 1.4.0.Final + 1.5.1.Final 5.0.3.Final 25.0-jre @@ -135,9 +134,7 @@ 3.1.7 - 1.4 1.3.5 - 3.0.2 7.5.Final 1.9.0 1.0.4 @@ -784,11 +781,6 @@ aesh ${aesh.version} - - org.aesh - aesh-readline - ${aesh.readline.version} - @@ -1469,7 +1461,6 @@ org.apache.maven.plugins maven-jar-plugin - ${jar.plugin.version} com.google.code.maven-replacer-plugin @@ -1524,26 +1515,6 @@ wildfly-server-provisioning-maven-plugin ${wildfly.build-tools.version} - - org.apache.maven.plugins - maven-enforcer-plugin - ${enforcer.plugin.version} - - - enforce-maven - - enforce - - - - - 3.1.1 - - - - - - org.apache.felix maven-bundle-plugin diff --git a/testsuite/integration-arquillian/pom.xml b/testsuite/integration-arquillian/pom.xml index f2146cae33..a6e29758c1 100644 --- a/testsuite/integration-arquillian/pom.xml +++ b/testsuite/integration-arquillian/pom.xml @@ -42,8 +42,8 @@ undertow - 15.0.1.Final - 7.0.0.Final + 16.0.0.Final + 8.0.0.Final 2.1.1.Final diff --git a/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/lb/SimpleUndertowLoadBalancer.java b/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/lb/SimpleUndertowLoadBalancer.java index b7d9d19ba5..5c7f911a56 100644 --- a/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/lb/SimpleUndertowLoadBalancer.java +++ b/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/lb/SimpleUndertowLoadBalancer.java @@ -42,6 +42,10 @@ import org.keycloak.common.util.reflections.Reflections; import org.keycloak.services.managers.AuthenticationSessionManager; import org.keycloak.testsuite.utils.tls.TLSUtils; +import io.undertow.server.handlers.proxy.RouteIteratorFactory; +import io.undertow.server.handlers.proxy.RouteIteratorFactory.ParsingCompatibility; +import io.undertow.server.handlers.proxy.RouteParsingStrategy; +import java.util.Iterator; import java.util.LinkedHashMap; import java.util.StringTokenizer; @@ -217,22 +221,37 @@ public class SimpleUndertowLoadBalancer { return host; } + private Host getRoute(String routeId) { + // There's no way to get the route from the super class, we have to use reflection + Field f = Reflections.findDeclaredField(LoadBalancingProxyClient.class, "routes"); + f.setAccessible(true); + Map routes = Reflections.getFieldValue(f, this, Map.class); + return routes == null ? null : routes.get(routeId); + } @Override - protected Host findStickyHost(HttpServerExchange exchange) { - Host stickyHost = super.findStickyHost(exchange); - + protected Iterator parseRoutes(HttpServerExchange exchange) { + Iterator stickyHostsIt = super.parseRoutes(exchange); + + if (stickyHostsIt == null) { + return null; + } + + List stickyHosts = new LinkedList<>(); + stickyHostsIt.forEachRemaining(stickyHosts::add); + CharSequence stickyHostName = stickyHosts.isEmpty() ? null : stickyHosts.iterator().next(); + Host stickyHost = stickyHostName == null ? null: getRoute(stickyHostName.toString()); if (stickyHost != null) { if (!stickyHost.isAvailable()) { log.debugf("Sticky host %s not available. Trying different hosts", stickyHost.getUri()); - return null; + return new RouteIteratorFactory(RouteParsingStrategy.SINGLE, ParsingCompatibility.MOD_JK, null).iterator(null); } else { log.debugf("Sticky host %s found and looks available", stickyHost.getUri()); } } - return stickyHost; + return stickyHosts.iterator(); } diff --git a/testsuite/integration-arquillian/test-apps/cors/database-service/pom.xml b/testsuite/integration-arquillian/test-apps/cors/database-service/pom.xml index b53985db99..41b0593a0f 100755 --- a/testsuite/integration-arquillian/test-apps/cors/database-service/pom.xml +++ b/testsuite/integration-arquillian/test-apps/cors/database-service/pom.xml @@ -31,14 +31,6 @@ http://maven.apache.org - - - jboss - jboss repo - http://repository.jboss.org/nexus/content/groups/public/ - - - org.jboss.resteasy diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/DeploymentArchiveProcessor.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/DeploymentArchiveProcessor.java index 41eb8d5951..eb108ff416 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/DeploymentArchiveProcessor.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/DeploymentArchiveProcessor.java @@ -48,16 +48,10 @@ 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.isEAP6AppServer; -import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isEAPAppServer; import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isRelative; import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isTomcatAppServer; -import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isUndertowAppServer; import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isWLSAppServer; import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isWASAppServer; -import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isWildflyAppServer; -import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isWildfly10AppServer; -import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.isWildfly9AppServer; import static org.keycloak.testsuite.arquillian.AuthServerTestEnricher.getAuthServerContextRoot; import static org.keycloak.testsuite.utils.io.IOUtil.appendChildInDocument; import static org.keycloak.testsuite.utils.io.IOUtil.documentToString; diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adduser/AddUserTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adduser/AddUserTest.java index 0370177deb..bdee6f8fae 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adduser/AddUserTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adduser/AddUserTest.java @@ -36,6 +36,7 @@ import java.io.File; import java.io.FileInputStream; import java.util.List; +import static org.hamcrest.Matchers.empty; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.notNullValue; @@ -75,7 +76,7 @@ public class AddUserTest extends AbstractKeycloakTest { new TypeReference>() { }); - assertThat("File 'keycloak-add-user.json' is empty.", realms.size() > 0, is(true)); + assertThat("File 'keycloak-add-user.json' is empty.", realms, not(empty())); //-----------------Get-Indexes-------------------// int realmIndex = getRealmIndex(realmName, realms); diff --git a/wildfly/adduser/pom.xml b/wildfly/adduser/pom.xml index 8ded57b462..d5c9ef616f 100755 --- a/wildfly/adduser/pom.xml +++ b/wildfly/adduser/pom.xml @@ -55,9 +55,5 @@ org.aesh aesh - - org.aesh - aesh-readline - diff --git a/wildfly/adduser/src/main/java/org/keycloak/wildfly/adduser/AddUser.java b/wildfly/adduser/src/main/java/org/keycloak/wildfly/adduser/AddUser.java index 573b0e0a23..a5afb404a8 100644 --- a/wildfly/adduser/src/main/java/org/keycloak/wildfly/adduser/AddUser.java +++ b/wildfly/adduser/src/main/java/org/keycloak/wildfly/adduser/AddUser.java @@ -18,11 +18,8 @@ package org.keycloak.wildfly.adduser; import com.fasterxml.jackson.core.type.TypeReference; +import org.aesh.AeshRuntimeRunner; import org.aesh.command.CommandDefinition; -import org.aesh.command.impl.container.AeshCommandContainerBuilder; -import org.aesh.command.impl.invocation.AeshInvocationProviders; -import org.aesh.command.impl.parser.CommandLineParser; -import org.aesh.command.invocation.InvocationProviders; import org.aesh.command.option.Option; import org.aesh.command.Command; import org.aesh.command.CommandNotFoundException; @@ -32,9 +29,6 @@ import org.aesh.command.invocation.CommandInvocation; import org.aesh.command.impl.registry.AeshCommandRegistryBuilder; import org.aesh.command.registry.CommandRegistry; import org.aesh.command.registry.CommandRegistryException; -import org.aesh.command.settings.Settings; -import org.aesh.command.settings.SettingsBuilder; -import org.aesh.readline.AeshContext; import org.keycloak.common.util.Base64; import org.keycloak.credential.CredentialModel; import org.keycloak.credential.hash.PasswordHashProvider; @@ -65,40 +59,98 @@ public class AddUser { private static final String DEFAULT_HASH_ALGORITH = PasswordPolicy.HASH_ALGORITHM_DEFAULT; public static void main(String[] args) { - AddUserCommand command; - try { - Settings settings = SettingsBuilder.builder().build(); - InvocationProviders invocationProviders = new AeshInvocationProviders(settings); - AeshContext aeshContext = settings.aeshContext(); - CommandLineParser> parser = new AeshCommandContainerBuilder, CommandInvocation>().create(new AddUserCommand<>()).getParser(); + AeshRuntimeRunner.builder().command(AddUserCommand.class).args(args).execute(); + } - StringBuilder sb = new StringBuilder(COMMAND_NAME); - for (String arg : args) { - sb.append(" " + arg); - } - parser.populateObject(sb.toString(), invocationProviders, aeshContext, CommandLineParser.Mode.VALIDATE); - command = parser.getCommand(); + @CommandDefinition(name= COMMAND_NAME, description = "[options...]") + public static class AddUserCommand implements Command { - if (command.isHelp()) { - printHelp(command); - } else { - String password = command.getPassword(); - checkRequired(command, "user"); + @Option(shortName = 'r', hasValue = true, description = "Name of realm to add user to") + private String realm; - if (isEmpty(command, "password")) { - password = promptForInput(); + @Option(shortName = 'u', hasValue = true, description = "Name of the user") + private String user; + + @Option(shortName = 'p', hasValue = true, description = "Password of the user") + private String password; + + @Option(hasValue = true, description = "Roles to add to the user") + private String roles; + + @Option(hasValue = true, description = "Hash iterations") + private int iterations; + + @Option(hasValue = false, description = "Enable domain mode") + private boolean domain; + + @Option(hasValue = true, description = "Define the location of the server config directory") + private String sc; + + @Option(hasValue = true, description = "Define the location of the domain config directory") + private String dc; + + @Option(shortName = 'h', hasValue = false, description = "Display this help and exit") + private boolean help; + + @Override + public CommandResult execute(CommandInvocation commandInvocation) throws InterruptedException { + try { + if (help) { + printHelp(this); + } else { + checkRequired(this, "user"); + + if (isEmpty(this, "password")) { + password = promptForInput(); + } + + File addUserFile = getAddUserFile(this); + + createUser(addUserFile, realm, user, password, roles, iterations); } - - File addUserFile = getAddUserFile(command); - - createUser(addUserFile, command.getRealm(), command.getUser(), password, command.getRoles(), command.getIterations()); + } catch (Exception e){ + System.err.println(e.getMessage()); + System.exit(1); } - } - catch (Exception e){ - System.err.println(e.getMessage()); - System.exit(1); + + return CommandResult.SUCCESS; } + public String getRealm() { + return realm; + } + + public String getUser() { + return user; + } + + public String getPassword() { + return password; + } + + public String getRoles() { + return roles; + } + + public int getIterations() { + return iterations; + } + + public boolean isDomain() { + return domain; + } + + public String getSc() { + return sc; + } + + public String getDc() { + return dc; + } + + public boolean isHelp() { + return help; + } } private static File getAddUserFile(AddUserCommand command) throws Exception { @@ -156,7 +208,7 @@ public class AddUser { realm = new RealmRepresentation(); realm.setRealm(realmName); realms.add(realm); - realm.setUsers(new LinkedList()); + realm.setUsers(new LinkedList<>()); } for (UserRepresentation u : realm.getUsers()) { @@ -168,7 +220,7 @@ public class AddUser { UserRepresentation user = new UserRepresentation(); user.setEnabled(true); user.setUsername(userName); - user.setCredentials(new LinkedList()); + user.setCredentials(new LinkedList<>()); PasswordHashProviderFactory hashProviderFactory = getHashProviderFactory(DEFAULT_HASH_ALGORITH); PasswordHashProvider hashProvider = hashProviderFactory.create(null); @@ -203,17 +255,17 @@ public class AddUser { String clientRole = cr[1]; if (user.getClientRoles() == null) { - user.setClientRoles(new HashMap>()); + user.setClientRoles(new HashMap<>()); } if (user.getClientRoles().get(client) == null) { - user.getClientRoles().put(client, new LinkedList()); + user.getClientRoles().put(client, new LinkedList<>()); } user.getClientRoles().get(client).add(clientRole); } else { if (user.getRealmRoles() == null) { - user.setRealmRoles(new LinkedList()); + user.setRealmRoles(new LinkedList<>()); } user.getRealmRoles().add(r); } @@ -250,10 +302,7 @@ public class AddUser { private static Boolean isEmpty(Command command, String field) throws Exception { Method m = command.getClass().getMethod("get" + Character.toUpperCase(field.charAt(0)) + field.substring(1)); - if (m.invoke(command) == null) { - return true; - } - return false; + return m.invoke(command) == null; } private static String promptForInput() throws Exception { @@ -270,82 +319,10 @@ public class AddUser { } private static void printHelp(Command command) throws CommandNotFoundException, CommandRegistryException { - CommandRegistry registry = new AeshCommandRegistryBuilder().command(command).create(); + CommandRegistry registry = AeshCommandRegistryBuilder.builder().command(command).create(); CommandContainer commandContainer = registry.getCommand(command.getClass().getAnnotation(CommandDefinition.class).name(), null); String help = commandContainer.printHelp(null); System.out.println(help); } - @CommandDefinition(name= COMMAND_NAME, description = "[options...]") - public static class AddUserCommand implements Command { - - @Option(shortName = 'r', hasValue = true, description = "Name of realm to add user to") - private String realm; - - @Option(shortName = 'u', hasValue = true, description = "Name of the user") - private String user; - - @Option(shortName = 'p', hasValue = true, description = "Password of the user") - private String password; - - @Option(hasValue = true, description = "Roles to add to the user") - private String roles; - - @Option(hasValue = true, description = "Hash iterations") - private int iterations; - - @Option(hasValue = false, description = "Enable domain mode") - private boolean domain; - - @Option(hasValue = true, description = "Define the location of the server config directory") - private String sc; - - @Option(hasValue = true, description = "Define the location of the domain config directory") - private String dc; - - @Option(shortName = 'h', hasValue = false, description = "Display this help and exit") - private boolean help; - - @Override - public CommandResult execute(CommandInvocation commandInvocation) throws InterruptedException { - return CommandResult.SUCCESS; - } - - public String getRealm() { - return realm; - } - - public String getUser() { - return user; - } - - public String getPassword() { - return password; - } - - public String getRoles() { - return roles; - } - - public int getIterations() { - return iterations; - } - - public boolean isDomain() { - return domain; - } - - public String getSc() { - return sc; - } - - public String getDc() { - return dc; - } - - public boolean isHelp() { - return help; - } - } - } diff --git a/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml index f305807e27..303baae581 100755 --- a/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml +++ b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml @@ -61,6 +61,11 @@ + + + + + @@ -119,11 +124,16 @@ + + + + + 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 80fddfa985..16530b93f5 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 - +