diff --git a/distribution/saml-adapters/pom.xml b/distribution/saml-adapters/pom.xml
new file mode 100755
index 0000000000..5aacc0fae0
--- /dev/null
+++ b/distribution/saml-adapters/pom.xml
@@ -0,0 +1,30 @@
+
+
+ keycloak-parent
+ org.keycloak
+ 1.6.0.Final-SNAPSHOT
+ ../../pom.xml
+
+
+ Adapters Distribution Parent
+
+ 4.0.0
+
+ keycloak-adapters-distribution-parent
+ pom
+
+
+ as7-eap6-adapter
+ jetty81-adapter-zip
+ jetty91-adapter-zip
+ jetty92-adapter-zip
+ js-adapter-zip
+ osgi
+ tomcat6-adapter-zip
+ tomcat7-adapter-zip
+ tomcat8-adapter-zip
+ wf8-adapter
+ wf9-adapter
+
+
diff --git a/distribution/saml-adapters/shared-cli/adapter-install.cli b/distribution/saml-adapters/shared-cli/adapter-install.cli
new file mode 100755
index 0000000000..d1bdfa3ca4
--- /dev/null
+++ b/distribution/saml-adapters/shared-cli/adapter-install.cli
@@ -0,0 +1,2 @@
+/extension=org.keycloak.keycloak-saml-adapter-subsystem/:add(module=org.keycloak.keycloak-saml-adapter-subsystem)
+/subsystem=keycloak-saml:add
\ No newline at end of file
diff --git a/distribution/saml-adapters/wf9-adapter/pom.xml b/distribution/saml-adapters/wf9-adapter/pom.xml
new file mode 100755
index 0000000000..894f5085d5
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/pom.xml
@@ -0,0 +1,20 @@
+
+
+ keycloak-parent
+ org.keycloak
+ 1.6.0.Final-SNAPSHOT
+ ../../../pom.xml
+
+ Keycloak Wildfly 9 SAML Adapter
+
+ 4.0.0
+
+ keycloak-saml-wf9-adapter-dist-pom
+ pom
+
+
+ wf9-modules
+ wf9-adapter-zip
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-adapter-zip/assembly.xml b/distribution/saml-adapters/wf9-adapter/wf9-adapter-zip/assembly.xml
new file mode 100755
index 0000000000..0aea17cf75
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-adapter-zip/assembly.xml
@@ -0,0 +1,35 @@
+
+ war-dist
+
+
+ zip
+ tar.gz
+
+ false
+
+
+
+ ${project.build.directory}/unpacked
+
+ org/keycloak/keycloak-core/**
+ org/keycloak/keycloak-saml-adapter-core/**
+ org/keycloak/keycloak-adapter-spi/**
+ org/keycloak/keycloak-jboss-adapter-core/**
+ org/keycloak/keycloak-saml-undertow-adapter/**
+ org/keycloak/keycloak-saml-wildfly-adapter/**
+ org/keycloak/keycloak-saml-wf9-subsystem/**
+ org/keycloak/keycloak-saml-adapter-subsystem/**
+
+
+ **/*.war
+
+ modules/system/layers/base
+
+
+
+
+
+ bin
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-adapter-zip/pom.xml b/distribution/saml-adapters/wf9-adapter/wf9-adapter-zip/pom.xml
new file mode 100755
index 0000000000..e3ae530c45
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-adapter-zip/pom.xml
@@ -0,0 +1,76 @@
+
+ 4.0.0
+
+ keycloak-parent
+ org.keycloak
+ 1.6.0.Final-SNAPSHOT
+ ../../../../pom.xml
+
+
+ keycloak-saml-wf9-adapter-dist
+ pom
+ Keycloak Wildfly 9 SAML Adapter Distro
+
+
+
+
+ org.keycloak
+ keycloak-saml-wf9-modules
+ zip
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ unpack
+ prepare-package
+
+ unpack
+
+
+
+
+ org.keycloak
+ keycloak-saml-wf9-modules
+ zip
+ ${project.build.directory}/unpacked
+
+
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ assembly.xml
+
+
+ target
+
+
+ target/assembly/work
+
+ false
+
+
+
+
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/assembly.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/assembly.xml
new file mode 100755
index 0000000000..4a34435ac4
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/assembly.xml
@@ -0,0 +1,22 @@
+
+ dist
+
+
+ zip
+
+ false
+
+
+
+ ../../
+
+ License.html
+
+
+
+
+ ${project.build.directory}/modules
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/build.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/build.xml
new file mode 100755
index 0000000000..de0eaaa598
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/build.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/lib.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/lib.xml
new file mode 100755
index 0000000000..3d9438a4a4
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/lib.xml
@@ -0,0 +1,282 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
+ project.setProperty("current.maven.root", root);
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
+ if(path.indexOf('${') != -1) {
+ throw "Module resource root not found, make sure it is listed in build/pom.xml" + path;
+ }
+ if(attributes.get("jandex") == "true" ) {
+ root = root + "\n\t";
+ }
+ project.setProperty("current.resource.root", root);
+ ]]>
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/pom.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/pom.xml
new file mode 100755
index 0000000000..138930802a
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/pom.xml
@@ -0,0 +1,160 @@
+
+
+
+ 4.0.0
+
+
+ keycloak-parent
+ org.keycloak
+ 1.6.0.Final-SNAPSHOT
+ ../../../../pom.xml
+
+
+ keycloak-saml-wf9-modules
+
+ Keycloak Wildfly 9 Modules
+ pom
+
+
+ org.keycloak
+ keycloak-core
+
+
+ org.keycloak
+ keycloak-adapter-spi
+
+
+ org.keycloak
+ keycloak-undertow-adapter-spi
+
+
+ org.keycloak
+ keycloak-saml-adapter-core
+
+
+ org.keycloak
+ keycloak-jboss-adapter-core
+
+
+ org.keycloak
+ keycloak-saml-undertow-adapter
+
+
+ org.keycloak
+ keycloak-saml-wildfly-adapter
+
+
+ org.keycloak
+ keycloak-saml-wf9-subsystem
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+ false
+
+
+ build-dist
+
+ run
+
+ compile
+
+
+
+
+
+
+
+
+
+
+
+ org.jboss
+ jandex
+ 1.0.3.Final
+
+
+ ant-contrib
+ ant-contrib
+ 1.0b3
+
+
+ ant
+ ant
+
+
+
+
+ org.apache.ant
+ ant-apache-bsf
+ 1.9.3
+
+
+ org.apache.bsf
+ bsf-api
+ 3.1
+
+
+ rhino
+ js
+ 1.7R2
+
+
+
+
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ assembly.xml
+
+
+ target
+
+
+ target/assembly/work
+
+ false
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ copy-resources
+
+ validate
+
+ copy-resources
+
+
+ ${project.build.directory}/modules/org/keycloak/keycloak-saml-adapter-subsystem
+
+
+ src/main/resources/modules/org/keycloak/keycloak-saml-adapter-subsystem
+ true
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-adapter-spi/main/module.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-adapter-spi/main/module.xml
new file mode 100755
index 0000000000..850c46a2f5
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-adapter-spi/main/module.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-core/main/module.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-core/main/module.xml
new file mode 100755
index 0000000000..dab80400a8
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-core/main/module.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-jboss-adapter-core/main/module.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-jboss-adapter-core/main/module.xml
new file mode 100755
index 0000000000..f1ee530cda
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-jboss-adapter-core/main/module.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-adapter-core/main/module.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-adapter-core/main/module.xml
new file mode 100755
index 0000000000..4301133395
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-adapter-core/main/module.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-adapter-subsystem/main/module.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-adapter-subsystem/main/module.xml
new file mode 100755
index 0000000000..cc692a6b74
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-adapter-subsystem/main/module.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-undertow-adapter/main/module.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-undertow-adapter/main/module.xml
new file mode 100755
index 0000000000..4dd6f2d102
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-undertow-adapter/main/module.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-wf9-subsystem/main/module.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-wf9-subsystem/main/module.xml
new file mode 100755
index 0000000000..363c2f3cd9
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-wf9-subsystem/main/module.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-wildfly-adapter/main/module.xml b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-wildfly-adapter/main/module.xml
new file mode 100755
index 0000000000..295b1f0cb4
--- /dev/null
+++ b/distribution/saml-adapters/wf9-adapter/wf9-modules/src/main/resources/modules/org/keycloak/keycloak-saml-wildfly-adapter/main/module.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 981547353c..4d9cfd3079 100755
--- a/pom.xml
+++ b/pom.xml
@@ -884,17 +884,17 @@
org.keycloak
- keycloak-tomcat6-saml-adapter
+ keycloak-saml-tomcat6-adapter
${project.version}
org.keycloak
- keycloak-tomcat7-saml-adapter
+ keycloak-saml-tomcat7-adapter
${project.version}
org.keycloak
- keycloak-tomcat8-saml-adapter
+ keycloak-saml-tomcat8-adapter
${project.version}
@@ -999,32 +999,42 @@
org.keycloak
- keycloak-tomcat-core-saml-adapter
+ keycloak-saml-tomcat-adapter-core
${project.version}
org.keycloak
- keycloak-jetty-saml-adapter-core
+ keycloak-saml-jetty-adapter-core
${project.version}
org.keycloak
- keycloak-jetty81-saml-adapter
+ keycloak-saml-jetty81-adapter
${project.version}
org.keycloak
- keycloak-jetty91-saml-adapter
+ keycloak-saml-jetty91-adapter
${project.version}
org.keycloak
- keycloak-jetty92-saml-adapter
+ keycloak-saml-wildfly-adapter
${project.version}
org.keycloak
- keycloak-undertow-saml-adapter
+ keycloak-saml-wf9-subsystem
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-saml-jetty92-adapter
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-saml-undertow-adapter
${project.version}
diff --git a/saml/client-adapter/core/src/main/java/org/keycloak/adapters/saml/SamlSession.java b/saml/client-adapter/core/src/main/java/org/keycloak/adapters/saml/SamlSession.java
index df53ed6a6a..201c46445f 100755
--- a/saml/client-adapter/core/src/main/java/org/keycloak/adapters/saml/SamlSession.java
+++ b/saml/client-adapter/core/src/main/java/org/keycloak/adapters/saml/SamlSession.java
@@ -1,5 +1,7 @@
package org.keycloak.adapters.saml;
+import org.keycloak.adapters.KeycloakAccount;
+
import java.io.Serializable;
import java.security.Principal;
import java.util.Set;
@@ -8,7 +10,7 @@ import java.util.Set;
* @author Bill Burke
* @version $Revision: 1 $
*/
-public class SamlSession implements Serializable {
+public class SamlSession implements Serializable, KeycloakAccount {
private SamlPrincipal principal;
private Set roles;
private String sessionIndex;
diff --git a/saml/client-adapter/jetty/jetty-core/pom.xml b/saml/client-adapter/jetty/jetty-core/pom.xml
index 40353190bf..90e1cd4588 100755
--- a/saml/client-adapter/jetty/jetty-core/pom.xml
+++ b/saml/client-adapter/jetty/jetty-core/pom.xml
@@ -9,7 +9,7 @@
4.0.0
- keycloak-jetty-saml-adapter-core
+ keycloak-saml-jetty-adapter-core
Keycloak Jetty Core SAML Integration
8.1.17.v20150415
diff --git a/saml/client-adapter/jetty/jetty8.1/pom.xml b/saml/client-adapter/jetty/jetty8.1/pom.xml
index fbfa74424d..7ccbb8eeab 100755
--- a/saml/client-adapter/jetty/jetty8.1/pom.xml
+++ b/saml/client-adapter/jetty/jetty8.1/pom.xml
@@ -9,7 +9,7 @@
4.0.0
- keycloak-jetty81-saml-adapter
+ keycloak-saml-jetty81-adapter
Keycloak Jetty 8.1.x SAML Integration
8.1.17.v20150415
@@ -44,7 +44,7 @@
org.keycloak
- keycloak-jetty-saml-adapter-core
+ keycloak-saml-jetty-adapter-core
org.bouncycastle
diff --git a/saml/client-adapter/jetty/jetty9.1/pom.xml b/saml/client-adapter/jetty/jetty9.1/pom.xml
index acc7127bdd..7290530ea8 100755
--- a/saml/client-adapter/jetty/jetty9.1/pom.xml
+++ b/saml/client-adapter/jetty/jetty9.1/pom.xml
@@ -9,7 +9,7 @@
4.0.0
- keycloak-jetty91-saml-adapter
+ keycloak-saml-jetty91-adapter
Keycloak Jetty 9.1.x SAML Integration
9.1.5.v20140505
@@ -45,7 +45,7 @@
org.keycloak
- keycloak-jetty-saml-adapter-core
+ keycloak-saml-jetty-adapter-core
org.eclipse.jetty
diff --git a/saml/client-adapter/jetty/jetty9.2/pom.xml b/saml/client-adapter/jetty/jetty9.2/pom.xml
index a7776a4492..7282fa4998 100755
--- a/saml/client-adapter/jetty/jetty9.2/pom.xml
+++ b/saml/client-adapter/jetty/jetty9.2/pom.xml
@@ -9,7 +9,7 @@
4.0.0
- keycloak-jetty92-saml-adapter
+ keycloak-saml-jetty92-adapter
Keycloak Jetty 9.2.x SAML Integration
9.2.4.v20141103
@@ -49,7 +49,7 @@
org.keycloak
- keycloak-jetty-saml-adapter-core
+ keycloak-saml-jetty-adapter-core
org.eclipse.jetty
diff --git a/saml/client-adapter/jetty/pom.xml b/saml/client-adapter/jetty/pom.xml
index 43664cc4c4..8f85626584 100755
--- a/saml/client-adapter/jetty/pom.xml
+++ b/saml/client-adapter/jetty/pom.xml
@@ -10,7 +10,7 @@
4.0.0
- keycloak-jetty-saml-integration-pom
+ keycloak-saml-jetty-integration-pom
pom
diff --git a/saml/client-adapter/pom.xml b/saml/client-adapter/pom.xml
index 3bfbdc67a1..e101055836 100755
--- a/saml/client-adapter/pom.xml
+++ b/saml/client-adapter/pom.xml
@@ -18,5 +18,6 @@
undertow
tomcat
jetty
+ wildfly
diff --git a/saml/client-adapter/tomcat/pom.xml b/saml/client-adapter/tomcat/pom.xml
index 141343cd3b..d92edd3eb6 100755
--- a/saml/client-adapter/tomcat/pom.xml
+++ b/saml/client-adapter/tomcat/pom.xml
@@ -10,7 +10,7 @@
4.0.0
- keycloak-tomcat-saml-integration-pom
+ keycloak-saml-tomcat-integration-pom
pom
diff --git a/saml/client-adapter/tomcat/tomcat-core/pom.xml b/saml/client-adapter/tomcat/tomcat-core/pom.xml
index 5402eacdf9..365921f78a 100755
--- a/saml/client-adapter/tomcat/tomcat-core/pom.xml
+++ b/saml/client-adapter/tomcat/tomcat-core/pom.xml
@@ -9,7 +9,7 @@
4.0.0
- keycloak-tomcat-core-saml-adapter
+ keycloak-saml-tomcat-adapter-core
Keycloak Tomcat Core SAML Integration
diff --git a/saml/client-adapter/tomcat/tomcat6/pom.xml b/saml/client-adapter/tomcat/tomcat6/pom.xml
index 9c8e6aca4a..ef4688f6d4 100755
--- a/saml/client-adapter/tomcat/tomcat6/pom.xml
+++ b/saml/client-adapter/tomcat/tomcat6/pom.xml
@@ -9,7 +9,7 @@
4.0.0
- keycloak-tomcat6-saml-adapter
+ keycloak-saml-tomcat6-adapter
Keycloak Tomcat 6 Saml Integration
6.0.41
@@ -24,7 +24,7 @@
org.keycloak
- keycloak-tomcat-core-saml-adapter
+ keycloak-saml-tomcat-adapter-core
org.apache.tomcat
diff --git a/saml/client-adapter/tomcat/tomcat7/pom.xml b/saml/client-adapter/tomcat/tomcat7/pom.xml
index 6a94f99f81..40bd41e469 100755
--- a/saml/client-adapter/tomcat/tomcat7/pom.xml
+++ b/saml/client-adapter/tomcat/tomcat7/pom.xml
@@ -9,7 +9,7 @@
4.0.0
- keycloak-tomcat7-saml-adapter
+ keycloak-saml-tomcat7-adapter
Keycloak Tomcat 7 SAML Integration
@@ -25,7 +25,7 @@
org.keycloak
- keycloak-tomcat-core-saml-adapter
+ keycloak-saml-tomcat-adapter-core
org.apache.tomcat
diff --git a/saml/client-adapter/tomcat/tomcat8/pom.xml b/saml/client-adapter/tomcat/tomcat8/pom.xml
index c3da5902fb..b3673b6166 100755
--- a/saml/client-adapter/tomcat/tomcat8/pom.xml
+++ b/saml/client-adapter/tomcat/tomcat8/pom.xml
@@ -9,7 +9,7 @@
4.0.0
- keycloak-tomcat8-saml-adapter
+ keycloak-saml-tomcat8-adapter
Keycloak Tomcat 8 SAML Integration
8.0.14
@@ -37,7 +37,7 @@
org.keycloak
- keycloak-tomcat-core-saml-adapter
+ keycloak-saml-tomcat-adapter-core
org.apache.tomcat
diff --git a/saml/client-adapter/undertow/pom.xml b/saml/client-adapter/undertow/pom.xml
index c7401b9e4d..90bb589104 100755
--- a/saml/client-adapter/undertow/pom.xml
+++ b/saml/client-adapter/undertow/pom.xml
@@ -9,7 +9,7 @@
4.0.0
- keycloak-undertow-saml-adapter
+ keycloak-saml-undertow-adapter
Keycloak Undertow SAML Adapter
diff --git a/saml/client-adapter/undertow/src/main/java/org/keycloak/adapters/saml/undertow/SamlServletExtension.java b/saml/client-adapter/undertow/src/main/java/org/keycloak/adapters/saml/undertow/SamlServletExtension.java
index ac3da618ae..615e4a686a 100755
--- a/saml/client-adapter/undertow/src/main/java/org/keycloak/adapters/saml/undertow/SamlServletExtension.java
+++ b/saml/client-adapter/undertow/src/main/java/org/keycloak/adapters/saml/undertow/SamlServletExtension.java
@@ -140,7 +140,7 @@ public class SamlServletExtension implements ServletExtension {
servletContext.setAttribute(SamlDeploymentContext.class.getName(), deploymentContext);
UndertowUserSessionManagement userSessionManagement = new UndertowUserSessionManagement();
- final ServletSamlAuthMech mech = new ServletSamlAuthMech(deploymentContext, userSessionManagement, getErrorPage(deploymentInfo));
+ final ServletSamlAuthMech mech = createAuthMech(deploymentInfo, deploymentContext, userSessionManagement);
// setup handlers
@@ -176,6 +176,10 @@ public class SamlServletExtension implements ServletExtension {
}
+ protected ServletSamlAuthMech createAuthMech(DeploymentInfo deploymentInfo, SamlDeploymentContext deploymentContext, UndertowUserSessionManagement userSessionManagement) {
+ return new ServletSamlAuthMech(deploymentContext, userSessionManagement, getErrorPage(deploymentInfo));
+ }
+
protected String getErrorPage(DeploymentInfo deploymentInfo) {
LoginConfig loginConfig = deploymentInfo.getLoginConfig();
String errorPage = null;
diff --git a/saml/client-adapter/undertow/src/main/java/org/keycloak/adapters/saml/undertow/ServletSamlAuthMech.java b/saml/client-adapter/undertow/src/main/java/org/keycloak/adapters/saml/undertow/ServletSamlAuthMech.java
index a5a0bd48cf..3ea9a0f672 100755
--- a/saml/client-adapter/undertow/src/main/java/org/keycloak/adapters/saml/undertow/ServletSamlAuthMech.java
+++ b/saml/client-adapter/undertow/src/main/java/org/keycloak/adapters/saml/undertow/ServletSamlAuthMech.java
@@ -25,7 +25,7 @@ import java.io.IOException;
* @version $Revision: 1 $
*/
public class ServletSamlAuthMech extends AbstractSamlAuthMech {
- private SessionIdMapper idMapper = new InMemorySessionIdMapper();
+ protected SessionIdMapper idMapper = new InMemorySessionIdMapper();
public ServletSamlAuthMech(SamlDeploymentContext deploymentContext, UndertowUserSessionManagement sessionManagement, String errorPage) {
super(deploymentContext, sessionManagement, errorPage);
}
diff --git a/saml/client-adapter/wildfly/pom.xml b/saml/client-adapter/wildfly/pom.xml
new file mode 100755
index 0000000000..4a8ea242e6
--- /dev/null
+++ b/saml/client-adapter/wildfly/pom.xml
@@ -0,0 +1,20 @@
+
+
+ keycloak-parent
+ org.keycloak
+ 1.6.0.Final-SNAPSHOT
+ ../../../pom.xml
+
+ Keycloak SAML Wildfly Integration
+
+ 4.0.0
+
+ keycloak-saml-wildfly-integration-pom
+ pom
+
+
+ wildfly-adapter
+ wildfly9-subsystem
+
+
diff --git a/saml/client-adapter/wildfly/wildfly-adapter/pom.xml b/saml/client-adapter/wildfly/wildfly-adapter/pom.xml
new file mode 100755
index 0000000000..7f28e91e58
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly-adapter/pom.xml
@@ -0,0 +1,88 @@
+
+
+
+ keycloak-parent
+ org.keycloak
+ 1.6.0.Final-SNAPSHOT
+ ../../../../pom.xml
+
+ 4.0.0
+
+ keycloak-saml-wildfly-adapter
+ Keycloak Wildfly SAML Adapter
+
+
+
+
+ org.jboss.logging
+ jboss-logging
+ ${jboss.logging.version}
+ provided
+
+
+ org.keycloak
+ keycloak-core
+
+
+ org.keycloak
+ keycloak-adapter-spi
+
+
+ org.keycloak
+ keycloak-saml-adapter-core
+
+
+ org.keycloak
+ keycloak-undertow-adapter-spi
+
+
+ org.keycloak
+ keycloak-saml-undertow-adapter
+
+
+ org.keycloak
+ keycloak-jboss-adapter-core
+
+
+ org.picketbox
+ picketbox
+ 4.0.20.Final
+ provided
+
+
+ org.jboss.spec.javax.servlet
+ jboss-servlet-api_3.0_spec
+ provided
+
+
+
+ io.undertow
+ undertow-servlet
+ provided
+
+
+ io.undertow
+ undertow-core
+ provided
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ ${maven.compiler.target}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/SecurityInfoHelper.java b/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/SecurityInfoHelper.java
new file mode 100755
index 0000000000..b01cb1cce3
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/SecurityInfoHelper.java
@@ -0,0 +1,116 @@
+package org.keycloak.adapters.saml.wildfly;
+
+import org.jboss.security.NestableGroup;
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.security.SimpleGroup;
+import org.jboss.security.SimplePrincipal;
+import org.keycloak.adapters.KeycloakAccount;
+
+import javax.security.auth.Subject;
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * @author Bill Burke
+ * @version $Revision: 1 $
+ */
+public class SecurityInfoHelper {
+ public static void propagateSessionInfo(KeycloakAccount account) {
+ Subject subject = new Subject();
+ Set principals = subject.getPrincipals();
+ principals.add(account.getPrincipal());
+ Group[] roleSets = getRoleSets(account.getRoles());
+ for (int g = 0; g < roleSets.length; g++) {
+ Group group = roleSets[g];
+ String name = group.getName();
+ Group subjectGroup = createGroup(name, principals);
+ if (subjectGroup instanceof NestableGroup) {
+ /* A NestableGroup only allows Groups to be added to it so we
+ need to add a SimpleGroup to subjectRoles to contain the roles
+ */
+ SimpleGroup tmp = new SimpleGroup("Roles");
+ subjectGroup.addMember(tmp);
+ subjectGroup = tmp;
+ }
+ // Copy the group members to the Subject group
+ Enumeration extends Principal> members = group.members();
+ while (members.hasMoreElements()) {
+ Principal role = (Principal) members.nextElement();
+ subjectGroup.addMember(role);
+ }
+ }
+ // add the CallerPrincipal group if none has been added in getRoleSets
+ Group callerGroup = new SimpleGroup(SecurityConstants.CALLER_PRINCIPAL_GROUP);
+ callerGroup.addMember(account.getPrincipal());
+ principals.add(callerGroup);
+ org.jboss.security.SecurityContext sc = SecurityContextAssociation.getSecurityContext();
+ Principal userPrincipal = getPrincipal(subject);
+ sc.getUtil().createSubjectInfo(userPrincipal, account, subject);
+ }
+
+ /**
+ * Get the Principal given the authenticated Subject. Currently the first subject that is not of type {@code Group} is
+ * considered or the single subject inside the CallerPrincipal group.
+ *
+ * @param subject
+ * @return the authenticated subject
+ */
+ protected static Principal getPrincipal(Subject subject) {
+ Principal principal = null;
+ Principal callerPrincipal = null;
+ if (subject != null) {
+ Set principals = subject.getPrincipals();
+ if (principals != null && !principals.isEmpty()) {
+ for (Principal p : principals) {
+ if (!(p instanceof Group) && principal == null) {
+ principal = p;
+ }
+ if (p instanceof Group) {
+ Group g = Group.class.cast(p);
+ if (g.getName().equals(SecurityConstants.CALLER_PRINCIPAL_GROUP) && callerPrincipal == null) {
+ Enumeration extends Principal> e = g.members();
+ if (e.hasMoreElements())
+ callerPrincipal = e.nextElement();
+ }
+ }
+ }
+ }
+ }
+ return callerPrincipal == null ? principal : callerPrincipal;
+ }
+
+ protected static Group createGroup(String name, Set principals) {
+ Group roles = null;
+ Iterator iter = principals.iterator();
+ while (iter.hasNext()) {
+ Object next = iter.next();
+ if ((next instanceof Group) == false)
+ continue;
+ Group grp = (Group) next;
+ if (grp.getName().equals(name)) {
+ roles = grp;
+ break;
+ }
+ }
+ // If we did not find a group create one
+ if (roles == null) {
+ roles = new SimpleGroup(name);
+ principals.add(roles);
+ }
+ return roles;
+ }
+
+ protected static Group[] getRoleSets(Collection roleSet) {
+ SimpleGroup roles = new SimpleGroup("Roles");
+ Group[] roleSets = {roles};
+ for (String role : roleSet) {
+ roles.addMember(new SimplePrincipal(role));
+ }
+ return roleSets;
+ }
+}
diff --git a/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/WildflySamlAuthMech.java b/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/WildflySamlAuthMech.java
new file mode 100755
index 0000000000..f8cfd3e85a
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/WildflySamlAuthMech.java
@@ -0,0 +1,25 @@
+package org.keycloak.adapters.saml.wildfly;
+
+import io.undertow.security.api.SecurityContext;
+import io.undertow.server.HttpServerExchange;
+import org.keycloak.adapters.HttpFacade;
+import org.keycloak.adapters.saml.SamlDeployment;
+import org.keycloak.adapters.saml.SamlDeploymentContext;
+import org.keycloak.adapters.saml.SamlSessionStore;
+import org.keycloak.adapters.saml.undertow.ServletSamlAuthMech;
+import org.keycloak.adapters.undertow.UndertowUserSessionManagement;
+
+/**
+ * @author Bill Burke
+ * @version $Revision: 1 $
+ */
+public class WildflySamlAuthMech extends ServletSamlAuthMech {
+ public WildflySamlAuthMech(SamlDeploymentContext deploymentContext, UndertowUserSessionManagement sessionManagement, String errorPage) {
+ super(deploymentContext, sessionManagement, errorPage);
+ }
+
+ @Override
+ protected SamlSessionStore getTokenStore(HttpServerExchange exchange, HttpFacade facade, SamlDeployment deployment, SecurityContext securityContext) {
+ return new WildflySamlSessionStore(exchange, sessionManagement, securityContext, idMapper);
+ }
+}
diff --git a/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/WildflySamlExtension.java b/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/WildflySamlExtension.java
new file mode 100755
index 0000000000..191365ff65
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/WildflySamlExtension.java
@@ -0,0 +1,18 @@
+package org.keycloak.adapters.saml.wildfly;
+
+import io.undertow.servlet.api.DeploymentInfo;
+import org.keycloak.adapters.saml.SamlDeploymentContext;
+import org.keycloak.adapters.saml.undertow.SamlServletExtension;
+import org.keycloak.adapters.saml.undertow.ServletSamlAuthMech;
+import org.keycloak.adapters.undertow.UndertowUserSessionManagement;
+
+/**
+ * @author Bill Burke
+ * @version $Revision: 1 $
+ */
+public class WildflySamlExtension extends SamlServletExtension {
+ @Override
+ protected ServletSamlAuthMech createAuthMech(DeploymentInfo deploymentInfo, SamlDeploymentContext deploymentContext, UndertowUserSessionManagement userSessionManagement) {
+ return new WildflySamlAuthMech(deploymentContext, userSessionManagement, getErrorPage(deploymentInfo));
+ }
+}
diff --git a/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/WildflySamlSessionStore.java b/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/WildflySamlSessionStore.java
new file mode 100755
index 0000000000..c6cd812379
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly-adapter/src/main/java/org/keycloak/adapters/saml/wildfly/WildflySamlSessionStore.java
@@ -0,0 +1,36 @@
+package org.keycloak.adapters.saml.wildfly;
+
+import io.undertow.security.api.SecurityContext;
+import io.undertow.server.HttpServerExchange;
+import org.keycloak.adapters.SessionIdMapper;
+import org.keycloak.adapters.saml.SamlSession;
+import org.keycloak.adapters.saml.undertow.ServletSamlSessionStore;
+import org.keycloak.adapters.undertow.UndertowUserSessionManagement;
+
+/**
+ * @author Bill Burke
+ * @version $Revision: 1 $
+ */
+public class WildflySamlSessionStore extends ServletSamlSessionStore {
+ public WildflySamlSessionStore(HttpServerExchange exchange, UndertowUserSessionManagement sessionManagement,
+ SecurityContext securityContext, SessionIdMapper idMapper) {
+ super(exchange, sessionManagement, securityContext, idMapper);
+ }
+
+ @Override
+ public boolean isLoggedIn() {
+ if (super.isLoggedIn()) {
+ SecurityInfoHelper.propagateSessionInfo(getAccount());
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void saveAccount(SamlSession account) {
+ super.saveAccount(account);
+ SecurityInfoHelper.propagateSessionInfo(account);
+ }
+
+
+}
diff --git a/saml/client-adapter/wildfly/wildfly-adapter/src/main/resources/META-INF/services/io.undertow.servlet.ServletExtension b/saml/client-adapter/wildfly/wildfly-adapter/src/main/resources/META-INF/services/io.undertow.servlet.ServletExtension
new file mode 100755
index 0000000000..f61d13cd19
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly-adapter/src/main/resources/META-INF/services/io.undertow.servlet.ServletExtension
@@ -0,0 +1 @@
+org.keycloak.adapters.saml.wildfly.WildflySamlExtension
diff --git a/saml/client-adapter/wildfly/wildfly9-subsystem/pom.xml b/saml/client-adapter/wildfly/wildfly9-subsystem/pom.xml
new file mode 100755
index 0000000000..3b4fe2b58b
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly9-subsystem/pom.xml
@@ -0,0 +1,105 @@
+
+
+
+ 4.0.0
+
+
+ org.keycloak
+ keycloak-parent
+ 1.6.0.Final-SNAPSHOT
+ ../../../../pom.xml
+
+
+ keycloak-saml-wf9-subsystem
+ Keycloak Wildfly 9 SAML Adapter Subsystem
+
+ jar
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ false
+ true
+
+
+ jboss.home
+ ${jboss.home}
+
+
+
+ **/*TestCase.java
+
+
+
+
+
+
+
+
+ org.wildfly.core
+ wildfly-controller
+ provided
+
+
+ org.wildfly.core
+ wildfly-server
+ provided
+
+
+ org.wildfly
+ wildfly-web-common
+ provided
+
+
+ org.jboss.logging
+ jboss-logging-annotations
+ ${jboss-logging-tools.version}
+
+ provided
+ true
+
+
+
+ org.jboss.logging
+ jboss-logging-processor
+
+ provided
+ true
+
+
+
+ org.wildfly.core
+ wildfly-subsystem-test-framework
+ test
+
+
+ junit
+ junit
+ test
+
+
+ org.keycloak
+ keycloak-saml-wildfly-adapter
+ ${project.version}
+
+
+
diff --git a/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakAdapterConfigDeploymentProcessor.java b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakAdapterConfigDeploymentProcessor.java
new file mode 100755
index 0000000000..6950fb6032
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakAdapterConfigDeploymentProcessor.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ *
+ * 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.
+ */
+
+package org.keycloak.subsystem.adapter.saml.extension;
+
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.as.web.common.WarMetaData;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.LoginConfigMetaData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Pass authentication data (keycloak.json) as a servlet context param so it can be read by the KeycloakServletExtension.
+ *
+ * @author Stan Silvert ssilvert@redhat.com (C) 2014 Red Hat Inc.
+ */
+public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitProcessor {
+ protected Logger log = Logger.getLogger(KeycloakAdapterConfigDeploymentProcessor.class);
+
+ @Override
+ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
+ DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+
+ String deploymentName = deploymentUnit.getName();
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit du) {
+
+ }
+
+}
diff --git a/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakDependencyProcessor.java b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakDependencyProcessor.java
new file mode 100755
index 0000000000..6105574563
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakDependencyProcessor.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ *
+ * 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.
+ */
+
+package org.keycloak.subsystem.adapter.saml.extension;
+
+import org.jboss.as.server.deployment.Attachments;
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.as.server.deployment.module.ModuleDependency;
+import org.jboss.as.server.deployment.module.ModuleSpecification;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoader;
+
+/**
+ *
+ * @author Stan Silvert ssilvert@redhat.com (C) 2013 Red Hat Inc.
+ */
+public abstract class KeycloakDependencyProcessor implements DeploymentUnitProcessor {
+
+ private static final ModuleIdentifier KEYCLOAK_JBOSS_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-jboss-adapter-core");
+ private static final ModuleIdentifier KEYCLOAK_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-saml-adapter-core");
+ private static final ModuleIdentifier KEYCLOAK_CORE = ModuleIdentifier.create("org.keycloak.keycloak-core");
+
+ @Override
+ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
+ final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+
+ // Next phase, need to detect if this is a Keycloak deployment. If not, don't add the modules.
+
+ final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
+ final ModuleLoader moduleLoader = Module.getBootModuleLoader();
+ addCommonModules(moduleSpecification, moduleLoader);
+ addPlatformSpecificModules(moduleSpecification, moduleLoader);
+ }
+
+ private void addCommonModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
+ // ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
+ moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_JBOSS_CORE_ADAPTER, false, false, false, false));
+ moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE_ADAPTER, false, false, false, false));
+ moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE, false, false, false, false));
+ }
+
+ abstract protected void addPlatformSpecificModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader);
+
+ @Override
+ public void undeploy(DeploymentUnit du) {
+
+ }
+
+}
diff --git a/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakDependencyProcessorWildFly.java b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakDependencyProcessorWildFly.java
new file mode 100755
index 0000000000..163bc055ca
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakDependencyProcessorWildFly.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ *
+ * 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.
+ */
+
+package org.keycloak.subsystem.adapter.saml.extension;
+
+import org.jboss.as.server.deployment.module.ModuleDependency;
+import org.jboss.as.server.deployment.module.ModuleSpecification;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoader;
+
+/**
+ * Add platform-specific modules for WildFly.
+ *
+ * @author Stan Silvert ssilvert@redhat.com (C) 2014 Red Hat Inc.
+ */
+public class KeycloakDependencyProcessorWildFly extends KeycloakDependencyProcessor {
+
+ private static final ModuleIdentifier KEYCLOAK_WILDFLY_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-wildfly-saml-adapter");
+ private static final ModuleIdentifier KEYCLOAK_UNDERTOW_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-undertow-saml-adapter");
+
+ @Override
+ protected void addPlatformSpecificModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
+ // ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
+ moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_WILDFLY_ADAPTER, false, false, true, false));
+ moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_UNDERTOW_ADAPTER, false, false, false, false));
+ }
+}
diff --git a/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSamlExtension.java b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSamlExtension.java
new file mode 100755
index 0000000000..0a5de82358
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSamlExtension.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ *
+ * 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.
+ */
+package org.keycloak.subsystem.adapter.saml.extension;
+
+import org.jboss.as.controller.Extension;
+import org.jboss.as.controller.ExtensionContext;
+import org.jboss.as.controller.ModelVersion;
+import org.jboss.as.controller.PathElement;
+import org.jboss.as.controller.ResourceDefinition;
+import org.jboss.as.controller.SubsystemRegistration;
+import org.jboss.as.controller.descriptions.StandardResourceDescriptionResolver;
+import org.jboss.as.controller.parsing.ExtensionParsingContext;
+import org.jboss.as.controller.registry.ManagementResourceRegistration;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
+
+
+/**
+ * Main Extension class for the subsystem.
+ *
+ * @author Stan Silvert ssilvert@redhat.com (C) 2013 Red Hat Inc.
+ */
+public class KeycloakSamlExtension implements Extension {
+
+ public static final String SUBSYSTEM_NAME = "keycloak-saml";
+ public static final String NAMESPACE = "urn:jboss:domain:keycloak-saml:1.6";
+ private static final KeycloakSubsystemParser PARSER = new KeycloakSubsystemParser();
+ static final PathElement PATH_SUBSYSTEM = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME);
+ private static final String RESOURCE_NAME = KeycloakSamlExtension.class.getPackage().getName() + ".LocalDescriptions";
+ private static final ModelVersion MGMT_API_VERSION = ModelVersion.create(1,1,0);
+ static final PathElement SUBSYSTEM_PATH = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME);
+ private static final ResourceDefinition KEYCLOAK_SUBSYSTEM_RESOURCE = new KeycloakSubsystemDefinition();
+
+ public static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) {
+ StringBuilder prefix = new StringBuilder(SUBSYSTEM_NAME);
+ for (String kp : keyPrefix) {
+ prefix.append('.').append(kp);
+ }
+ return new StandardResourceDescriptionResolver(prefix.toString(), RESOURCE_NAME, KeycloakSamlExtension.class.getClassLoader(), true, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void initializeParsers(final ExtensionParsingContext context) {
+ context.setSubsystemXmlMapping(SUBSYSTEM_NAME, KeycloakSamlExtension.NAMESPACE, PARSER);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void initialize(final ExtensionContext context) {
+ final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, MGMT_API_VERSION);
+
+ ManagementResourceRegistration registration = subsystem.registerSubsystemModel(KEYCLOAK_SUBSYSTEM_RESOURCE);
+
+ subsystem.registerXMLElementWriter(PARSER);
+ }
+}
diff --git a/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemAdd.java b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemAdd.java
new file mode 100755
index 0000000000..139432408d
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemAdd.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ *
+ * 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.
+ */
+package org.keycloak.subsystem.adapter.saml.extension;
+
+
+import org.jboss.as.controller.AbstractBoottimeAddStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.server.AbstractDeploymentChainStep;
+import org.jboss.as.server.DeploymentProcessorTarget;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+import org.jboss.as.server.deployment.Phase;
+import org.jboss.dmr.ModelNode;
+
+/**
+ * The Keycloak subsystem add update handler.
+ *
+ * @author Stan Silvert ssilvert@redhat.com (C) 2013 Red Hat Inc.
+ */
+class KeycloakSubsystemAdd extends AbstractBoottimeAddStepHandler {
+
+ static final KeycloakSubsystemAdd INSTANCE = new KeycloakSubsystemAdd();
+
+ @Override
+ protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model) {
+ context.addStep(new AbstractDeploymentChainStep() {
+ @Override
+ protected void execute(DeploymentProcessorTarget processorTarget) {
+ processorTarget.addDeploymentProcessor(KeycloakSamlExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, 0, chooseDependencyProcessor());
+ processorTarget.addDeploymentProcessor(KeycloakSamlExtension.SUBSYSTEM_NAME,
+ Phase.POST_MODULE, // PHASE
+ Phase.POST_MODULE_VALIDATOR_FACTORY - 1, // PRIORITY
+ chooseConfigDeploymentProcessor());
+ }
+ }, OperationContext.Stage.RUNTIME);
+ }
+
+ private DeploymentUnitProcessor chooseDependencyProcessor() {
+ return new KeycloakDependencyProcessorWildFly();
+ }
+
+ private DeploymentUnitProcessor chooseConfigDeploymentProcessor() {
+ return new KeycloakAdapterConfigDeploymentProcessor();
+ }
+}
diff --git a/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemDefinition.java b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemDefinition.java
new file mode 100755
index 0000000000..db02d60a8a
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemDefinition.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ *
+ * 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.
+ */
+
+package org.keycloak.subsystem.adapter.saml.extension;
+
+import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
+import org.jboss.as.controller.SimpleResourceDefinition;
+import org.jboss.as.controller.operations.common.GenericSubsystemDescribeHandler;
+import org.jboss.as.controller.registry.ManagementResourceRegistration;
+
+/**
+ * Definition of subsystem=keycloak.
+ *
+ * @author Stan Silvert ssilvert@redhat.com (C) 2013 Red Hat Inc.
+ */
+public class KeycloakSubsystemDefinition extends SimpleResourceDefinition {
+ protected KeycloakSubsystemDefinition() {
+ super(KeycloakSamlExtension.SUBSYSTEM_PATH,
+ KeycloakSamlExtension.getResourceDescriptionResolver("subsystem"),
+ KeycloakSubsystemAdd.INSTANCE,
+ ReloadRequiredRemoveStepHandler.INSTANCE
+ );
+ }
+
+ @Override
+ public void registerOperations(ManagementResourceRegistration resourceRegistration) {
+ super.registerOperations(resourceRegistration);
+ resourceRegistration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
+ }
+
+}
diff --git a/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java
new file mode 100755
index 0000000000..46d089eb4b
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ *
+ * 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.
+ */
+package org.keycloak.subsystem.adapter.saml.extension;
+
+import org.jboss.as.controller.AttributeDefinition;
+import org.jboss.as.controller.PathAddress;
+import org.jboss.as.controller.PathElement;
+import org.jboss.as.controller.SimpleAttributeDefinition;
+import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
+import org.jboss.as.controller.operations.common.Util;
+import org.jboss.as.controller.parsing.ParseUtils;
+import org.jboss.as.controller.persistence.SubsystemMarshallingContext;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.Property;
+import org.jboss.staxmapper.XMLElementReader;
+import org.jboss.staxmapper.XMLElementWriter;
+import org.jboss.staxmapper.XMLExtendedStreamReader;
+import org.jboss.staxmapper.XMLExtendedStreamWriter;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The subsystem parser, which uses stax to read and write to and from xml
+ */
+class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader>, XMLElementWriter {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void readElement(final XMLExtendedStreamReader reader, final List list) throws XMLStreamException {
+ // Require no attributes
+ ParseUtils.requireNoAttributes(reader);
+ ModelNode addKeycloakSub = Util.createAddOperation(PathAddress.pathAddress(KeycloakSamlExtension.PATH_SUBSYSTEM));
+ list.add(addKeycloakSub);
+
+ while (reader.hasNext() && nextTag(reader) != END_ELEMENT) {
+ }
+ }
+
+ // used for debugging
+ private int nextTag(XMLExtendedStreamReader reader) throws XMLStreamException {
+ return reader.nextTag();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException {
+ context.startSubsystemElement(KeycloakSamlExtension.NAMESPACE, false);
+ writer.writeEndElement();
+ }
+
+
+
+ // code taken from org.jboss.as.controller.AttributeMarshaller
+ private void writeCharacters(XMLExtendedStreamWriter writer, String content) throws XMLStreamException {
+ if (content.indexOf('\n') > -1) {
+ // Multiline content. Use the overloaded variant that staxmapper will format
+ writer.writeCharacters(content);
+ } else {
+ // Staxmapper will just output the chars without adding newlines if this is used
+ char[] chars = content.toCharArray();
+ writer.writeCharacters(chars, 0, chars.length);
+ }
+ }
+
+}
diff --git a/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/resources/META-INF/services/org.jboss.as.controller.Extension b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/resources/META-INF/services/org.jboss.as.controller.Extension
new file mode 100755
index 0000000000..25b4bb824a
--- /dev/null
+++ b/saml/client-adapter/wildfly/wildfly9-subsystem/src/main/resources/META-INF/services/org.jboss.as.controller.Extension
@@ -0,0 +1 @@
+org.keycloak.subsystem.adapter.saml.extension.KeycloakSamlExtension
diff --git a/testsuite/integration/pom.xml b/testsuite/integration/pom.xml
index 599d0b2e4e..979d65e94f 100755
--- a/testsuite/integration/pom.xml
+++ b/testsuite/integration/pom.xml
@@ -107,7 +107,7 @@
org.keycloak
- keycloak-undertow-saml-adapter
+ keycloak-saml-undertow-adapter
org.keycloak
diff --git a/testsuite/jetty/jetty81/pom.xml b/testsuite/jetty/jetty81/pom.xml
index d079952132..9003acf235 100755
--- a/testsuite/jetty/jetty81/pom.xml
+++ b/testsuite/jetty/jetty81/pom.xml
@@ -108,7 +108,7 @@
org.keycloak
- keycloak-jetty81-saml-adapter
+ keycloak-saml-jetty81-adapter
org.keycloak
diff --git a/testsuite/jetty/jetty91/pom.xml b/testsuite/jetty/jetty91/pom.xml
index f42e3aa8e3..3e63242de9 100755
--- a/testsuite/jetty/jetty91/pom.xml
+++ b/testsuite/jetty/jetty91/pom.xml
@@ -112,7 +112,7 @@
org.keycloak
- keycloak-jetty91-saml-adapter
+ keycloak-saml-jetty91-adapter
org.jboss.logging
diff --git a/testsuite/jetty/jetty92/pom.xml b/testsuite/jetty/jetty92/pom.xml
index 8b26df168c..1ec94ac08e 100755
--- a/testsuite/jetty/jetty92/pom.xml
+++ b/testsuite/jetty/jetty92/pom.xml
@@ -28,7 +28,7 @@
org.keycloak
- keycloak-jetty92-saml-adapter
+ keycloak-saml-jetty92-adapter
log4j
diff --git a/testsuite/tomcat6/pom.xml b/testsuite/tomcat6/pom.xml
index 7d05f4d196..a1044916ec 100755
--- a/testsuite/tomcat6/pom.xml
+++ b/testsuite/tomcat6/pom.xml
@@ -106,7 +106,7 @@
org.keycloak
- keycloak-tomcat6-saml-adapter
+ keycloak-saml-tomcat6-adapter
org.apache.tomcat
diff --git a/testsuite/tomcat7/pom.xml b/testsuite/tomcat7/pom.xml
index 9be7c245dc..6552d40b80 100755
--- a/testsuite/tomcat7/pom.xml
+++ b/testsuite/tomcat7/pom.xml
@@ -74,7 +74,7 @@
org.keycloak
- keycloak-tomcat7-saml-adapter
+ keycloak-saml-tomcat7-adapter
org.apache.tomcat
diff --git a/testsuite/tomcat8/pom.xml b/testsuite/tomcat8/pom.xml
index 18b70bf230..ad94378aa3 100755
--- a/testsuite/tomcat8/pom.xml
+++ b/testsuite/tomcat8/pom.xml
@@ -58,7 +58,7 @@
org.keycloak
- keycloak-tomcat8-saml-adapter
+ keycloak-saml-tomcat8-adapter
org.apache.tomcat