keycloak-uncached

Changes

pom.xml 2(+1 -1)

Details

diff --git a/distribution/adapters/as7-eap6-adapter/as7-adapter-zip/assembly.xml b/distribution/adapters/as7-eap6-adapter/as7-adapter-zip/assembly.xml
index 814a591..094e426 100755
--- a/distribution/adapters/as7-eap6-adapter/as7-adapter-zip/assembly.xml
+++ b/distribution/adapters/as7-eap6-adapter/as7-adapter-zip/assembly.xml
@@ -13,13 +13,13 @@
             <includes>
                 <include>org/bouncycastle/**</include>
                 <include>net/iharder/base64/**</include>
-                <include>org/apache/httpcomponents/**</include>
                 <include>org/keycloak/keycloak-core/**</include>
                 <include>org/keycloak/keycloak-adapter-core/**</include>
                 <include>org/keycloak/keycloak-jboss-adapter-core/**</include>
                 <include>org/keycloak/keycloak-as7-adapter/**</include>
                 <include>org/keycloak/keycloak-as7-subsystem/**</include>
                 <include>org/keycloak/keycloak-adapter-subsystem/**</include>
+                <include>org/keycloak/keycloak-servlet-oauth-client/**</include>
             </includes>
             <excludes>
                 <exclude>**/*.war</exclude>
diff --git a/distribution/adapters/as7-eap6-adapter/as7-modules/build.xml b/distribution/adapters/as7-eap6-adapter/as7-modules/build.xml
index d4b4beb..9ab6fab 100755
--- a/distribution/adapters/as7-eap6-adapter/as7-modules/build.xml
+++ b/distribution/adapters/as7-eap6-adapter/as7-modules/build.xml
@@ -38,12 +38,6 @@
 
         <!-- server min dependencies -->
 
-        <module-def name="org.apache.httpcomponents" slot="4.3">
-            <maven-resource group="org.apache.httpcomponents" artifact="httpclient"/>
-            <maven-resource group="org.apache.httpcomponents" artifact="httpcore"/>
-            <maven-resource group="org.apache.httpcomponents" artifact="httpmime"/>
-        </module-def>
-
         <module-def name="org.keycloak.keycloak-core">
             <maven-resource group="org.keycloak" artifact="keycloak-core"/>
         </module-def>
@@ -76,6 +70,10 @@
             <maven-resource group="org.keycloak" artifact="keycloak-as7-subsystem"/>
         </module-def>
 
+        <module-def name="org.keycloak.keycloak-servlet-oauth-client">
+            <maven-resource group="org.keycloak" artifact="keycloak-servlet-oauth-client"/>
+        </module-def>
+
     </target>
 
     <target name="clean-target">
diff --git a/distribution/adapters/as7-eap6-adapter/as7-modules/pom.xml b/distribution/adapters/as7-eap6-adapter/as7-modules/pom.xml
index 6fb1671..809717f 100755
--- a/distribution/adapters/as7-eap6-adapter/as7-modules/pom.xml
+++ b/distribution/adapters/as7-eap6-adapter/as7-modules/pom.xml
@@ -42,12 +42,8 @@
             <artifactId>keycloak-as7-subsystem</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpmime</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpcore</artifactId>
+            <groupId>org.keycloak</groupId>
+            <artifactId>keycloak-servlet-oauth-client</artifactId>
         </dependency>
         <dependency>
             <groupId>net.iharder</groupId>
diff --git a/distribution/adapters/as7-eap6-adapter/as7-modules/src/main/resources/modules/org/keycloak/keycloak-adapter-core/main/module.xml b/distribution/adapters/as7-eap6-adapter/as7-modules/src/main/resources/modules/org/keycloak/keycloak-adapter-core/main/module.xml
index 1be1486..5e3e5c3 100755
--- a/distribution/adapters/as7-eap6-adapter/as7-modules/src/main/resources/modules/org/keycloak/keycloak-adapter-core/main/module.xml
+++ b/distribution/adapters/as7-eap6-adapter/as7-modules/src/main/resources/modules/org/keycloak/keycloak-adapter-core/main/module.xml
@@ -11,7 +11,7 @@
         <module name="org.codehaus.jackson.jackson-core-asl"/>
         <module name="org.codehaus.jackson.jackson-mapper-asl"/>
         <module name="org.codehaus.jackson.jackson-xc"/>
-        <module name="org.apache.httpcomponents" slot="4.3" />
+        <module name="org.apache.httpcomponents"/>
         <module name="org.jboss.logging"/>
         <module name="org.keycloak.keycloak-core"/>
         <module name="net.iharder.base64"/>
diff --git a/distribution/adapters/as7-eap6-adapter/as7-modules/src/main/resources/modules/org/keycloak/keycloak-as7-adapter/main/module.xml b/distribution/adapters/as7-eap6-adapter/as7-modules/src/main/resources/modules/org/keycloak/keycloak-as7-adapter/main/module.xml
index b5df10a..463ff43 100755
--- a/distribution/adapters/as7-eap6-adapter/as7-modules/src/main/resources/modules/org/keycloak/keycloak-as7-adapter/main/module.xml
+++ b/distribution/adapters/as7-eap6-adapter/as7-modules/src/main/resources/modules/org/keycloak/keycloak-as7-adapter/main/module.xml
@@ -12,7 +12,7 @@
         <module name="org.codehaus.jackson.jackson-core-asl"/>
         <module name="org.codehaus.jackson.jackson-mapper-asl"/>
         <module name="org.codehaus.jackson.jackson-xc"/>
-        <module name="org.apache.httpcomponents" slot="4.3" />
+        <module name="org.apache.httpcomponents"/>
         <module name="javax.servlet.api"/>
         <module name="org.jboss.logging"/>
         <module name="org.jboss.as.security"/>
diff --git a/distribution/adapters/as7-eap6-adapter/eap6-adapter-zip/assembly.xml b/distribution/adapters/as7-eap6-adapter/eap6-adapter-zip/assembly.xml
index 84fe8e2..4e29b1b 100755
--- a/distribution/adapters/as7-eap6-adapter/eap6-adapter-zip/assembly.xml
+++ b/distribution/adapters/as7-eap6-adapter/eap6-adapter-zip/assembly.xml
@@ -13,13 +13,13 @@
             <includes>
                 <include>org/bouncycastle/**</include>
                 <include>net/iharder/base64/**</include>
-                <include>org/apache/httpcomponents/**</include>
                 <include>org/keycloak/keycloak-core/**</include>
                 <include>org/keycloak/keycloak-adapter-core/**</include>
                 <include>org/keycloak/keycloak-jboss-adapter-core/**</include>
                 <include>org/keycloak/keycloak-as7-adapter/**</include>
                 <include>org/keycloak/keycloak-as7-subsystem/**</include>
                 <include>org/keycloak/keycloak-adapter-subsystem/**</include>
+                <include>org/keycloak/keycloak-servlet-oauth-client/**</include>
             </includes>
             <excludes>
                 <exclude>**/*.war</exclude>
diff --git a/distribution/adapters/wf8-adapter/wf8-adapter-zip/assembly.xml b/distribution/adapters/wf8-adapter/wf8-adapter-zip/assembly.xml
index 205ade3..3f5d887 100755
--- a/distribution/adapters/wf8-adapter/wf8-adapter-zip/assembly.xml
+++ b/distribution/adapters/wf8-adapter/wf8-adapter-zip/assembly.xml
@@ -20,6 +20,7 @@
                 <include>org/keycloak/keycloak-wildfly-adapter/**</include>
                 <include>org/keycloak/keycloak-wf8-subsystem/**</include>
                 <include>org/keycloak/keycloak-adapter-subsystem/**</include>
+                <include>org/keycloak/keycloak-servlet-oauth-client/**</include>
             </includes>
             <excludes>
                 <exclude>**/*.war</exclude>
diff --git a/distribution/adapters/wf8-adapter/wf8-modules/build.xml b/distribution/adapters/wf8-adapter/wf8-modules/build.xml
index 0ede555..30e0254 100755
--- a/distribution/adapters/wf8-adapter/wf8-modules/build.xml
+++ b/distribution/adapters/wf8-adapter/wf8-modules/build.xml
@@ -69,6 +69,10 @@
             <maven-resource group="org.keycloak" artifact="keycloak-wf8-subsystem"/>
         </module-def>
 
+        <module-def name="org.keycloak.keycloak-servlet-oauth-client">
+            <maven-resource group="org.keycloak" artifact="keycloak-servlet-oauth-client"/>
+        </module-def>
+
         <module-def name="org.apache.httpcomponents" slot="4.3">
             <maven-resource group="org.apache.httpcomponents" artifact="httpclient"/>
             <maven-resource group="org.apache.httpcomponents" artifact="httpcore"/>
diff --git a/distribution/adapters/wf8-adapter/wf8-modules/pom.xml b/distribution/adapters/wf8-adapter/wf8-modules/pom.xml
index 0f88bb7..0de89fc 100755
--- a/distribution/adapters/wf8-adapter/wf8-modules/pom.xml
+++ b/distribution/adapters/wf8-adapter/wf8-modules/pom.xml
@@ -42,6 +42,10 @@
             <artifactId>keycloak-wf8-subsystem</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.keycloak</groupId>
+            <artifactId>keycloak-servlet-oauth-client</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpmime</artifactId>
         </dependency>
diff --git a/distribution/adapters/wf8-adapter/wf8-modules/src/main/resources/modules/org/keycloak/keycloak-servlet-oauth-client/main/module.xml b/distribution/adapters/wf8-adapter/wf8-modules/src/main/resources/modules/org/keycloak/keycloak-servlet-oauth-client/main/module.xml
new file mode 100755
index 0000000..2d3876e
--- /dev/null
+++ b/distribution/adapters/wf8-adapter/wf8-modules/src/main/resources/modules/org/keycloak/keycloak-servlet-oauth-client/main/module.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<module xmlns="urn:jboss:module:1.1" name="org.keycloak.keycloak-servlet-oauth-client">
+    <resources>
+        <!-- Insert resources here -->
+    </resources>
+    <dependencies>
+        <module name="javax.api"/>
+        <module name="javax.servlet.api"/>
+        <module name="org.jboss.logging"/>
+        <module name="org.picketbox"/>
+        <module name="org.apache.httpcomponents" slot="4.3"/>
+        <module name="org.keycloak.keycloak-adapter-core"/>
+        <module name="org.keycloak.keycloak-core"/>
+    </dependencies>
+
+</module>
diff --git a/distribution/adapters/wf9-adapter/wf9-adapter-zip/assembly.xml b/distribution/adapters/wf9-adapter/wf9-adapter-zip/assembly.xml
index 265264e..e81d4e4 100755
--- a/distribution/adapters/wf9-adapter/wf9-adapter-zip/assembly.xml
+++ b/distribution/adapters/wf9-adapter/wf9-adapter-zip/assembly.xml
@@ -19,6 +19,7 @@
                 <include>org/keycloak/keycloak-wildfly-adapter/**</include>
                 <include>org/keycloak/keycloak-wf9-subsystem/**</include>
                 <include>org/keycloak/keycloak-adapter-subsystem/**</include>
+                <include>org/keycloak/keycloak-servlet-oauth-client/**</include>
             </includes>
             <excludes>
                 <exclude>**/*.war</exclude>
diff --git a/distribution/adapters/wf9-adapter/wf9-modules/build.xml b/distribution/adapters/wf9-adapter/wf9-modules/build.xml
index e33da10..8c1d41a 100755
--- a/distribution/adapters/wf9-adapter/wf9-modules/build.xml
+++ b/distribution/adapters/wf9-adapter/wf9-modules/build.xml
@@ -69,6 +69,10 @@
             <maven-resource group="org.keycloak" artifact="keycloak-wf9-subsystem"/>
         </module-def>
 
+        <module-def name="org.keycloak.keycloak-servlet-oauth-client">
+            <maven-resource group="org.keycloak" artifact="keycloak-servlet-oauth-client"/>
+        </module-def>
+
     </target>
 
     <target name="clean-target">
diff --git a/distribution/adapters/wf9-adapter/wf9-modules/pom.xml b/distribution/adapters/wf9-adapter/wf9-modules/pom.xml
index b408d53..f4c63e7 100755
--- a/distribution/adapters/wf9-adapter/wf9-modules/pom.xml
+++ b/distribution/adapters/wf9-adapter/wf9-modules/pom.xml
@@ -42,6 +42,10 @@
             <artifactId>keycloak-wf9-subsystem</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.keycloak</groupId>
+            <artifactId>keycloak-servlet-oauth-client</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpmime</artifactId>
         </dependency>
diff --git a/distribution/adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-servlet-oauth-client/main/module.xml b/distribution/adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-servlet-oauth-client/main/module.xml
new file mode 100755
index 0000000..bc48988
--- /dev/null
+++ b/distribution/adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-servlet-oauth-client/main/module.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<module xmlns="urn:jboss:module:1.1" name="org.keycloak.keycloak-servlet-oauth-client">
+    <resources>
+        <!-- Insert resources here -->
+    </resources>
+    <dependencies>
+        <module name="javax.api"/>
+        <module name="javax.servlet.api"/>
+        <module name="org.jboss.logging"/>
+        <module name="org.picketbox"/>
+        <module name="org.apache.httpcomponents"/>
+        <module name="org.keycloak.keycloak-adapter-core"/>
+        <module name="org.keycloak.keycloak-core"/>
+    </dependencies>
+
+</module>
diff --git a/distribution/server-overlay/eap6/eap6-server-modules/pom.xml b/distribution/server-overlay/eap6/eap6-server-modules/pom.xml
index 1fc58d1..e66ad80 100755
--- a/distribution/server-overlay/eap6/eap6-server-modules/pom.xml
+++ b/distribution/server-overlay/eap6/eap6-server-modules/pom.xml
@@ -12,7 +12,7 @@
         <relativePath>../../../../pom.xml</relativePath>
     </parent>
 
-    <artifactId>keycloak-eap6-server-modules</artifactId>
+    <artifactId>keycloak-server-modules-eap6</artifactId>
 
     <name>Keycloak EAP 6 Server Modules</name>
     <packaging>pom</packaging>
diff --git a/distribution/server-overlay/eap6/eap6-server-overlay/pom.xml b/distribution/server-overlay/eap6/eap6-server-overlay/pom.xml
index 2e4907f..4b5acc7 100755
--- a/distribution/server-overlay/eap6/eap6-server-overlay/pom.xml
+++ b/distribution/server-overlay/eap6/eap6-server-overlay/pom.xml
@@ -8,15 +8,15 @@
         <relativePath>../../../../pom.xml</relativePath>
     </parent>
 
-    <artifactId>keycloak-eap6-server-overlay</artifactId>
+    <artifactId>keycloak-server-overlay-eap6</artifactId>
     <packaging>pom</packaging>
-    <name>Keycloak EAP 6 Server Overlay Distribution</name>
+    <name>Keycloak Server Overlay EAP 6 Distribution</name>
     <description/>
 
     <dependencies>
         <dependency>
             <groupId>org.keycloak</groupId>
-            <artifactId>keycloak-eap6-server-modules</artifactId>
+            <artifactId>keycloak-server-modules-eap6</artifactId>
             <type>zip</type>
         </dependency>
     </dependencies>
@@ -39,7 +39,7 @@
                             <artifactItems>
                                 <artifactItem>
                                     <groupId>org.keycloak</groupId>
-                                    <artifactId>keycloak-eap6-server-modules</artifactId>
+                                    <artifactId>keycloak-server-modules-eap6</artifactId>
                                     <type>zip</type>
                                     <outputDirectory>${project.build.directory}/unpacked/modules</outputDirectory>
                                 </artifactItem>
diff --git a/distribution/server-overlay/eap6/pom.xml b/distribution/server-overlay/eap6/pom.xml
index 2504fce..c784c82 100755
--- a/distribution/server-overlay/eap6/pom.xml
+++ b/distribution/server-overlay/eap6/pom.xml
@@ -8,9 +8,9 @@
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
-    <artifactId>keycloak-eap6-server-overlay-parent</artifactId>
+    <artifactId>keycloak-server-overlay-eap6-parent</artifactId>
     <packaging>pom</packaging>
-    <name>Keycloak EAP 6 Server Overlay</name>
+    <name>Keycloak Server Overlay EAP 6</name>
     <description/>
 
 
diff --git a/docbook/reference/en/en-US/modules/jboss-adapter.xml b/docbook/reference/en/en-US/modules/jboss-adapter.xml
index 3995447..f379490 100755
--- a/docbook/reference/en/en-US/modules/jboss-adapter.xml
+++ b/docbook/reference/en/en-US/modules/jboss-adapter.xml
@@ -53,12 +53,12 @@ $ unzip keycloak-as7-adapter-dist.zip
 <server xmlns="urn:jboss:domain:1.4">
 
     <extensions>
-        <extension module="org.keycloak.keycloak-subsystem"/>
+        <extension module="org.keycloak.keycloak-adapter-subsystem"/>
           ...
     </extensions>
 
     <profile>
-        <subsystem xmlns="urn:jboss:domain:keycloak:1.0"/>
+        <subsystem xmlns="urn:jboss:domain:keycloak:1.1"/>
          ...
     </profile>
 ]]>
diff --git a/docbook/reference/en/en-US/modules/MigrationFromOlderVersions.xml b/docbook/reference/en/en-US/modules/MigrationFromOlderVersions.xml
index f4fdec2..2815f6f 100755
--- a/docbook/reference/en/en-US/modules/MigrationFromOlderVersions.xml
+++ b/docbook/reference/en/en-US/modules/MigrationFromOlderVersions.xml
@@ -122,6 +122,10 @@
                     </itemizedlist>
                     Make sure you grab the correct one.
                 </para>
+                <para>
+                    You also need to update standalone.xml as the extension module and subsystem definition has changed.
+                    See <link linkend="jboss-adapter-installation">Adapter Installation</link> for details.
+                </para>
             </simplesect>
         </section>
         <section>
diff --git a/examples/demo-template/third-party/pom.xml b/examples/demo-template/third-party/pom.xml
index 6ec11d9..e5e3ac4 100755
--- a/examples/demo-template/third-party/pom.xml
+++ b/examples/demo-template/third-party/pom.xml
@@ -34,6 +34,7 @@
         <dependency>
             <groupId>org.keycloak</groupId>
             <artifactId>keycloak-servlet-oauth-client</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
diff --git a/examples/demo-template/third-party/src/main/java/org/keycloak/example/oauth/ProductDatabaseClient.java b/examples/demo-template/third-party/src/main/java/org/keycloak/example/oauth/ProductDatabaseClient.java
index 3f69ef9..b0e0e00 100755
--- a/examples/demo-template/third-party/src/main/java/org/keycloak/example/oauth/ProductDatabaseClient.java
+++ b/examples/demo-template/third-party/src/main/java/org/keycloak/example/oauth/ProductDatabaseClient.java
@@ -4,6 +4,9 @@ import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.keycloak.KeycloakSecurityContext;
+import org.keycloak.adapters.AdapterUtils;
 import org.keycloak.adapters.ServerRequest;
 import org.keycloak.representations.AccessTokenResponse;
 import org.keycloak.servlet.ServletOAuthClient;
@@ -70,15 +73,17 @@ public class ProductDatabaseClient {
     }
 
     public static List<String> getProducts(HttpServletRequest request, String accessToken) throws Failure {
+        KeycloakSecurityContext session = (KeycloakSecurityContext) request.getAttribute(KeycloakSecurityContext.class.getName());
+
         // The ServletOAuthClient is obtained by getting a context attribute
         // that is set in the Bootstrap context listener in this project.
         // You really should come up with a better way to initialize
         // and obtain the ServletOAuthClient.  I actually suggest downloading the ServletOAuthClient code
         // and take a look how it works. You can also take a look at third-party-cdi example
         ServletOAuthClient oAuthClient = (ServletOAuthClient) request.getServletContext().getAttribute(ServletOAuthClient.class.getName());
-        HttpClient client = oAuthClient.getClient();
+        HttpClient client = new DefaultHttpClient();
 
-        HttpGet get = new HttpGet(getBaseUrl(oAuthClient, request) + "/database/products");
+        HttpGet get = new HttpGet(AdapterUtils.getOriginForRestCalls(request.getRequestURL().toString(), session) + "/database/products");
         get.addHeader("Authorization", "Bearer " + accessToken);
         try {
             HttpResponse response = client.execute(get);
diff --git a/examples/demo-template/third-party/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/examples/demo-template/third-party/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
index 9c1bac9..2ee04e0 100755
--- a/examples/demo-template/third-party/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
+++ b/examples/demo-template/third-party/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
@@ -4,6 +4,7 @@
             <!-- the Demo code uses classes in these modules.  These are optional to import if you are not using
                  Apache Http Client or the HttpClientBuilder that comes with the adapter core -->
             <module name="org.apache.httpcomponents"/>
+            <module name="org.keycloak.keycloak-servlet-oauth-client"/>
         </dependencies>
     </deployment>
 </jboss-deployment-structure>
\ No newline at end of file
diff --git a/examples/demo-template/third-party-cdi/pom.xml b/examples/demo-template/third-party-cdi/pom.xml
index d2f8da5..d8b3f44 100755
--- a/examples/demo-template/third-party-cdi/pom.xml
+++ b/examples/demo-template/third-party-cdi/pom.xml
@@ -52,6 +52,7 @@
         <dependency>
             <groupId>org.keycloak</groupId>
             <artifactId>keycloak-servlet-oauth-client</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
diff --git a/examples/demo-template/third-party-cdi/src/main/java/org/keycloak/example/oauth/AppContextListener.java b/examples/demo-template/third-party-cdi/src/main/java/org/keycloak/example/oauth/AppContextListener.java
index 1fe4a2f..bd6a395 100755
--- a/examples/demo-template/third-party-cdi/src/main/java/org/keycloak/example/oauth/AppContextListener.java
+++ b/examples/demo-template/third-party-cdi/src/main/java/org/keycloak/example/oauth/AppContextListener.java
@@ -41,6 +41,7 @@ public class AppContextListener implements ServletContextListener {
         }
         ServletOAuthClientBuilder.build(is, oauthClient);
         logger.info("OAuth client configured and started");
+        oauthClient.start();
     }
 
     @Override
diff --git a/examples/demo-template/third-party-cdi/src/main/java/org/keycloak/example/oauth/DatabaseClient.java b/examples/demo-template/third-party-cdi/src/main/java/org/keycloak/example/oauth/DatabaseClient.java
index 01ede2e..0a44037 100755
--- a/examples/demo-template/third-party-cdi/src/main/java/org/keycloak/example/oauth/DatabaseClient.java
+++ b/examples/demo-template/third-party-cdi/src/main/java/org/keycloak/example/oauth/DatabaseClient.java
@@ -4,7 +4,10 @@ import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
 import org.jboss.logging.Logger;
+import org.keycloak.KeycloakSecurityContext;
+import org.keycloak.adapters.AdapterUtils;
 import org.keycloak.servlet.ServletOAuthClient;
 import org.keycloak.util.JsonSerialization;
 import org.keycloak.util.UriUtils;
@@ -69,7 +72,7 @@ public class DatabaseClient {
     }
 
     protected List<String> sendRequestToDBApplication(String dbUri) {
-        HttpClient client = oauthClient.getClient();
+        HttpClient client = new DefaultHttpClient();
         HttpGet get = new HttpGet(dbUri);
         try {
 
@@ -103,18 +106,8 @@ public class DatabaseClient {
     }
 
     public String getBaseUrl() {
-        switch (oauthClient.getRelativeUrlsUsed()) {
-            case ALL_REQUESTS:
-                // Resolve baseURI from the request
-                return UriUtils.getOrigin(request.getRequestURL().toString());
-            case BROWSER_ONLY:
-                // Resolve baseURI from the codeURL (This is already non-relative and based on our hostname)
-                return UriUtils.getOrigin(oauthClient.getTokenUrl());
-            case NEVER:
-                return "";
-            default:
-                return "";
-        }
+        KeycloakSecurityContext session = (KeycloakSecurityContext)request.getAttribute(KeycloakSecurityContext.class.getName());
+        return AdapterUtils.getOriginForRestCalls(request.getRequestURL().toString(), session);
     }
 
 }
diff --git a/examples/demo-template/third-party-cdi/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/examples/demo-template/third-party-cdi/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
index 9c1bac9..2ee04e0 100755
--- a/examples/demo-template/third-party-cdi/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
+++ b/examples/demo-template/third-party-cdi/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
@@ -4,6 +4,7 @@
             <!-- the Demo code uses classes in these modules.  These are optional to import if you are not using
                  Apache Http Client or the HttpClientBuilder that comes with the adapter core -->
             <module name="org.apache.httpcomponents"/>
+            <module name="org.keycloak.keycloak-servlet-oauth-client"/>
         </dependencies>
     </deployment>
 </jboss-deployment-structure>
\ No newline at end of file
diff --git a/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClient.java b/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClient.java
index ad6c327..668bb02 100755
--- a/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClient.java
+++ b/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClient.java
@@ -3,10 +3,12 @@ package org.keycloak.servlet;
 import org.apache.http.client.HttpClient;
 import org.keycloak.AbstractOAuthClient;
 import org.keycloak.OAuth2Constants;
+import org.keycloak.adapters.HttpClientBuilder;
 import org.keycloak.adapters.ServerRequest;
 import org.keycloak.jose.jws.JWSInput;
 import org.keycloak.representations.AccessTokenResponse;
 import org.keycloak.representations.IDToken;
+import org.keycloak.representations.adapters.config.AdapterConfig;
 import org.keycloak.util.KeycloakUriBuilder;
 import org.keycloak.util.UriUtils;
 
@@ -22,8 +24,10 @@ import java.net.URI;
  */
 public class ServletOAuthClient extends AbstractOAuthClient {
     protected HttpClient client;
+    protected AdapterConfig adapterConfig;
 
     public void start() {
+        client = new HttpClientBuilder().build(adapterConfig);
     }
 
     /**
@@ -32,13 +36,6 @@ public class ServletOAuthClient extends AbstractOAuthClient {
     public void stop() {
         client.getConnectionManager().shutdown();
     }
-    public HttpClient getClient() {
-        return client;
-    }
-
-    public void setClient(HttpClient client) {
-        this.client = client;
-    }
 
     private AccessTokenResponse resolveBearerToken(HttpServletRequest request, String redirectUri, String code) throws IOException, ServerRequest.HttpFailure {
         // Don't send sessionId in oauth clients for now
@@ -171,4 +168,7 @@ public class ServletOAuthClient extends AbstractOAuthClient {
         }
     }
 
+    public void setAdapterConfig(AdapterConfig adapterConfig) {
+        this.adapterConfig = adapterConfig;
+    }
 }
diff --git a/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClientBuilder.java b/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClientBuilder.java
index d642e5c..d650e93 100755
--- a/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClientBuilder.java
+++ b/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClientBuilder.java
@@ -42,8 +42,7 @@ public class ServletOAuthClientBuilder {
 
 
     public static void build(AdapterConfig adapterConfig, ServletOAuthClient oauthClient) {
-        HttpClient client = new HttpClientBuilder().build(adapterConfig);
-        oauthClient.setClient(client);
+        oauthClient.setAdapterConfig(adapterConfig);
         oauthClient.setClientId(adapterConfig.getResource());
         oauthClient.setPublicClient(adapterConfig.isPublicClient());
         oauthClient.setCredentials(adapterConfig.getCredentials());

pom.xml 2(+1 -1)

diff --git a/pom.xml b/pom.xml
index 0bb8beb..a1dc852 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1077,7 +1077,7 @@
             </dependency>
             <dependency>
                 <groupId>org.keycloak</groupId>
-                <artifactId>keycloak-eap6-server-modules</artifactId>
+                <artifactId>keycloak-server-modules-eap6</artifactId>
                 <version>${project.version}</version>
                 <type>zip</type>
             </dependency>