keycloak-aplcache

Details

diff --git a/distribution/feature-packs/pom.xml b/distribution/feature-packs/pom.xml
index a140795..b5988a6 100644
--- a/distribution/feature-packs/pom.xml
+++ b/distribution/feature-packs/pom.xml
@@ -34,32 +34,4 @@
         <module>adapter-feature-pack</module>
         <module>server-feature-pack</module>
     </modules>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>unpack-client-cli-dist</id>
-                        <phase>prepare-package</phase>
-                        <goals>
-                            <goal>unpack</goal>
-                        </goals>
-                        <configuration>
-                            <artifactItems>
-                                <artifactItem>
-                                    <groupId>org.keycloak</groupId>
-                                    <artifactId>keycloak-themes</artifactId>
-                                    <outputDirectory>${project.build.directory}/unpacked</outputDirectory>
-                                </artifactItem>
-                            </artifactItems>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
 </project>
diff --git a/distribution/feature-packs/server-feature-pack/assembly.xml b/distribution/feature-packs/server-feature-pack/assembly.xml
index 631a62c..1fdde3f 100644
--- a/distribution/feature-packs/server-feature-pack/assembly.xml
+++ b/distribution/feature-packs/server-feature-pack/assembly.xml
@@ -24,63 +24,10 @@
     </formats>
     <includeBaseDirectory>false</includeBaseDirectory>
 
-    <!-- If war is filtered it will get corrupted. Only need to filter module.xml -->
     <fileSets>
         <fileSet>
             <directory>target/${project.build.finalName}</directory>
-            <outputDirectory/>    
-            <filtered>true</filtered>
-            <includes>
-                <include>**/module.xml</include>
-                <include>**/MANIFEST.MF</include>
-                <include>**/template.xml</include>
-                <include>**/host.xml</include>
-                <include>**/host-master.xml</include>
-                <include>**/host-slave.xml</include>
-            </includes>
-        </fileSet>
-        <fileSet>
-            <directory>target/${project.build.finalName}</directory>
-            <outputDirectory/>    
-            <filtered>false</filtered>
-            <excludes>
-               <exclude>**/module.xml</exclude>
-               <exclude>**/MANIFEST.MF</exclude>
-               <exclude>**/template.xml</exclude>
-               <exclude>**/host.xml</exclude>
-               <exclude>**/host-master.xml</exclude>
-               <exclude>**/host-slave.xml</exclude>
-            </excludes>
-        </fileSet>
-        <fileSet>
-            <directory>../../../</directory>
-            <includes>
-                <include>License.html</include>
-            </includes>
-            <outputDirectory>content</outputDirectory>
-        </fileSet>
-        <fileSet>
-            <directory>target/unpacked/theme</directory>
-            <outputDirectory>content/themes</outputDirectory>
-            <includes>
-                <include>**/**</include>
-            </includes>
-        </fileSet>
-        <fileSet>
-            <directory>src/main/resources/identity</directory>
-            <outputDirectory>content/bin</outputDirectory>
-            <includes>
-                <include>**/product.conf</include>
-            </includes>
-            <filtered>true</filtered>
-        </fileSet>
-        <fileSet>
-            <directory>src/main/resources/identity/module</directory>
-            <outputDirectory>modules/system/layers/keycloak/org/jboss/as/product/${product.slot}</outputDirectory>
-            <includes>
-                <include>**/*</include>
-            </includes>
-            <filtered>true</filtered>
+            <outputDirectory/>
         </fileSet>
     </fileSets>
 </assembly>
diff --git a/distribution/feature-packs/server-feature-pack/pom.xml b/distribution/feature-packs/server-feature-pack/pom.xml
index 99df51f..46fee49 100644
--- a/distribution/feature-packs/server-feature-pack/pom.xml
+++ b/distribution/feature-packs/server-feature-pack/pom.xml
@@ -52,6 +52,149 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>unpack-theme</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.keycloak</groupId>
+                                    <artifactId>keycloak-themes</artifactId>
+                                    <outputDirectory>target/unpacked-themes</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>copy-configuration</id>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>copy-resources</goal>
+                            </goals>
+                            <configuration>
+                                <outputDirectory>target/resources/configuration</outputDirectory>
+                                <resources>
+                                    <resource>
+                                        <directory>src/main/resources/configuration</directory>
+                                        <filtering>true</filtering>
+                                    </resource>
+                                </resources>
+                            </configuration>
+                        </execution>
+                        <execution>
+                            <id>copy-modules</id>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>copy-resources</goal>
+                            </goals>
+                            <configuration>
+                                <outputDirectory>target/resources/modules</outputDirectory>
+                                <resources>
+                                    <resource>
+                                        <directory>src/main/resources/modules</directory>
+                                    </resource>
+                                </resources>
+                            </configuration>
+                        </execution>
+                        <execution>
+                            <id>copy-content</id>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>copy-resources</goal>
+                            </goals>
+                            <configuration>
+                                <outputDirectory>target/resources/content</outputDirectory>
+                                <resources>
+                                    <resource>
+                                        <directory>src/main/resources/content</directory>
+                                    </resource>
+                                </resources>
+                            </configuration>
+                        </execution>
+                        <execution>
+                            <id>copy-identity</id>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>copy-resources</goal>
+                            </goals>
+                            <configuration>
+                                <outputDirectory>target/resources/content/bin</outputDirectory>
+                                <resources>
+                                    <resource>
+                                        <directory>src/main/resources/identity</directory>
+                                        <includes>
+                                            <include>**/product.conf</include>
+                                        </includes>
+                                        <filtering>true</filtering>
+                                    </resource>
+                                </resources>
+                            </configuration>
+                        </execution>
+                        <execution>
+                            <id>copy-identity-module</id>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>copy-resources</goal>
+                            </goals>
+                            <configuration>
+                                <outputDirectory>target/resources/modules/system/layers/keycloak/org/jboss/as/product/${product.slot}</outputDirectory>
+                                <resources>
+                                    <resource>
+                                        <directory>src/main/resources/identity/module</directory>
+                                        <filtering>true</filtering>
+                                    </resource>
+                                </resources>
+                            </configuration>
+                        </execution>
+                        <execution>
+                            <id>copy-themes</id>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>copy-resources</goal>
+                            </goals>
+                            <configuration>
+                                <outputDirectory>target/resources/content/themes</outputDirectory>
+                                <resources>
+                                    <resource>
+                                        <directory>target/unpacked-themes/theme</directory>
+                                    </resource>
+                                </resources>
+                            </configuration>
+                        </execution>
+                        <execution>
+                            <id>copy-license</id>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>copy-resources</goal>
+                            </goals>
+                            <configuration>
+                                <outputDirectory>target/resources/content</outputDirectory>
+                                <resources>
+                                    <resource>
+                                        <directory>../../../</directory>
+                                        <includes>
+                                            <include>License.html</include>
+                                        </includes>
+                                    </resource>
+                                </resources>
+                            </configuration>
+                        </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
                 <groupId>org.wildfly.build</groupId>
                 <artifactId>wildfly-feature-pack-build-maven-plugin</artifactId>
                 <executions>
@@ -63,6 +206,7 @@
                         <phase>compile</phase>
                         <configuration>
                             <config-file>feature-pack-build.xml</config-file>
+                            <resources-dir>target/resources</resources-dir>
                         </configuration>
                     </execution>
                 </executions>
@@ -116,6 +260,50 @@
                 </dependency>
             </dependencies>
         </profile>
+
+        <!-- Temporary profile to test with WildFly 11 -->
+        <profile>
+            <id>wf11</id>
+
+            <properties>
+                <xmlns.domain>urn:jboss:domain:5.0</xmlns.domain>
+            </properties>
+
+            <dependencies>
+                <dependency>
+                    <groupId>org.wildfly</groupId>
+                    <artifactId>wildfly-feature-pack</artifactId>
+                    <version>${wildfly11.version}</version>
+                    <type>zip</type>
+                </dependency>
+            </dependencies>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-resources-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>copy-configuration-wf11</id>
+                                <phase>validate</phase>
+                                <goals>
+                                    <goal>copy-resources</goal>
+                                </goals>
+                                <configuration>
+                                    <outputDirectory>target/resources/configuration</outputDirectory>
+                                    <resources>
+                                        <resource>
+                                            <directory>src/main/resources-wf11/configuration</directory>
+                                            <filtering>true</filtering>
+                                        </resource>
+                                    </resources>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
         <profile>
             <id>product</id>
             <activation>
@@ -126,7 +314,7 @@
 
             <properties>
                 <feature.parent>org.jboss.eap:wildfly-feature-pack</feature.parent>
-                <xmlns.domain>urn:jboss:domain:4.1</xmlns.domain>
+                <xmlns.domain>urn:jboss:domain:5.0</xmlns.domain>
             </properties>
 
             <dependencies>
@@ -137,6 +325,32 @@
                     <type>zip</type>
                 </dependency>
             </dependencies>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-resources-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>copy-configuration-wf11</id>
+                                <phase>validate</phase>
+                                <goals>
+                                    <goal>copy-resources</goal>
+                                </goals>
+                                <configuration>
+                                    <outputDirectory>target/resources/configuration</outputDirectory>
+                                    <resources>
+                                        <resource>
+                                            <directory>src/main/resources-wf11/configuration</directory>
+                                            <filtering>true</filtering>
+                                        </resource>
+                                    </resources>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
         </profile>
     </profiles>
 
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/identity/module/dir/META-INF/MANIFEST.MF b/distribution/feature-packs/server-feature-pack/src/main/resources/identity/module/dir/META-INF/MANIFEST.MF
index 5c2cb16..a467c06 100644
--- a/distribution/feature-packs/server-feature-pack/src/main/resources/identity/module/dir/META-INF/MANIFEST.MF
+++ b/distribution/feature-packs/server-feature-pack/src/main/resources/identity/module/dir/META-INF/MANIFEST.MF
@@ -1,3 +1,3 @@
-JBoss-Product-Release-Name: ${product.name}
+JBoss-Product-Release-Name: ${product.name.full}
 JBoss-Product-Release-Version: ${product.version}
 JBoss-Product-Console-Slot: ${product.wildfly.console.slot}
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources-wf11/configuration/standalone/subsystems.xml b/distribution/feature-packs/server-feature-pack/src/main/resources-wf11/configuration/standalone/subsystems.xml
new file mode 100755
index 0000000..823b45c
--- /dev/null
+++ b/distribution/feature-packs/server-feature-pack/src/main/resources-wf11/configuration/standalone/subsystems.xml
@@ -0,0 +1,47 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+  ~ and other contributors as indicated by the @author tags.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!--  See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->
+<config>
+   <subsystems>
+       <subsystem>logging.xml</subsystem>
+       <subsystem>bean-validation.xml</subsystem>
+       <subsystem supplement="default">keycloak-datasources2.xml</subsystem>
+       <subsystem>deployment-scanner.xml</subsystem>
+       <subsystem>ee.xml</subsystem>
+       <subsystem>ejb3.xml</subsystem>
+       <subsystem>io.xml</subsystem>
+       <subsystem>keycloak-infinispan2.xml</subsystem>
+       <subsystem>jaxrs.xml</subsystem>
+       <subsystem>jca.xml</subsystem>
+       <subsystem>jdr.xml</subsystem>
+       <subsystem>jmx.xml</subsystem>
+       <subsystem>jpa.xml</subsystem>
+       <subsystem>jsf.xml</subsystem>
+       <subsystem>mail.xml</subsystem>
+       <subsystem>naming.xml</subsystem>
+       <subsystem>remoting.xml</subsystem>
+       <subsystem>request-controller.xml</subsystem>
+       <subsystem>security-manager.xml</subsystem>
+       <subsystem supplement="standalone-wildfly">elytron.xml</subsystem>
+       <subsystem>security.xml</subsystem>
+       <subsystem>transactions.xml</subsystem>
+       <subsystem>undertow.xml</subsystem>
+       <subsystem>keycloak-server.xml</subsystem>
+   </subsystems>
+</config>
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources-wf11/configuration/standalone/subsystems-ha.xml b/distribution/feature-packs/server-feature-pack/src/main/resources-wf11/configuration/standalone/subsystems-ha.xml
new file mode 100755
index 0000000..9d9954d
--- /dev/null
+++ b/distribution/feature-packs/server-feature-pack/src/main/resources-wf11/configuration/standalone/subsystems-ha.xml
@@ -0,0 +1,49 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+  ~ and other contributors as indicated by the @author tags.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!--  See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->
+<config>
+    <subsystems>
+        <subsystem>logging.xml</subsystem>
+        <subsystem>bean-validation.xml</subsystem>
+        <subsystem supplement="default">keycloak-datasources.xml</subsystem>
+        <subsystem>deployment-scanner.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 supplement="default">jgroups.xml</subsystem>
+        <subsystem>jmx.xml</subsystem>
+        <subsystem>jpa.xml</subsystem>
+        <subsystem>jsf.xml</subsystem>
+        <subsystem>mail.xml</subsystem>
+        <subsystem supplement="default">mod_cluster.xml</subsystem>
+        <subsystem>naming.xml</subsystem>
+        <subsystem>remoting.xml</subsystem>
+        <subsystem>request-controller.xml</subsystem>
+        <subsystem>security-manager.xml</subsystem>
+        <subsystem supplement="standalone-wildfly">elytron.xml</subsystem>
+        <subsystem>security.xml</subsystem>
+        <subsystem>transactions.xml</subsystem>
+        <subsystem supplement="ha">undertow.xml</subsystem>
+        <subsystem>keycloak-server.xml</subsystem>
+    </subsystems>
+</config>
\ No newline at end of file
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources-wf11/configuration/standalone/template.xml b/distribution/feature-packs/server-feature-pack/src/main/resources-wf11/configuration/standalone/template.xml
new file mode 100644
index 0000000..e28a49b
--- /dev/null
+++ b/distribution/feature-packs/server-feature-pack/src/main/resources-wf11/configuration/standalone/template.xml
@@ -0,0 +1,90 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<server xmlns="${xmlns.domain}">
+
+    <extensions>
+        <?EXTENSIONS?>
+    </extensions>
+
+    <management>
+        <security-realms>
+            <security-realm name="ManagementRealm">
+                <authentication>
+                    <local default-user="$local" skip-group-loading="true"/>
+                    <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
+                </authentication>
+                <authorization map-groups-to-roles="false">
+                    <properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
+                </authorization>
+            </security-realm>
+            <security-realm name="ApplicationRealm">
+                <server-identities>
+                    <ssl>
+                        <keystore path="application.keystore" relative-to="jboss.server.config.dir" keystore-password="password" alias="server" key-password="password" generate-self-signed-certificate-host="localhost"/>
+                    </ssl>
+                </server-identities>
+                <authentication>
+                    <local default-user="$local" allowed-users="*" skip-group-loading="true"/>
+                    <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
+                </authentication>
+                <authorization>
+                    <properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
+                </authorization>
+            </security-realm>
+        </security-realms>
+        <audit-log>
+            <formatters>
+                <json-formatter name="json-formatter"/>
+            </formatters>
+            <handlers>
+                <file-handler name="file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/>
+            </handlers>
+            <logger log-boot="true" log-read-only="false" enabled="false">
+                <handlers>
+                    <handler name="file"/>
+                </handlers>
+            </logger>
+        </audit-log>
+        <management-interfaces>
+            <http-interface security-realm="ManagementRealm">
+                <http-upgrade enabled="true" />
+                <socket-binding http="management-http"/>
+            </http-interface>
+        </management-interfaces>
+        <access-control provider="simple">
+            <role-mapping>
+                <role name="SuperUser">
+                    <include>
+                        <user name="$local"/>
+                    </include>
+                </role>
+            </role-mapping>
+        </access-control>
+    </management>
+
+    <profile>
+
+        <?SUBSYSTEMS socket-binding-group="standard-sockets"?>
+
+    </profile>
+
+    <interfaces>
+        <interface name="management">
+            <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
+        </interface>
+        <interface name="public">
+            <inet-address value="${jboss.bind.address:127.0.0.1}"/>
+        </interface>
+
+        <?INTERFACES?>
+
+    </interfaces>
+
+    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
+        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
+        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
+
+        <?SOCKET-BINDINGS?>
+
+    </socket-binding-group>
+</server>
\ No newline at end of file

pom.xml 8(+5 -3)

diff --git a/pom.xml b/pom.xml
index 246bcc1..364121c 100755
--- a/pom.xml
+++ b/pom.xml
@@ -42,7 +42,11 @@
         <!-- WildFly -->
         <jboss.as.version>7.2.0.Final</jboss.as.version>
         <wildfly.version>10.0.0.Final</wildfly.version>
-        <eap.version>7.0.5.GA-redhat-2</eap.version>
+        <wildfly11.version>11.0.0.Alpha1</wildfly11.version> <!-- for testing with wf11 pre-releases -->
+        <eap.version>7.1.0.Alpha1-redhat-16</eap.version>
+        <wildfly.core.version>2.0.10.Final</wildfly.core.version>
+        <wildfly.build-tools.version>1.1.8.Final</wildfly.build-tools.version>
+
         <version.org.wildfly.security.wildfly-elytron>1.1.0.Beta32</version.org.wildfly.security.wildfly-elytron>
         <version.org.wildfly.security.elytron-web.undertow-server>1.0.0.Beta14</version.org.wildfly.security.elytron-web.undertow-server>
 
@@ -74,8 +78,6 @@
         <sun.jaxb.version>2.2.11</sun.jaxb.version>
         <sun.xsom.version>20140925</sun.xsom.version>
         <undertow.version>1.3.15.Final</undertow.version>
-        <wildfly.core.version>2.0.10.Final</wildfly.core.version>
-        <wildfly.build-tools.version>1.1.3.Final</wildfly.build-tools.version>
         <xmlsec.version>2.0.5</xmlsec.version>
 
         <!-- Authorization Drools Policy Provider -->
diff --git a/services/src/main/java/org/keycloak/services/resources/JsResource.java b/services/src/main/java/org/keycloak/services/resources/JsResource.java
index c74abf0..3e41dad 100755
--- a/services/src/main/java/org/keycloak/services/resources/JsResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/JsResource.java
@@ -19,6 +19,7 @@ package org.keycloak.services.resources;
 
 import org.keycloak.Config;
 import org.keycloak.common.Version;
+import org.keycloak.utils.MediaType;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -43,14 +44,14 @@ public class JsResource {
      */
     @GET
     @Path("/keycloak.js")
-    @Produces("text/javascript")
+    @Produces(MediaType.TEXT_PLAIN_JAVASCRIPT)
     public Response getKeycloakJs() {
         return getJs("keycloak.js");
     }
 
     @GET
     @Path("/{version}/keycloak.js")
-    @Produces("text/javascript")
+    @Produces(MediaType.TEXT_PLAIN_JAVASCRIPT)
     public Response getKeycloakJsWithVersion(@PathParam("version") String version) {
         if (!version.equals(Version.RESOURCES_VERSION)) {
             return Response.status(Response.Status.NOT_FOUND).build();
@@ -61,14 +62,14 @@ public class JsResource {
 
     @GET
     @Path("/keycloak.min.js")
-    @Produces("text/javascript")
+    @Produces(MediaType.TEXT_PLAIN_JAVASCRIPT)
     public Response getKeycloakMinJs() {
         return getJs("keycloak.min.js");
     }
 
     @GET
     @Path("/{version}/keycloak.min.js")
-    @Produces("text/javascript")
+    @Produces(MediaType.TEXT_PLAIN_JAVASCRIPT)
     public Response getKeycloakMinJsWithVersion(@PathParam("version") String version) {
         if (!version.equals(Version.RESOURCES_VERSION)) {
             return Response.status(Response.Status.NOT_FOUND).build();
@@ -84,14 +85,14 @@ public class JsResource {
      */
     @GET
     @Path("/keycloak-authz.js")
-    @Produces("text/javascript")
+    @Produces(MediaType.TEXT_PLAIN_JAVASCRIPT)
     public Response getKeycloakAuthzJs() {
         return getJs("keycloak-authz.js");
     }
 
     @GET
     @Path("/{version}/keycloak-authz.js")
-    @Produces("text/javascript")
+    @Produces(MediaType.TEXT_PLAIN_JAVASCRIPT)
     public Response getKeycloakAuthzJsWithVersion(@PathParam("version") String version) {
         if (!version.equals(Version.RESOURCES_VERSION)) {
             return Response.status(Response.Status.NOT_FOUND).build();
@@ -102,14 +103,14 @@ public class JsResource {
 
     @GET
     @Path("/keycloak-authz.min.js")
-    @Produces("text/javascript")
+    @Produces(MediaType.TEXT_PLAIN_JAVASCRIPT)
     public Response getKeycloakAuthzMinJs() {
         return getJs("keycloak-authz.min.js");
     }
 
     @GET
     @Path("/{version}/keycloak-authz.min.js")
-    @Produces("text/javascript")
+    @Produces(MediaType.TEXT_PLAIN_JAVASCRIPT)
     public Response getKeycloakAuthzMinJsWithVersion(@PathParam("version") String version) {
         if (!version.equals(Version.RESOURCES_VERSION)) {
             return Response.status(Response.Status.NOT_FOUND).build();
diff --git a/services/src/main/java/org/keycloak/services/resources/RobotsResource.java b/services/src/main/java/org/keycloak/services/resources/RobotsResource.java
index 16e9393..b4c3771 100755
--- a/services/src/main/java/org/keycloak/services/resources/RobotsResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/RobotsResource.java
@@ -17,10 +17,11 @@
 
 package org.keycloak.services.resources;
 
+import org.keycloak.utils.MediaType;
+
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
 
 @Path("/robots.txt")
 public class RobotsResource {
@@ -28,7 +29,7 @@ public class RobotsResource {
     private static final String robots = "User-agent: *\n" + "Disallow: /";
 
     @GET
-    @Produces(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN_UTF_8)
     public String getRobots() {
         return robots;
     }
diff --git a/services/src/main/java/org/keycloak/utils/MediaType.java b/services/src/main/java/org/keycloak/utils/MediaType.java
index c34858d..acb0b41 100644
--- a/services/src/main/java/org/keycloak/utils/MediaType.java
+++ b/services/src/main/java/org/keycloak/utils/MediaType.java
@@ -25,6 +25,12 @@ public class MediaType {
     public static final String TEXT_HTML_UTF_8 = "text/html; charset=utf-8";
     public static final javax.ws.rs.core.MediaType TEXT_HTML_UTF_8_TYPE = new javax.ws.rs.core.MediaType("text", "html", "utf-8");
 
+    public static final String TEXT_PLAIN_UTF_8 = "text/plain; charset=utf-8";
+    public static final javax.ws.rs.core.MediaType TEXT_PLAIN_UTF_8_TYPE = new javax.ws.rs.core.MediaType("text", "plain", "utf-8");
+
+    public static final String TEXT_PLAIN_JAVASCRIPT = "text/javascript; charset=utf-8";
+    public static final javax.ws.rs.core.MediaType TEXT_JAVASCRIPT_UTF_8_TYPE = new javax.ws.rs.core.MediaType("text", "javascript", "utf-8");
+
     public static final String APPLICATION_JSON = javax.ws.rs.core.MediaType.APPLICATION_JSON;
     public static final javax.ws.rs.core.MediaType APPLICATION_JSON_TYPE = javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE;
 
diff --git a/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-datasources2.xml b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-datasources2.xml
new file mode 100755
index 0000000..19d41b3
--- /dev/null
+++ b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-datasources2.xml
@@ -0,0 +1,57 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+  ~ and other contributors as indicated by the @author tags.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!--  See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->
+<config>
+    <extension-module>org.jboss.as.connector</extension-module>
+    <subsystem xmlns="urn:jboss:domain:datasources:5.0">
+        <datasources>
+            <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
+                <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
+                <driver>h2</driver>
+                <security>
+                    <user-name>sa</user-name>
+                    <password>sa</password>
+                </security>
+            </datasource>
+            <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
+                <connection-url><?KEYCLOAK_DS_CONNECTION_URL?></connection-url>
+                <driver>h2</driver>
+                <security>
+                    <user-name>sa</user-name>
+                    <password>sa</password>
+                </security>
+            </datasource>
+            <drivers>
+                <driver name="h2" module="com.h2database.h2">
+                    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
+                </driver>
+            </drivers>
+        </datasources>
+    </subsystem>
+    <supplement name="default">
+        <replacement placeholder="KEYCLOAK_DS_CONNECTION_URL">
+            jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE
+        </replacement>
+    </supplement>
+    <supplement name="domain">
+        <replacement placeholder="KEYCLOAK_DS_CONNECTION_URL">
+            jdbc:h2:${jboss.server.data.dir}/../../shared-database/keycloak;AUTO_SERVER=TRUE
+        </replacement>
+    </supplement>
+</config>
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 f779bcf..0c96904 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
@@ -59,6 +59,9 @@
                     <transaction mode="BATCH"/>
                     <file-store passivation="false" purge="false"/>
                 </local-cache>
+                <local-cache name="concurrent">
+                    <file-store passivation="true" 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">
@@ -72,7 +75,7 @@
                     <file-store passivation="false" purge="false"/>
                 </local-cache>
             </cache-container>
-            <cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan">
+            <cache-container name="hibernate" module="org.hibernate.infinispan">
                 <local-cache name="entity">
                     <transaction mode="NON_XA"/>
                     <eviction strategy="LRU" max-entries="10000"/>
@@ -108,21 +111,24 @@
             </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">
+                <replicated-cache name="default">
                     <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">
+                <distributed-cache name="dist">
                     <locking isolation="REPEATABLE_READ"/>
                     <transaction mode="BATCH"/>
                     <file-store/>
                 </distributed-cache>
+                <distributed-cache name="concurrent">
+                    <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">
+                <distributed-cache name="dist">
                     <locking isolation="REPEATABLE_READ"/>
                     <transaction mode="BATCH"/>
                     <file-store/>
@@ -134,7 +140,7 @@
                     <eviction strategy="LRU" max-entries="10000"/>
                     <expiration max-idle="100000"/>
                 </local-cache>
-                <invalidation-cache name="entity" mode="SYNC">
+                <invalidation-cache name="entity">
                     <transaction mode="NON_XA"/>
                     <eviction strategy="LRU" max-entries="10000"/>
                     <expiration max-idle="100000"/>
diff --git a/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan2.xml b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan2.xml
new file mode 100755
index 0000000..f779bcf
--- /dev/null
+++ b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan2.xml
@@ -0,0 +1,146 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+  ~ and other contributors as indicated by the @author tags.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!--  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:4.0">
+        <?CACHE-CONTAINERS?>
+    </subsystem>
+    <supplement name="default">
+        <replacement placeholder="CACHE-CONTAINERS">
+            <cache-container name="keycloak" jndi-name="infinispan/Keycloak">
+                <local-cache name="realms">
+                    <eviction max-entries="10000" strategy="LRU"/>
+                </local-cache>
+                <local-cache name="users">
+                    <eviction max-entries="10000" strategy="LRU"/>
+                </local-cache>
+                <local-cache name="sessions"/>
+                <local-cache name="offlineSessions"/>
+                <local-cache name="loginFailures"/>
+                <local-cache name="work"/>
+                <local-cache name="authorization">
+                    <eviction max-entries="100" strategy="LRU"/>
+                </local-cache>
+                <local-cache name="keys">
+                    <eviction max-entries="1000" strategy="LRU"/>
+                    <expiration max-idle="3600000" />
+                </local-cache>
+            </cache-container>
+            <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">
+                    <locking isolation="REPEATABLE_READ"/>
+                    <transaction mode="BATCH"/>
+                    <file-store passivation="true" purge="false"/>
+                </local-cache>
+                <local-cache name="persistent">
+                    <locking isolation="REPEATABLE_READ"/>
+                    <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">
+                    <locking isolation="REPEATABLE_READ"/>
+                    <transaction mode="BATCH"/>
+                    <file-store passivation="true" purge="false"/>
+                </local-cache>
+                <local-cache name="persistent">
+                    <locking isolation="REPEATABLE_READ"/>
+                    <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"/>
+                <local-cache name="realms">
+                    <eviction max-entries="10000" strategy="LRU"/>
+                </local-cache>
+                <local-cache name="users">
+                    <eviction max-entries="10000" strategy="LRU"/>
+                </local-cache>
+                <distributed-cache name="sessions" mode="SYNC" owners="1"/>
+                <distributed-cache name="offlineSessions" mode="SYNC" owners="1"/>
+                <distributed-cache name="loginFailures" mode="SYNC" owners="1"/>
+                <distributed-cache name="authorization" mode="SYNC" owners="1"/>
+                <replicated-cache name="work" mode="SYNC" />
+                <local-cache name="keys">
+                    <eviction max-entries="1000" strategy="LRU"/>
+                    <expiration max-idle="3600000" />
+                </local-cache>
+            </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">
+                    <locking isolation="REPEATABLE_READ"/>
+                    <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">
+                    <locking isolation="REPEATABLE_READ"/>
+                    <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"/>
+                <local-cache name="local-query">
+                    <eviction strategy="LRU" max-entries="10000"/>
+                    <expiration max-idle="100000"/>
+                </local-cache>
+                <invalidation-cache name="entity" mode="SYNC">
+                    <transaction mode="NON_XA"/>
+                    <eviction strategy="LRU" max-entries="10000"/>
+                    <expiration max-idle="100000"/>
+                </invalidation-cache>
+                <replicated-cache name="timestamps" mode="ASYNC"/>
+            </cache-container>
+        </replacement>
+    </supplement>
+</config>