KEYCLOAK-9987 Upgrade to Wildfly17

Co-Authored-By: hmlnarik <hmlnarik@redhat.com>
This commit is contained in:
Hynek Mlnarik 2019-06-22 10:58:13 +02:00 committed by Hynek Mlnařík
parent 5f5cb6cb7b
commit 3d4283fac9
24 changed files with 348 additions and 258 deletions

View file

@ -63,40 +63,26 @@
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-naming</artifactId>
<version>${jboss.as.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-server</artifactId>
<version>${jboss.as.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ee</artifactId>
<version>${jboss.as.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-web</artifactId>
<version>${jboss.as.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
<!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
projects that depend on this project.-->
<scope>provided</scope>
<optional>true</optional>
<version>1.0.0.Final</version>
<artifactId>jboss-logging-annotations</artifactId>
</dependency>
<dependency>

View file

@ -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;

View file

@ -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;
/**

View file

@ -87,17 +87,7 @@
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
<!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
projects that depend on this project.-->
<scope>provided</scope>
<optional>true</optional>
<version>1.0.0.Final</version>
<artifactId>jboss-logging-annotations</artifactId>
</dependency>
<dependency>

View file

@ -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;

View file

@ -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;
/**

View file

@ -21,7 +21,7 @@
<parent>
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
<version>28</version>
<version>34</version>
</parent>
<groupId>org.keycloak.bom</groupId>

View file

@ -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;
}

View file

@ -42,6 +42,7 @@
<subsystem supplement="standalone-wildfly">elytron.xml</subsystem>
<subsystem>security.xml</subsystem>
<subsystem>transactions.xml</subsystem>
<subsystem>weld.xml</subsystem>
<subsystem>microprofile-config-smallrye.xml</subsystem>
<subsystem>microprofile-health-smallrye.xml</subsystem>
<subsystem>microprofile-metrics-smallrye.xml</subsystem>

View file

@ -40,6 +40,7 @@
<subsystem supplement="standalone-wildfly">elytron.xml</subsystem>
<subsystem>security.xml</subsystem>
<subsystem>transactions.xml</subsystem>
<subsystem>weld.xml</subsystem>
<subsystem>microprofile-config-smallrye.xml</subsystem>
<subsystem>microprofile-health-smallrye.xml</subsystem>
<subsystem>microprofile-metrics-smallrye.xml</subsystem>

View file

@ -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 ***

View file

@ -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 ***

View file

@ -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 ***

View file

@ -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 ***

71
pom.xml
View file

@ -24,7 +24,7 @@
<parent>
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
<version>29</version>
<version>34</version>
</parent>
<name>Keycloak</name>
@ -41,61 +41,60 @@
<product.build-time>${timestamp}</product.build-time>
<wildfly.version>16.0.0.Final</wildfly.version>
<wildfly.version>17.0.1.Final</wildfly.version>
<wildfly.build-tools.version>1.2.10.Final</wildfly.build-tools.version>
<eap.version>7.3.0.CD16-redhat-00001</eap.version>
<eap.build-tools.version>1.2.10.Final</eap.build-tools.version>
<wildfly.core.version>8.0.0.Final</wildfly.core.version>
<wildfly.core.version>9.0.2.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.11</aesh.version>
<aesh.readline.version>1.14</aesh.readline.version>
<aesh.version>2.3</aesh.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.7</cxf.version>
<cxf.jetty.version>3.2.7</cxf.jetty.version>
<cxf.jaxrs.version>3.2.7</cxf.jaxrs.version>
<cxf.undertow.version>3.2.7</cxf.undertow.version>
<cxf.version>3.3.2</cxf.version>
<cxf.jetty.version>3.3.2</cxf.jetty.version>
<cxf.jaxrs.version>3.3.2</cxf.jaxrs.version>
<cxf.undertow.version>3.3.2</cxf.undertow.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.9.Final</hibernate.core.version>
<hibernate.c3p0.version>5.3.9.Final</hibernate.c3p0.version>
<infinispan.version>9.4.8.Final</infinispan.version>
<jackson.version>2.9.8</jackson.version>
<hibernate.core.version>5.3.10.Final</hibernate.core.version>
<hibernate.c3p0.version>5.3.10.Final</hibernate.c3p0.version>
<infinispan.version>9.4.14.Final</infinispan.version>
<jackson.version>2.9.9</jackson.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.version>3.4.0.Final</jboss.logging.version>
<jboss.logging.tools.version>2.2.0.Final</jboss.logging.tools.version>
<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.3.Final</resteasy.version>
<resteasy.undertow.version>3.6.3.Final</resteasy.undertow.version>
<resteasy.version>3.7.0.Final</resteasy.version>
<resteasy.undertow.version>3.7.0.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.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.19.Final</undertow.version>
<elytron.version>1.8.0.Final</elytron.version>
<elytron.undertow-server.version>1.4.0.Final</elytron.undertow-server.version>
<undertow.version>2.0.21.Final</undertow.version>
<elytron.version>1.9.1.Final</elytron.version>
<elytron.undertow-server.version>1.5.0.Final</elytron.undertow-server.version>
<jetty92.version>9.2.4.v20141103</jetty92.version>
<jetty93.version>9.3.9.v20160517</jetty93.version>
<jetty94.version>9.4.2.v20170220</jetty94.version>
<woodstox.version>5.0.3</woodstox.version>
<xmlsec.version>2.1.2</xmlsec.version>
<xmlsec.version>2.1.3</xmlsec.version>
<glassfish.json.version>1.1.2</glassfish.json.version>
<wildfly.common.version>1.4.0.Final</wildfly.common.version>
<wildfly.common.version>1.5.1.Final</wildfly.common.version>
<picketbox.version>5.0.3.Final</picketbox.version>
<google.guava.version>25.0-jre</google.guava.version>
@ -135,9 +134,7 @@
<subethasmtp.version>3.1.7</subethasmtp.version>
<!-- Maven Plugins -->
<enforcer.plugin.version>1.4</enforcer.plugin.version>
<replacer.plugin.version>1.3.5</replacer.plugin.version>
<jar.plugin.version>3.0.2</jar.plugin.version>
<jboss.as.plugin.version>7.5.Final</jboss.as.plugin.version>
<jmeter.plugin.version>1.9.0</jmeter.plugin.version>
<jmeter.analysis.plugin.version>1.0.4</jmeter.analysis.plugin.version>
@ -784,11 +781,6 @@
<artifactId>aesh</artifactId>
<version>${aesh.version}</version>
</dependency>
<dependency>
<groupId>org.aesh</groupId>
<artifactId>aesh-readline</artifactId>
<version>${aesh.readline.version}</version>
</dependency>
<!-- keycloak -->
<dependency>
@ -1469,7 +1461,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${jar.plugin.version}</version>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
@ -1524,26 +1515,6 @@
<artifactId>wildfly-server-provisioning-maven-plugin</artifactId>
<version>${wildfly.build-tools.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${enforcer.plugin.version}</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.1.1</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>

View file

@ -42,8 +42,8 @@
<app.server>undertow</app.server>
<!-- Wildfly deprecated versions -->
<wildfly.deprecated.version>15.0.1.Final</wildfly.deprecated.version>
<wildfly.deprecated.wildfly.core.version>7.0.0.Final</wildfly.deprecated.wildfly.core.version>
<wildfly.deprecated.version>16.0.0.Final</wildfly.deprecated.version>
<wildfly.deprecated.wildfly.core.version>8.0.0.Final</wildfly.deprecated.wildfly.core.version>
<wildfly.deprecated.arquillian.wildfly.container>2.1.1.Final</wildfly.deprecated.arquillian.wildfly.container>
<!--component versions-->

View file

@ -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<String, Host> 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<CharSequence> parseRoutes(HttpServerExchange exchange) {
Iterator<CharSequence> stickyHostsIt = super.parseRoutes(exchange);
if (stickyHostsIt == null) {
return null;
}
List<CharSequence> 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();
}

View file

@ -31,14 +31,6 @@
<description/>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>jboss</id>
<name>jboss repo</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>

View file

@ -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;

View file

@ -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<List<RealmRepresentation>>() {
});
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);

View file

@ -55,9 +55,5 @@
<groupId>org.aesh</groupId>
<artifactId>aesh</artifactId>
</dependency>
<dependency>
<groupId>org.aesh</groupId>
<artifactId>aesh-readline</artifactId>
</dependency>
</dependencies>
</project>

View file

@ -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<AddUserCommand<CommandInvocation>> parser = new AeshCommandContainerBuilder<AddUserCommand<CommandInvocation>, CommandInvocation>().create(new AddUserCommand<>()).getParser();
StringBuilder sb = new StringBuilder(COMMAND_NAME);
for (String arg : args) {
sb.append(" " + arg);
AeshRuntimeRunner.builder().command(AddUserCommand.class).args(args).execute();
}
parser.populateObject(sb.toString(), invocationProviders, aeshContext, CommandLineParser.Mode.VALIDATE);
command = parser.getCommand();
if (command.isHelp()) {
printHelp(command);
@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 {
try {
if (help) {
printHelp(this);
} else {
String password = command.getPassword();
checkRequired(command, "user");
checkRequired(this, "user");
if (isEmpty(command, "password")) {
if (isEmpty(this, "password")) {
password = promptForInput();
}
File addUserFile = getAddUserFile(command);
File addUserFile = getAddUserFile(this);
createUser(addUserFile, command.getRealm(), command.getUser(), password, command.getRoles(), command.getIterations());
createUser(addUserFile, realm, user, password, roles, iterations);
}
}
catch (Exception e){
} 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<UserRepresentation>());
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<CredentialRepresentation>());
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<String, List<String>>());
user.setClientRoles(new HashMap<>());
}
if (user.getClientRoles().get(client) == null) {
user.getClientRoles().put(client, new LinkedList<String>());
user.getClientRoles().put(client, new LinkedList<>());
}
user.getClientRoles().get(client).add(clientRole);
} else {
if (user.getRealmRoles() == null) {
user.setRealmRoles(new LinkedList<String>());
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<CI extends CommandInvocation> implements Command<CI> {
@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;
}
}
}

View file

@ -61,6 +61,11 @@
<transaction mode="BATCH"/>
<file-store passivation="true" purge="false"/>
</local-cache>
<local-cache name="sso">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
</local-cache>
<local-cache name="routing"/>
</cache-container>
<cache-container name="ejb" aliases="sfsb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan">
<local-cache name="passivation">
@ -119,11 +124,16 @@
</cache-container>
<cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan">
<transport lock-timeout="60000"/>
<replicated-cache name="sso">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
</replicated-cache>
<distributed-cache name="dist">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
<file-store/>
</distributed-cache>
<distributed-cache name="routing"/>
</cache-container>
<cache-container name="ejb" aliases="sfsb" default-cache="dist" module="org.wildfly.clustering.ejb.infinispan">
<transport lock-timeout="60000"/>

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:8.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}">
<subsystem xmlns="urn:jboss:domain:undertow:9.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}">
<buffer-cache name="default"/>
<server name="default-server">
<?AJP?>