keycloak-aplcache
Changes
testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/servlet/CustomerServlet.java 10(+9 -1)
testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/servlet/InputServlet.java 9(+7 -2)
Details
diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/build-truststore.xml b/testsuite/integration-arquillian/servers/auth-server/jboss/build-truststore.xml
new file mode 100644
index 0000000..073f860
--- /dev/null
+++ b/testsuite/integration-arquillian/servers/auth-server/jboss/build-truststore.xml
@@ -0,0 +1,52 @@
+<!--
+ ~ 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.
+ -->
+
+<project name="inject-truststore" basedir="." default="inject-truststore">
+
+ <scriptdef name="inject-truststore" language="javascript" manager="bsf">
+ <attribute name="path"/>
+ <![CDATA[
+ importClass(Packages.java.io.File);
+ importClass(Packages.org.keycloak.util.JsonSerialization);
+
+ path = attributes.get("path");
+ file = new File(path + "/standalone/configuration/keycloak-server.json");
+ root = JsonSerialization.mapper.readTree(file);
+
+ jNode = JsonSerialization.mapper.createObjectNode();
+ //jNode.put("file","${auth.server.home:" + path + "}/standalone/configuration/keycloak.truststore");
+ jNode.put("file","${jboss.home.dir}/standalone/configuration/keycloak.truststore");
+ jNode.put("password","secret");
+ jNode.put("hostname-verification-policy","WILDCARD");
+ jNode.put("disabled","false");
+
+ fileNode = JsonSerialization.mapper.createObjectNode();
+ fileNode.set("file", jNode);
+ truststoreNode = JsonSerialization.mapper.createObjectNode();
+ truststoreNode.set("truststore", fileNode);
+
+ root.putAll(truststoreNode);
+
+ // save file
+ JsonSerialization.prettyMapper.writeValue(file, root);
+ ]]>
+ </scriptdef>
+
+ <target name="inject-truststore">
+ <inject-truststore path="${auth.server.home}"/>
+ </target>
+</project>
\ No newline at end of file
diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/common/security.xsl b/testsuite/integration-arquillian/servers/auth-server/jboss/common/security.xsl
index 2a23899..ec6b9de 100644
--- a/testsuite/integration-arquillian/servers/auth-server/jboss/common/security.xsl
+++ b/testsuite/integration-arquillian/servers/auth-server/jboss/common/security.xsl
@@ -55,14 +55,6 @@
<socket-binding name="proxy-https" port="8443"/>
</xsl:template>
- <xsl:template match="//j:extensions">
- <xsl:copy-of select="."/>
- <system-properties>
- <property name="javax.net.ssl.trustStore" value="${{jboss.server.config.dir}}/keycloak.truststore"/>
- <property name="javax.net.ssl.trustStorePassword" value="secret"/>
- </system-properties>
- </xsl:template>
-
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml b/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml
index a0b1285..334cb0e 100644
--- a/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml
+++ b/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml
@@ -26,21 +26,21 @@
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
-
+
<artifactId>integration-arquillian-servers-auth-server-jboss</artifactId>
-
+
<name>Auth Server - JBoss</name>
-
+
<properties>
<common.resources>${project.parent.basedir}/common</common.resources>
<assembly.xml>${project.parent.basedir}/assembly.xml</assembly.xml>
-
+
<!--server-dist-->
<auth.server.dist.groupId>org.keycloak</auth.server.dist.groupId>
<auth.server.dist.artifactId>keycloak-server-dist</auth.server.dist.artifactId>
<auth.server.dist.version>${project.version}</auth.server.dist.version>
<auth.server.dist.unpacked.folder.name>keycloak-${auth.server.dist.version}</auth.server.dist.unpacked.folder.name>
-
+
<!--server-overlay-->
<auth.server.overlay.groupId>org.keycloak</auth.server.overlay.groupId>
<auth.server.overlay.artifactId>keycloak-server-overlay</auth.server.overlay.artifactId>
@@ -50,18 +50,18 @@
<overlaid.container.artifactId>wildfly-dist</overlaid.container.artifactId>
<overlaid.container.version>${wildfly.version}</overlaid.container.version>
<overlaid.container.unpacked.folder.name>wildfly-${overlaid.container.version}</overlaid.container.unpacked.folder.name>
-
+
<!--actual unpacked artifact: server-dist by default, overriden in server-overlay profile-->
<unpacked.artifact.groupId>${auth.server.dist.groupId}</unpacked.artifact.groupId>
<unpacked.artifact.artifactId>${auth.server.dist.artifactId}</unpacked.artifact.artifactId>
<unpacked.artifact.version>${auth.server.dist.version}</unpacked.artifact.version>
-
+
<auth.server.home>${project.build.directory}/unpacked/${auth.server.dist.unpacked.folder.name}</auth.server.home>
-
+
<!--used in profile auth-server-cluster. profile jpa sets this to true-->
<skip.h2.tcp>false</skip.h2.tcp>
</properties>
-
+
<profiles>
<profile>
@@ -279,7 +279,7 @@
</build>
</profile>
-
+
<!-- OPT-IN -->
<profile>
<id>server-overlay</id>
@@ -333,7 +333,7 @@
</goals>
<configuration>
<tasks>
- <move file="${auth.server.home}/standalone/configuration/standalone-keycloak.xml"
+ <move file="${auth.server.home}/standalone/configuration/standalone-keycloak.xml"
tofile="${auth.server.home}/standalone/configuration/standalone.xml"/>
</tasks>
</configuration>
@@ -344,7 +344,7 @@
</pluginManagement>
</build>
</profile>
-
+
<profile>
<id>ssl</id>
<activation>
@@ -404,11 +404,65 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <id>inject-truststore-into-keycloak-server-json</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <ant antfile="../build-truststore.xml" inheritRefs="true">
+ <target name="inject-truststore"/>
+ </ant>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-apache-bsf</artifactId>
+ <version>1.9.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.bsf</groupId>
+ <artifactId>bsf-api</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.7R2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.keycloak</groupId>
+ <artifactId>keycloak-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
</pluginManagement>
</build>
</profile>
-
+
<profile>
<id>jpa</id>
<properties>
@@ -464,7 +518,7 @@
<artifactItems>
<artifactItem>
<groupId>${jdbc.mvn.groupId}</groupId>
- <artifactId>${jdbc.mvn.artifactId}</artifactId>
+ <artifactId>${jdbc.mvn.artifactId}</artifactId>
<version>${jdbc.mvn.version}</version>
<type>jar</type>
</artifactItem>
@@ -551,8 +605,8 @@
</plugins>
</pluginManagement>
</build>
- </profile>
-
+ </profile>
+
<profile>
<id>auth-server-cluster</id>
<properties>
@@ -655,7 +709,7 @@
</pluginManagement>
</build>
</profile>
-
+
<profile>
<id>auth-server-wildfly</id>
<modules>
@@ -668,6 +722,6 @@
<module>eap</module>
</modules>
</profile>
-
+
</profiles>
</project>
diff --git a/testsuite/integration-arquillian/test-apps/js-console/example-realm.json b/testsuite/integration-arquillian/test-apps/js-console/example-realm.json
index 659e5b4..3bc609e 100755
--- a/testsuite/integration-arquillian/test-apps/js-console/example-realm.json
+++ b/testsuite/integration-arquillian/test-apps/js-console/example-realm.json
@@ -51,7 +51,8 @@
"/js-console/*"
],
"webOrigins": [
- "http://localhost:8280"
+ "http://localhost:8280",
+ "https://localhost:8643"
]
}
],
diff --git a/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/index.html b/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/index.html
index 1c41fcf..04d7a8e 100755
--- a/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/index.html
+++ b/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/index.html
@@ -18,6 +18,7 @@
<html>
<head>
<script src="http://localhost:8180/auth/js/keycloak.js"></script>
+ <script src="https://localhost:8543/auth/js/keycloak.js"></script>
</head>
<body>
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/servlet/CustomerServlet.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/servlet/CustomerServlet.java
index 7b75a0f..e174d7e 100644
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/servlet/CustomerServlet.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/servlet/CustomerServlet.java
@@ -56,7 +56,15 @@ public class CustomerServlet extends HttpServlet {
//try {
StringBuilder result = new StringBuilder();
- URL url = new URL(System.getProperty("app.server.base.url", "http://localhost:8280") + "/customer-db/");
+ String urlBase;
+
+ if (System.getProperty("app.server.ssl.required", "false").equals("true")) {
+ urlBase = System.getProperty("app.server.ssl.base.url", "https://localhost:8643");
+ } else {
+ urlBase = System.getProperty("app.server.base.url", "http://localhost:8280");
+ }
+
+ URL url = new URL(urlBase + "/customer-db/");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty(HttpHeaders.AUTHORIZATION, "Bearer " + context.getTokenString());
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/servlet/InputServlet.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/servlet/InputServlet.java
index 171b4b4..a2038bf 100644
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/servlet/InputServlet.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/servlet/InputServlet.java
@@ -18,12 +18,12 @@
package org.keycloak.testsuite.adapter.servlet;
import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
-import javax.servlet.annotation.WebServlet;
/**
* @author <a href="mailto:bburke@redhat.com">Bill Burke</a>
@@ -33,7 +33,12 @@ public class InputServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- String appBase = System.getProperty("app.server.base.url", "http://localhost:8280");
+ String appBase;
+ if (System.getProperty("app.server.ssl.required", "false").equals("true")) {
+ appBase = System.getProperty("app.server.ssl.base.url", "https://localhost:8643");
+ } else {
+ appBase = System.getProperty("app.server.base.url", "http://localhost:8280");
+ }
String actionUrl = appBase + "/input-portal/secured/post";
diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml b/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml
index bb603be..b2a7bb1 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml
+++ b/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml
@@ -25,6 +25,7 @@
<extension qualifier="webdriver">
<property name="browser">${browser}</property>
<property name="firefox_binary">${firefox_binary}</property>
+ <property name="phantomjs.cli.args">--ignore-ssl-errors=true --web-security=false</property>
</extension>
<extension qualifier="graphene">
diff --git a/testsuite/integration-arquillian/tests/other/adapters/jboss/common/xslt/keycloak-subsystem.xsl b/testsuite/integration-arquillian/tests/other/adapters/jboss/common/xslt/keycloak-subsystem.xsl
index bb77613..0027550 100644
--- a/testsuite/integration-arquillian/tests/other/adapters/jboss/common/xslt/keycloak-subsystem.xsl
+++ b/testsuite/integration-arquillian/tests/other/adapters/jboss/common/xslt/keycloak-subsystem.xsl
@@ -7,7 +7,7 @@
<xsl:strip-space elements="*"/>
<xsl:variable name="keycloakSubsystem" select="'urn:jboss:domain:keycloak:1.1'"/>
- <xsl:param name="auth-server-port"/>
+ <xsl:param name="auth-server-host"/>
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $keycloakSubsystem)]">
<xsl:copy>
@@ -16,7 +16,7 @@
<secure-deployment name="customer-portal-subsystem.war">
<realm>demo</realm>
<realm-public-key>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB</realm-public-key>
- <auth-server-url>http://localhost:<xsl:value-of select="$auth-server-port"/>/auth</auth-server-url>
+ <auth-server-url><xsl:value-of select="$auth-server-host"/>/auth</auth-server-url>
<ssl-required>EXTERNAL</ssl-required>
<resource>customer-portal-subsystem</resource>
<credential name="secret">password</credential>
diff --git a/testsuite/integration-arquillian/tests/other/adapters/jboss/pom.xml b/testsuite/integration-arquillian/tests/other/adapters/jboss/pom.xml
index 0d91667..e209e1b 100644
--- a/testsuite/integration-arquillian/tests/other/adapters/jboss/pom.xml
+++ b/testsuite/integration-arquillian/tests/other/adapters/jboss/pom.xml
@@ -62,8 +62,8 @@
<outputDir>${app.server.home}/standalone/configuration</outputDir>
<parameters>
<parameter>
- <name>auth-server-port</name>
- <value>${auth.server.http.port}</value>
+ <name>auth-server-host</name>
+ <value>http://localhost:${auth.server.http.port}</value>
</parameter>
</parameters>
</transformationSet>
@@ -77,6 +77,50 @@
<profiles>
<profile>
+ <id>ssl</id>
+ <activation>
+ <property>
+ <name>app.server.ssl.required</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>Configure keycloak subsystem</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>transform</goal>
+ </goals>
+ <configuration>
+ <transformationSets>
+ <transformationSet>
+ <dir>${app.server.home}/standalone/configuration</dir>
+ <includes>
+ <include>standalone.xml</include>
+ </includes>
+ <stylesheet>${common.resources}/xslt/keycloak-subsystem.xsl</stylesheet>
+ <outputDir>${app.server.home}/standalone/configuration</outputDir>
+ <parameters>
+ <parameter>
+ <name>auth-server-host</name>
+ <value>https://localhost:${auth.server.https.port}</value>
+ </parameter>
+ </parameters>
+ </transformationSet>
+ </transformationSets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
<id>adapter-test-jboss-submodules</id>
<activation>
<file>
@@ -91,7 +135,7 @@
</dependency>
</dependencies>
</profile>
-
+
<profile>
<id>app-server-as7</id>
<modules>
diff --git a/testsuite/integration-arquillian/tests/other/adapters/pom.xml b/testsuite/integration-arquillian/tests/other/adapters/pom.xml
index 5013350..12a7bc0 100644
--- a/testsuite/integration-arquillian/tests/other/adapters/pom.xml
+++ b/testsuite/integration-arquillian/tests/other/adapters/pom.xml
@@ -54,7 +54,12 @@
<app.server.ssl.required>false</app.server.ssl.required>
- <adapter.test.props>-Dapp.server.base.url=http://localhost:${app.server.http.port} -Dmy.host.name=localhost</adapter.test.props>
+ <adapter.test.props>
+ -Dapp.server.base.url=http://localhost:${app.server.http.port}
+ -Dapp.server.ssl.base.url=https://localhost:${app.server.https.port}
+ -Dapp.server.ssl.required=${app.server.ssl.required}
+ -Dmy.host.name=localhost
+ </adapter.test.props>
<app.server.home>${containers.home}/app-server-${app.server}</app.server.home>
<adapter.libs.mode>bundled</adapter.libs.mode>
diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml
index ef8dce7..0ccad8a 100755
--- a/testsuite/integration-arquillian/tests/pom.xml
+++ b/testsuite/integration-arquillian/tests/pom.xml
@@ -659,6 +659,7 @@
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-phantom-driver</artifactId>
+ <version>1.2.1.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>