keycloak-memoizeit
Changes
distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems.xml 19(+15 -4)
distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems-ha.xml 36(+36 -0)
distribution/server-overlay/pom.xml 4(+2 -2)
distribution/subsystem-war/pom.xml 12(+12 -0)
distribution/subsystem-war/src/main/java/org/keycloak/provider/wildfly/InfinispanCacheActivator.java 29(+29 -0)
Details
diff --git a/distribution/feature-packs/server-feature-pack/feature-pack-build.xml b/distribution/feature-packs/server-feature-pack/feature-pack-build.xml
index 8737c28..48b588e 100644
--- a/distribution/feature-packs/server-feature-pack/feature-pack-build.xml
+++ b/distribution/feature-packs/server-feature-pack/feature-pack-build.xml
@@ -4,6 +4,9 @@
</dependencies>
<config>
<standalone template="configuration/standalone/template.xml" subsystems="configuration/standalone/subsystems.xml" output-file="standalone/configuration/standalone.xml" />
+ <standalone template="configuration/standalone/template.xml" subsystems="configuration/standalone/subsystems-ha.xml" output-file="standalone/configuration/standalone-ha.xml">
+ <property name="jgroups.supplement" value="" />
+ </standalone>
<domain template="configuration/domain/template.xml" subsystems="configuration/domain/subsystems.xml" output-file="domain/configuration/domain.xml" />
</config>
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 d20bf2e..f1dff32 100644
--- 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
@@ -3,21 +3,32 @@
<config>
<subsystems>
<subsystem>logging.xml</subsystem>
- <!-- resteasy complains if bean-validation is missing -->
+ <subsystem>batch.xml</subsystem>
<subsystem>bean-validation.xml</subsystem>
<subsystem>keycloak-datasources.xml</subsystem>
- <subsystem supplement="web-build">ee.xml</subsystem>
+ <subsystem>ee.xml</subsystem>
+ <subsystem>ejb3.xml</subsystem>
<subsystem>io.xml</subsystem>
- <subsystem>infinispan.xml</subsystem>
+ <subsystem>keycloak-infinispan.xml</subsystem>
<subsystem>jaxrs.xml</subsystem>
<subsystem>jca.xml</subsystem>
+ <subsystem>jdr.xml</subsystem>
+ <subsystem>jmx.xml</subsystem>
<subsystem>jpa.xml</subsystem>
- <subsystem supplement="web-build">naming.xml</subsystem>
+ <subsystem>jsf.xml</subsystem>
+ <subsystem>mail.xml</subsystem>
+ <subsystem>naming.xml</subsystem>
+ <subsystem>pojo.xml</subsystem>
+ <subsystem>remoting.xml</subsystem>
+ <subsystem>resource-adapters.xml</subsystem>
<subsystem>request-controller.xml</subsystem>
+ <subsystem>sar.xml</subsystem>
<subsystem>security-manager.xml</subsystem>
<subsystem>security.xml</subsystem>
<subsystem>transactions.xml</subsystem>
<subsystem>undertow.xml</subsystem>
+ <subsystem>webservices.xml</subsystem>
+ <subsystem>weld.xml</subsystem>
<subsystem>keycloak-server.xml</subsystem>
</subsystems>
</config>
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
new file mode 100644
index 0000000..c402990
--- /dev/null
+++ b/distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems-ha.xml
@@ -0,0 +1,36 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->
+<config>
+ <subsystems>
+ <subsystem>logging.xml</subsystem>
+ <subsystem>batch.xml</subsystem>
+ <subsystem>bean-validation.xml</subsystem>
+ <subsystem>keycloak-datasources.xml</subsystem>
+ <subsystem>ee.xml</subsystem>
+ <subsystem supplement="ha">ejb3.xml</subsystem>
+ <subsystem>io.xml</subsystem>
+ <subsystem supplement="ha">keycloak-infinispan.xml</subsystem>
+ <subsystem>jaxrs.xml</subsystem>
+ <subsystem>jca.xml</subsystem>
+ <subsystem>jdr.xml</subsystem>
+ <subsystem>jgroups.xml</subsystem>
+ <subsystem>jmx.xml</subsystem>
+ <subsystem>jpa.xml</subsystem>
+ <subsystem>jsf.xml</subsystem>
+ <subsystem>mail.xml</subsystem>
+ <subsystem>mod_cluster.xml</subsystem>
+ <subsystem>naming.xml</subsystem>
+ <subsystem>pojo.xml</subsystem>
+ <subsystem>remoting.xml</subsystem>
+ <subsystem>resource-adapters.xml</subsystem>
+ <subsystem>request-controller.xml</subsystem>
+ <subsystem>sar.xml</subsystem>
+ <subsystem>security-manager.xml</subsystem>
+ <subsystem>security.xml</subsystem>
+ <subsystem>transactions.xml</subsystem>
+ <subsystem supplement="ha">undertow.xml</subsystem>
+ <subsystem>webservices.xml</subsystem>
+ <subsystem>weld.xml</subsystem>
+ <subsystem>keycloak-server.xml</subsystem>
+ </subsystems>
+</config>
\ No newline at end of file
diff --git a/distribution/server-overlay/eap6/eap6-server-overlay/src/main/xslt/standalone.xsl b/distribution/server-overlay/eap6/eap6-server-overlay/src/main/xslt/standalone.xsl
index 6f0abad..69ea1c1 100755
--- a/distribution/server-overlay/eap6/eap6-server-overlay/src/main/xslt/standalone.xsl
+++ b/distribution/server-overlay/eap6/eap6-server-overlay/src/main/xslt/standalone.xsl
@@ -8,6 +8,7 @@
exclude-result-prefixes="xalan j ds k sec">
<xsl:param name="config"/>
+ <xsl:variable name="log" select="'urn:jboss:domain:logging:'"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
@@ -59,6 +60,15 @@
</xsl:copy>
</xsl:template>
+ <xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $log)]">
+ <xsl:copy>
+ <xsl:apply-templates select="node()|@*"/>
+ <logger category="org.jboss.resteasy.resteasy_jaxrs.i18n">
+ <level name="ERROR"/>
+ </logger>
+ </xsl:copy>
+ </xsl:template>
+
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
distribution/server-overlay/pom.xml 4(+2 -2)
diff --git a/distribution/server-overlay/pom.xml b/distribution/server-overlay/pom.xml
index f05e486..fff09c7 100755
--- a/distribution/server-overlay/pom.xml
+++ b/distribution/server-overlay/pom.xml
@@ -8,9 +8,9 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <artifactId>keycloak-server-overlay</artifactId>
+ <artifactId>keycloak-server-overlay-parent</artifactId>
<packaging>pom</packaging>
- <name>Keycloak Server Overlay Distributions</name>
+ <name>Keycloak Server Overlay Parent</name>
<description/>
diff --git a/distribution/server-overlay/wf9-server-overlay/pom.xml b/distribution/server-overlay/wf9-server-overlay/pom.xml
index 5219ebc..03353a7 100755
--- a/distribution/server-overlay/wf9-server-overlay/pom.xml
+++ b/distribution/server-overlay/wf9-server-overlay/pom.xml
@@ -8,9 +8,9 @@
<relativePath>../../../pom.xml</relativePath>
</parent>
- <artifactId>keycloak-wf9-server-overlay</artifactId>
+ <artifactId>keycloak-server-overlay</artifactId>
<packaging>pom</packaging>
- <name>Keycloak Wildfly 9 Server Overlay Distribution</name>
+ <name>Keycloak Server Overlay Distribution</name>
<description/>
<dependencies>
distribution/subsystem-war/pom.xml 12(+12 -0)
diff --git a/distribution/subsystem-war/pom.xml b/distribution/subsystem-war/pom.xml
index 4be6a11..66c20fd 100755
--- a/distribution/subsystem-war/pom.xml
+++ b/distribution/subsystem-war/pom.xml
@@ -15,6 +15,18 @@
<name>Keycloak Subsystem Server WAR</name>
<description/>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.msc</groupId>
+ <artifactId>jboss-msc</artifactId>
+ <version>1.2.6.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.keycloak</groupId>
+ <artifactId>keycloak-core</artifactId>
+ </dependency>
+ </dependencies>
+
<build>
<finalName>auth-server</finalName>
<plugins>
diff --git a/distribution/subsystem-war/src/main/java/org/keycloak/provider/wildfly/InfinispanCacheActivator.java b/distribution/subsystem-war/src/main/java/org/keycloak/provider/wildfly/InfinispanCacheActivator.java
new file mode 100644
index 0000000..943f7a4
--- /dev/null
+++ b/distribution/subsystem-war/src/main/java/org/keycloak/provider/wildfly/InfinispanCacheActivator.java
@@ -0,0 +1,29 @@
+package org.keycloak.provider.wildfly;
+
+import org.jboss.msc.service.*;
+import org.keycloak.Config;
+
+import java.util.List;
+
+/**
+ * Used to add a dependency on Infinispan caches to make sure they are started.
+ *
+ * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
+ */
+public class InfinispanCacheActivator implements ServiceActivator {
+
+ private static final ServiceName cacheContainerService = ServiceName.of("jboss", "infinispan", "keycloak");
+
+ @Override
+ public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
+ if (context.getServiceRegistry().getService(cacheContainerService) != null) {
+ ServiceTarget st = context.getServiceTarget();
+ st.addDependency(cacheContainerService);
+ st.addDependency(cacheContainerService.append("realms"));
+ st.addDependency(cacheContainerService.append("users"));
+ st.addDependency(cacheContainerService.append("sessions"));
+ st.addDependency(cacheContainerService.append("loginFailures"));
+ }
+ }
+
+}
diff --git a/distribution/subsystem-war/src/main/resources/META-INF/services/org.jboss.msc.service.ServiceActivator b/distribution/subsystem-war/src/main/resources/META-INF/services/org.jboss.msc.service.ServiceActivator
new file mode 100644
index 0000000..bfed2e1
--- /dev/null
+++ b/distribution/subsystem-war/src/main/resources/META-INF/services/org.jboss.msc.service.ServiceActivator
@@ -0,0 +1 @@
+org.keycloak.provider.wildfly.InfinispanCacheActivator
\ No newline at end of file
diff --git a/distribution/subsystem-war/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/distribution/subsystem-war/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
index 816245c..f67884e 100755
--- a/distribution/subsystem-war/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
+++ b/distribution/subsystem-war/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
@@ -56,6 +56,8 @@
<module name="org.jboss.resteasy.resteasy-jackson-provider" services="import"/>
<module name="org.jboss.resteasy.resteasy-multipart-provider" services="import"/>
<module name="org.jboss.resteasy.resteasy-jaxrs"/>
+
+ <module name="org.jboss.msc"/>
</dependencies>
<exclusions>
<module name="org.jboss.resteasy.resteasy-jackson2-provider"/>
diff --git a/docbook/reference/en/en-US/modules/clustering.xml b/docbook/reference/en/en-US/modules/clustering.xml
index 194a95b..2b352bb 100755
--- a/docbook/reference/en/en-US/modules/clustering.xml
+++ b/docbook/reference/en/en-US/modules/clustering.xml
@@ -57,31 +57,7 @@
cache.
</para>
<para>
- To configure the required Infinspan caches open <literal>standalone/configuration/standalone-ha.xml</literal> and add:
-<programlisting>
-<![CDATA[
-<subsystem xmlns="urn:jboss:domain:infinispan:2.0">
- <cache-container name="keycloak" jndi-name="infinispan/Keycloak" start="EAGER">
- <transport lock-timeout="60000"/>
- <invalidation-cache name="realms" mode="SYNC" start="EAGER"/>
- <invalidation-cache name="users" mode="SYNC" start="EAGER"/>
- <distributed-cache name="sessions" mode="SYNC" owners="1" start="EAGER"/>
- <distributed-cache name="loginFailures" mode="SYNC" owners="1" start="EAGER"/>
- </cache-container>
- ...
-</subsystem>
-]]>
-</programlisting>
- </para>
- <para>
- For more advanced options refer to the
- <ulink url="http://docs.jboss.org/author/display/WFLY8/Infinispan+Subsystem">Infinispan Subsystem</ulink>
- and
- <ulink url="http://www.infinispan.org/docs/6.0.x/user_guide/user_guide.html">Infinispan</ulink>
- documentation.
- </para>
- <para>
- Next open <literal>standalone/configuration/keycloak-server.json</literal> and add:
+ To enable clustering in Keycloak open <literal>standalone/configuration/keycloak-server.json</literal> and add:
<programlisting>
"connectionsInfinispan": {
"default" : {
diff --git a/integration/wildfly/wf9-server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml b/integration/wildfly/wf9-server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml
new file mode 100644
index 0000000..30706ac
--- /dev/null
+++ b/integration/wildfly/wf9-server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml
@@ -0,0 +1,93 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->
+<config default-supplement="default">
+ <extension-module>org.jboss.as.clustering.infinispan</extension-module>
+ <subsystem xmlns="urn:jboss:domain:infinispan:3.0">
+ <?CACHE-CONTAINERS?>
+ </subsystem>
+ <supplement name="default">
+ <replacement placeholder="CACHE-CONTAINERS">
+ <cache-container name="server" default-cache="default" module="org.wildfly.clustering.server">
+ <local-cache name="default">
+ <transaction mode="BATCH"/>
+ </local-cache>
+ </cache-container>
+ <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
+ <local-cache name="passivation">
+ <transaction mode="BATCH"/>
+ <file-store passivation="true" purge="false"/>
+ </local-cache>
+ <local-cache name="persistent">
+ <transaction mode="BATCH"/>
+ <file-store passivation="false" purge="false"/>
+ </local-cache>
+ </cache-container>
+ <cache-container name="ejb" aliases="sfsb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan">
+ <local-cache name="passivation">
+ <transaction mode="BATCH"/>
+ <file-store passivation="true" purge="false"/>
+ </local-cache>
+ <local-cache name="persistent">
+ <transaction mode="BATCH"/>
+ <file-store passivation="false" purge="false"/>
+ </local-cache>
+ </cache-container>
+ <cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan">
+ <local-cache name="entity">
+ <transaction mode="NON_XA"/>
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <local-cache name="local-query">
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <local-cache name="timestamps"/>
+ </cache-container>
+ </replacement>
+ </supplement>
+ <supplement name="ha">
+ <replacement placeholder="CACHE-CONTAINERS">
+ <cache-container name="keycloak" jndi-name="infinispan/Keycloak">
+ <transport lock-timeout="60000"/>
+ <invalidation-cache name="realms" mode="SYNC"/>
+ <invalidation-cache name="users" mode="SYNC"/>
+ <distributed-cache name="sessions" mode="SYNC" owners="1"/>
+ <distributed-cache name="loginFailures" mode="SYNC" owners="1"/>
+ </cache-container>
+ <cache-container name="server" aliases="singleton cluster" default-cache="default" module="org.wildfly.clustering.server">
+ <transport lock-timeout="60000"/>
+ <replicated-cache name="default" mode="SYNC">
+ <transaction mode="BATCH"/>
+ </replicated-cache>
+ </cache-container>
+ <cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan">
+ <transport lock-timeout="60000"/>
+ <distributed-cache name="dist" mode="ASYNC" l1-lifespan="0" owners="2">
+ <transaction mode="BATCH"/>
+ <file-store/>
+ </distributed-cache>
+ </cache-container>
+ <cache-container name="ejb" aliases="sfsb" default-cache="dist" module="org.wildfly.clustering.ejb.infinispan">
+ <transport lock-timeout="60000"/>
+ <distributed-cache name="dist" mode="ASYNC" l1-lifespan="0" owners="2">
+ <transaction mode="BATCH"/>
+ <file-store/>
+ </distributed-cache>
+ </cache-container>
+ <cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan">
+ <transport lock-timeout="60000"/>
+ <invalidation-cache name="entity" mode="SYNC">
+ <transaction mode="NON_XA"/>
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </invalidation-cache>
+ <local-cache name="local-query">
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <replicated-cache name="timestamps" mode="ASYNC"/>
+ </cache-container>
+ </replacement>
+ </supplement>
+</config>
\ No newline at end of file