[jboss-svn-commits] JBL Code SVN: r29585 - in labs/jbossesb/trunk: product and 37 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Oct 13 00:38:59 EDT 2009
Author: beve
Date: 2009-10-13 00:38:56 -0400 (Tue, 13 Oct 2009)
New Revision: 29585
Added:
labs/jbossesb/trunk/product/lib/ext/jaxb-impl.jar
labs/jbossesb/trunk/product/lib/ext/mockito-all-1.8.0.jar
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/security/
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/security/JBossSTSAction.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSCallbackHandler.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSConstants.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModule.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/SamlContext.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/SamlCredential.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SOAPSecurityHeaderVisitor.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractor.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlVisitor.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector-template.xml
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector.xml
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-template.xml
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/JBossSTSActionUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/jboss-sts-client.properties
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModuleUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/SamlCredentialUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/assertion-expected.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/assertion.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/jboss-sts-client.properties
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractorUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlVisitorUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject-expected.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject-no-security-header.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/soap-saml-example.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/deployment.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbmq-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-sts-client.properties
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-sts.war
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-wsse-client.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/login-config.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector-template.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/soap-request.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/SendJMSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/GoodbyeWorldWS.java
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/handlerchain.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/WEB-INF/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/WEB-INF/web.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/view/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/view/index.jsp
labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandler.java
labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandlerUtil.java
labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandlerUnitTest.java
labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/assertion.xml
labs/jbossesb/trunk/testlib/mockito-all-1.8.0.jar
Removed:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/security/JBossSTSAction.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/JBossSTSActionUnitTest.java
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/deployment.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbmq-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-sts.war
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-wsse-client.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/login-config.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector-template.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/soap-request.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/SendJMSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/GoodbyeWorldWS.java
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/handlerchain.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/WEB-INF/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/WEB-INF/web.xml
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/view/
labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/view/index.jsp
Modified:
labs/jbossesb/trunk/
labs/jbossesb/trunk/product/.classpath
labs/jbossesb/trunk/product/etc/test/resources/log4j/dev/log4j.xml
labs/jbossesb/trunk/product/install/build.xml
labs/jbossesb/trunk/product/ivy.xml
labs/jbossesb/trunk/product/rosetta/build.xml
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/security/JBossASContextPropagator.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/PasswordUtil.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/AuthenticationRequestImpl.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-ws-security.xml
labs/jbossesb/trunk/product/rosetta/tests/build.xml
labs/jbossesb/trunk/product/services/base-project-build.xml
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2263 "SAML Token support"
Property changes on: labs/jbossesb/trunk
___________________________________________________________________
Name: svnmerge-integrated
- /labs/jbossesb/workspace/dbevenius/saml_support:1-29132
+ /labs/jbossesb/workspace/dbevenius/saml_support:1-29579
Modified: labs/jbossesb/trunk/product/.classpath
===================================================================
--- labs/jbossesb/trunk/product/.classpath 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/.classpath 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="lib" path="lib/ext/jbossws-core.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jboss-jaxws.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jboss-saaj.jar"/>
<classpathentry excluding="**/.svn/" kind="src" path="rosetta/src"/>
<classpathentry excluding="**/.svn/" kind="src" path="rosetta/tests/src"/>
<classpathentry excluding="**/.svn/" kind="src" path="rosetta/tests/resources"/>
@@ -23,9 +26,6 @@
<classpathentry excluding="**/.svn/" kind="src" path="services/jbossesb/src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="etc/test/resources/log4j/dev"/>
- <classpathentry kind="lib" path="build/jbossesb/lib/jbossesb-config-model-1.2.0.jar"/>
- <classpathentry kind="lib" path="build/jbossesb/lib/jbossesb-config-model-1.1.0.jar"/>
- <classpathentry kind="lib" path="build/jbossesb/lib/jbossesb-config-model-1.0.1.jar"/>
<classpathentry kind="lib" path="build/lib/activation-1.1.jar"/>
<classpathentry kind="lib" path="build/lib/antlr-2.7.7.jar"/>
<classpathentry kind="lib" path="build/lib/bsf-2.3.0.jar"/>
@@ -39,7 +39,6 @@
<classpathentry kind="lib" path="build/lib/commons-lang-2.1.jar"/>
<classpathentry kind="lib" path="build/lib/commons-logging-1.1.jar"/>
<classpathentry kind="lib" path="build/lib/dom4j-1.6.1.jar"/>
- <classpathentry kind="lib" path="build/lib/freemarker-2.3.11.jar"/>
<classpathentry kind="lib" path="build/lib/groovy-all-1.5.4.jar"/>
<classpathentry kind="lib" path="build/lib/h2-1.0.68.jar"/>
<classpathentry kind="lib" path="build/lib/hibernate3-3.2.4.SP1.jar"/>
@@ -79,10 +78,6 @@
<classpathentry kind="lib" path="build/lib/juddi-2.0rc5.jar"/>
<classpathentry kind="lib" path="build/lib/log4j-1.2.14.jar"/>
<classpathentry kind="lib" path="build/lib/mail-1.4.jar"/>
- <classpathentry kind="lib" path="build/lib/milyn-commons-1.2.3.jar"/>
- <classpathentry kind="lib" path="build/lib/milyn-smooks-core-1.2.3.jar"/>
- <classpathentry kind="lib" path="build/lib/milyn-smooks-javabean-1.2.3.jar"/>
- <classpathentry kind="lib" path="build/lib/milyn-smooks-routing-1.2.3.jar"/>
<classpathentry kind="lib" path="build/lib/mina-core-1.1.7.jar"/>
<classpathentry kind="lib" path="build/lib/mvel2-2.0.12.jar"/>
<classpathentry kind="lib" path="build/lib/ognl-2.6.9.jar"/>
@@ -96,20 +91,16 @@
<classpathentry kind="lib" path="build/lib/xbean-2.2.0.jar"/>
<classpathentry kind="lib" path="build/lib/xercesImpl-2.8.0.jar"/>
<classpathentry kind="lib" path="build/lib/xmlpublic-2.2.0.jar"/>
- <classpathentry kind="lib" path="build/lib/xstream-1.2.2.jar"/>
<classpathentry kind="lib" path="build/lib/jbosssx-4.2.3.GA.jar"/>
<classpathentry kind="lib" path="ftp/lib/ftplet-api-1.0-incubator-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="ftp/lib/ftpserver-core-1.0-incubator-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/ext/commons-net-2.0.0-652071.jar"/>
<classpathentry kind="lib" path="lib/ext/commons-ssl-0.3.4.jar"/>
<classpathentry kind="lib" path="lib/ext/jboss-ejb3x.jar"/>
- <classpathentry kind="lib" path="lib/ext/jboss-jaxws.jar"/>
<classpathentry kind="lib" path="lib/ext/jboss-messaging-client.jar"/>
- <classpathentry kind="lib" path="lib/ext/jboss-saaj.jar"/>
<classpathentry kind="lib" path="lib/ext/jbossts-common.jar"/>
<classpathentry kind="lib" path="lib/ext/jbossweb.jar"/>
<classpathentry kind="lib" path="lib/ext/jbossweb-service.jar"/>
- <classpathentry kind="lib" path="lib/ext/jbossws-core.jar"/>
<classpathentry kind="lib" path="lib/ext/jbossws-spi.jar"/>
<classpathentry kind="lib" path="lib/ext/jms/activemq/backport-util-concurrent-2.1.jar"/>
<classpathentry kind="lib" path="lib/ext/servlet-api.jar"/>
@@ -132,5 +123,41 @@
<classpathentry kind="lib" path="tools/console/lib/hsqldb.jar"/>
<classpathentry kind="var" path="ESB_ROOT/testlib/junit-4.1.jar"/>
<classpathentry kind="var" path="ESB_ROOT/testlib/mockejb.jar"/>
+ <classpathentry kind="var" path="ESB_ROOT/testlib/mockito-all-1.8.0.jar"/>
+ <classpathentry kind="lib" path="build/lib/freemarker-2.3.11.jar"/>
+ <classpathentry kind="lib" path="build/lib/xstream-1.2.2.jar"/>
+ <classpathentry kind="lib" path="build/lib/jboss-identity-bindings-1.0.0.beta3.pre.jar"/>
+ <classpathentry kind="lib" path="build/lib/jboss-identity-bindings-jboss-1.0.0.beta3.pre.jar"/>
+ <classpathentry kind="lib" path="build/lib/jboss-identity-fed-api-1.0.0.beta3.pre.jar"/>
+ <classpathentry kind="lib" path="build/lib/jboss-identity-fed-core-1.0.0.beta3.pre.jar"/>
+ <classpathentry kind="lib" path="build/lib/jboss-identity-fed-model-1.0.0.beta3.pre.jar"/>
+ <classpathentry kind="lib" path="build/lib/jboss-identity-web-1.0.0.beta3.pre.jar"/>
+ <classpathentry kind="lib" path="build/lib/jboss-identity-xmlsec-model-1.0.0.beta3.pre.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-commons-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-edisax-parser-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-magger-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-scribe-hibernate-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-scribe-ibatis-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-scribe-jpa-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-calc-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-core-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-css-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-csv-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-edi-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-ejc-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-javabean-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-json-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-misc-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-persistence-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-routing-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-rules-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-scripting-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-servlet-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-templating-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-smooks-validation-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/lib/milyn-tinak-1.2.3.jar"/>
+ <classpathentry kind="lib" path="build/jbossesb/lib/jbossesb-config-model-1.0.1.jar"/>
+ <classpathentry kind="lib" path="build/jbossesb/lib/jbossesb-config-model-1.1.0.jar"/>
+ <classpathentry kind="lib" path="build/jbossesb/lib/jbossesb-config-model-1.2.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: labs/jbossesb/trunk/product/etc/test/resources/log4j/dev/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/etc/test/resources/log4j/dev/log4j.xml 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/etc/test/resources/log4j/dev/log4j.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -105,7 +105,7 @@
</category>
<category name="org.milyn">
- <priority value="INFO"/>
+ <priority value="info"/>
</category>
<category name="org.milyn.delivery.SmooksXML">
<priority value="DEBUG"/>
Modified: labs/jbossesb/trunk/product/install/build.xml
===================================================================
--- labs/jbossesb/trunk/product/install/build.xml 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/install/build.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -167,6 +167,17 @@
<!-- install h2 jar -->
<copy file="${org.jboss.esb.dist.lib}/h2-1.0.68.jar" todir="${server.lib.dir}"/>
+
+ <!-- copy JBoss Identity jars -->
+ <copy todir="${server.lib.dir}" overwrite="true">
+ <fileset dir="${org.jboss.esb.dist.lib}">
+ <include name="jboss-identity-*.jar"/>
+ <include name="xmlsec-*.jar"/>
+ </fileset>
+ </copy>
+
+ <copy file="${org.jboss.esb.dist.lib}/jbossws-native-core-3.0.5.GA.jar" tofile="${deploy.dir}/jbossws.sar/jbossws-core.jar"/>
+ <copy file="${org.jboss.esb.dist.lib}/jbossws-common-1.0.8.GA.jar" tofile="${server.lib.dir}/jbossws-common.jar"/>
<!-- embedded jopr console -->
<ant dir="embedded-console" target="copy-console">
@@ -229,7 +240,6 @@
<include name="commons-codec-*.jar"/>
<include name="jackson-core*jar"/>
</fileset>
- <fileset dir="${org.jboss.esb.dist.lib}" includes="commons-httpclient*.jar"/>
</copy>
<copy todir="${deployers.dir}/esb.deployer/META-INF" overwrite="true">
@@ -249,6 +259,15 @@
</fileset>
</copy>
+ <copy todir="${org.jboss.esb.server.home}/common/lib" overwrite="true">
+ <fileset dir="${product.dir}/build/lib">
+ <include name="jboss-identity-*.jar"/>
+ <include name="xmlsec-*.jar"/>
+ <include name="commons-httpclient-*.jar"/>
+ </fileset>
+ </copy>
+ <property name="org.jboss.esb.server.home" value="${org.jboss.esb.server.home}"/>
+
<!-- jbossesb.sar -->
<copy todir="${deploy.dir}/jbossesb.sar" includeemptydirs="false" overwrite="true">
<fileset dir="${org.jboss.esb.dist.lib}/jbossesb.sar">
@@ -333,7 +352,7 @@
<copy file="${org.jboss.esb.dist}/tools/console/console/jboss-esb-console.ear/contract.war" todir="${deploy.dir}" />
<!-- install h2 jar -->
- <copy file="${org.jboss.esb.dist.lib}/h2-1.0.68.jar" todir="${server.lib.dir}"/>
+ <copy file="${org.jboss.esb.dist.lib}/h2-1.0.68.jar" todir="${org.jboss.esb.server.home}/common/lib" overwrite="true"/>
<copy file="${org.jboss.esb.dist.lib}/scout-1.0.jar" tofile="${client.dir}/scout.jar" overwrite="true"/>
@@ -365,11 +384,25 @@
<delete file="${deploy.dir}/jbas4-admin-console.war" quiet="true"/>
<delete file="${deploy.dir}/jbas5-admin-console.war" quiet="true" />
<delete dir="${conf.dir}/action-templates.xml" quiet="true"/>
+ <delete quiet="false">
+ <fileset dir="${server.lib.dir}" >
+ <include name="jboss-identity-*.jar"/>
+ <include name="xmlsec-*.jar"/>
+ </fileset>
+ </delete>
<antcall target="undeploy.jbossas5"/>
</target>
<target name="undeploy.jbossas5" if="jbossas5" >
<delete dir="${server.dir}/deployers/esb.deployer" quiet="true"/>
+
+ <delete quiet="false">
+ <fileset dir="${org.jboss.esb.server.home}/common/lib" >
+ <include name="jboss-identity-*.jar"/>
+ <include name="xmlsec-*.jar"/>
+ </fileset>
+ </delete>
+
</target>
<property name="org.jboss.esb.tomcat.55lib"
Modified: labs/jbossesb/trunk/product/ivy.xml
===================================================================
--- labs/jbossesb/trunk/product/ivy.xml 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/ivy.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -158,5 +158,19 @@
<dependency org="org.jboss.security" name="jboss-security-spi" rev="2.1.0.20090318"/>
<dependency org="jboss" name="jbosssx" rev="4.2.3.GA"/>
+ <!-- JBoss Identity Federation -->
+ <dependency org="org.jboss.identity" name="jboss-identity-fed-api" rev="1.0.0.beta3.pre"/>
+ <dependency org="org.jboss.identity" name="jboss-identity-fed-core" rev="1.0.0.beta3.pre"/>
+ <dependency org="org.jboss.identity" name="jboss-identity-fed-model" rev="1.0.0.beta3.pre"/>
+ <dependency org="org.jboss.identity" name="jboss-identity-xmlsec-model" rev="1.0.0.beta3.pre"/>
+ <dependency org="org.jboss.identity" name="jboss-identity-bindings" rev="1.0.0.beta3.pre"/>
+ <dependency org="org.jboss.identity" name="jboss-identity-bindings-jboss" rev="1.0.0.beta3.pre"/>
+ <dependency org="org.jboss.identity" name="jboss-identity-web" rev="1.0.0.beta3.pre"/>
+ <dependency org="org.apache" name="xmlsec" rev="1.4.3"/>
+
+ <!-- Needed for WSTrustClient with JBoss AS 4.x :https://jira.jboss.org/jira/browse/JBWS-2346 -->
+ <dependency org="org.jboss.ws.native" name="jbossws-native-core" rev="3.0.5.GA"/>
+ <dependency org="org.jboss.ws" name="jbossws-common" rev="1.0.8.GA"/>
+
</dependencies>
</ivy-module>
Copied: labs/jbossesb/trunk/product/lib/ext/jaxb-impl.jar (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/lib/ext/jaxb-impl.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/lib/ext/mockito-all-1.8.0.jar (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/lib/ext/mockito-all-1.8.0.jar)
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/rosetta/build.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/build.xml 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/rosetta/build.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -24,6 +24,7 @@
<path id="org.jboss.esb.rosetta.base.classpath">
<fileset dir="${org.jboss.esb.ext.lib.dir}" includes="*.jar"/>
+ <fileset dir="${org.jboss.esb.ext.lib.dir}/endorsed" includes="jboss-saaj.jar"/>
<fileset dir="${org.jboss.esb.lib.dir}" includes="*.jar"/>
<fileset dir="../../testlib" includes="emma*.jar"/>
<fileset dir="${org.jboss.esb.ext.lib.dir}/standalone" includes="*.jar"/>
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/security/JBossASContextPropagator.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/security/JBossASContextPropagator.java 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/security/JBossASContextPropagator.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -21,6 +21,7 @@
package org.jboss.internal.soa.esb.services.security;
import java.security.Principal;
+import java.util.Iterator;
import java.util.Set;
import javax.security.auth.Subject;
@@ -54,7 +55,7 @@
// associate the subject with jboss security
Object credential = null;
- if (authCredentials != null)
+ if (authCredentials != null && authCredentials.isEmpty() == false)
{
credential = authCredentials.iterator().next();
}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/security (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/actions/security)
Deleted: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/security/JBossSTSAction.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/actions/security/JBossSTSAction.java 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/security/JBossSTSAction.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,152 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
- * LLC, and individual contributors by the @authors tag. See the copyright.txt
- * in the distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
- * site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.actions.security;
-
-import java.io.Serializable;
-import java.io.StringWriter;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.log4j.Logger;
-import org.jboss.identity.federation.api.wstrust.WSTrustClient;
-import org.jboss.identity.federation.api.wstrust.WSTrustClient.SecurityInfo;
-import org.jboss.identity.federation.core.exceptions.ParsingException;
-import org.jboss.identity.federation.core.wstrust.WSTrustException;
-import org.jboss.internal.soa.esb.assertion.AssertArgument;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.message.MessageDeliverException;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.MessagePayloadProxy;
-import org.jboss.soa.esb.services.security.PublicCryptoUtil;
-import org.jboss.soa.esb.services.security.SecurityService;
-import org.jboss.soa.esb.services.security.SecurityServiceException;
-import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
-import org.jboss.soa.esb.services.security.auth.AuthenticationRequestImpl;
-import org.jboss.soa.esb.services.security.auth.login.JBossSTSConstants;
-import org.jboss.soa.esb.services.security.auth.login.SamlContext;
-import org.jboss.soa.esb.services.security.auth.login.SamlPrincipal;
-import org.w3c.dom.Element;
-
-
-/**
- * This action support issueing SAML Assertions using JBossSTS (Security Token Service).
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class JBossSTSAction extends AbstractActionPipelineProcessor
-{
- public static final String ADD_TO_ESB_AUTH_REQUEST = "addToEsbAuthRequest";
- public static final String ADD_TO_ESB_MESSAGE = "addToEsbMessage";
-
- private final Logger log = Logger.getLogger(JBossSTSAction.class);
-
- private final String serviceName;
- private final String portName;
- private final String endpointAddress;
- private final String username;
- private final String password;
- private final String tokenType;
- private final MessagePayloadProxy payloadProxy;
-
- private boolean addAssertionToEsbAuthRequest;
-
- public JBossSTSAction(final ConfigTree config) throws ConfigurationException
- {
- serviceName = config.getRequiredAttribute(JBossSTSConstants.SERVICE_NAME_OPTION);
- portName = config.getRequiredAttribute(JBossSTSConstants.PORT_NAME_OPTION);
- endpointAddress = config.getRequiredAttribute(JBossSTSConstants.ENDPOINT_ADDRESS_OPTION);
- username = config.getRequiredAttribute(JBossSTSConstants.USERNAME_OPTION);
- password = config.getRequiredAttribute(JBossSTSConstants.PASSWORD_OPTION);
- tokenType = config.getRequiredAttribute(JBossSTSConstants.TOKEN_TYPE_OPTION);
- payloadProxy = new MessagePayloadProxy(config);
- addAssertionToEsbAuthRequest = config.getBooleanAttribute(ADD_TO_ESB_AUTH_REQUEST, false);
- }
-
- public Message process(final Message message) throws ActionProcessingException
- {
- AssertArgument.isNotNull(message, "message");
- try
- {
- final WSTrustClient wsTrustClient = createWSTrustClient(message);
- final Element assertion = wsTrustClient.issueToken(tokenType);
-
- log.info("SecurityToken valid : " + wsTrustClient.validateToken(assertion));
-
- SamlContext.setContext(new SamlPrincipal(assertion));
-
- if (addAssertionToEsbAuthRequest)
- {
- addToEsbAuthRequest(assertion, message);
- }
-
- }
- catch (final WSTrustException e)
- {
- throw new ActionProcessingException("Caught WSTrustException while calling issueToken: ", e);
- }
- return message;
- }
-
- private void addToEsbAuthRequest(final Element assertion, final Message message) throws ActionProcessingException
- {
- // create an AuthenticationRequest
-
- final SamlPrincipal samlPrincipal = new SamlPrincipal(assertion);
- final AuthenticationRequest authRequest = new AuthenticationRequestImpl.Builder(samlPrincipal).build();
- try
- {
- // set the authentication request on the message
- log.info("Adding SamlPrincipal to ESB Context as an AuthenticationRequest");
- message.getContext().setContext(SecurityService.AUTH_REQUEST, PublicCryptoUtil.INSTANCE.encrypt((Serializable) authRequest));
- }
- catch (final SecurityServiceException e)
- {
- throw new ActionProcessingException(e.getMessage(), e);
- }
- }
-
- WSTrustClient createWSTrustClient(final Message message) throws ActionProcessingException
- {
- try
- {
- return new WSTrustClient(serviceName, portName, endpointAddress, new SecurityInfo(username, password));
- }
- catch (final ParsingException e)
- {
- throw new ActionProcessingException(e.getMessage(), e);
- }
- }
-
-
-
-}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/security/JBossSTSAction.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/actions/security/JBossSTSAction.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/security/JBossSTSAction.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/security/JBossSTSAction.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,207 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions.security;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.jboss.identity.federation.core.wstrust.STSClient;
+import org.jboss.identity.federation.core.wstrust.STSClientConfig;
+import org.jboss.identity.federation.core.wstrust.STSClientFactory;
+import org.jboss.identity.federation.core.exceptions.ParsingException;
+import org.jboss.identity.federation.core.wstrust.WSTrustException;
+import org.jboss.identity.federation.core.wstrust.STSClientConfig.Builder;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionLifecycleException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.security.PasswordUtil;
+import org.jboss.soa.esb.services.security.PublicCryptoUtil;
+import org.jboss.soa.esb.services.security.SecurityService;
+import org.jboss.soa.esb.services.security.SecurityServiceException;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequestImpl;
+import org.jboss.soa.esb.services.security.auth.login.SamlContext;
+import org.jboss.soa.esb.services.security.auth.login.SamlCredential;
+import org.w3c.dom.Element;
+
+/**
+ * This action support issueing SAML Assertions using JBossSTS (Security Token Service).
+ * <p/>
+ *
+ * This action simulates the actions that a web service client would take to request that a STS issue a security
+ * token that can be used to access a web service.
+ * When making the request to STS, the client can use WS-Security or transport-layer mechanisms to identify itself. In
+ * the current implementation we are using WS-Security to authenicate using UsernameToken. This is a simple username/passwd
+ * which is configured in the jboss-sts-client.properites file.
+ *
+ * Usage:
+ * <pre>{@code
+ * <action name="issueToken" class="org.jboss.soa.esb.actions.security.JBossSTSAction">
+ * <property name="configFile" value="jboss-sts-client.properties"/>
+ * <property name="tokenType" value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"/>
+ * <property name="addToEsbAuthRequest" value="true"/>
+ * </action>
+ * }</pre>
+ *
+ * Options:
+ * <lu>
+ * <li>configFile - The configuration for the WSTrustClient from JBoss Identity that we are using.</li>
+ * <li>tokenType - The the type of token that we would like to have issued from JBoss STS.</li>
+ * <li>addToEsbAuthRequest - Tells the ESB make this assertion available to the ESB authentication mechanism.</li>
+ * </lu>
+ *
+ * <h3>WSTrustClient configuration file example</h3>
+ * <pre>
+ * serviceName=JBossSTS
+ * portName=JBossSTSPort
+ * endpointAddress=http://localhost:8080/jboss-sts/JBossSTS
+ * username=admin
+ * password=admin
+ * </pre>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class JBossSTSAction extends AbstractActionPipelineProcessor
+{
+ public static final String ADD_TO_ESB_AUTH_REQUEST = "addToEsbAuthRequest";
+ public static final String STS_CONFIG = "configFile";
+ public static final String TOKEN_TYPE_OPTION = "tokenType";
+ public static final String ENDPOINT_URI_OPTION = "endpointURI";
+
+ private final Logger log = Logger.getLogger(JBossSTSAction.class);
+
+ private STSClientConfig wsTrustConfig;
+ private final String tokenType;
+ private String endpointURI;
+ private boolean addAssertionToEsbAuthRequest;
+ private STSClient wsTrustClient;
+
+ public JBossSTSAction(final ConfigTree config) throws ConfigurationException
+ {
+ wsTrustConfig = new STSClientConfig.Builder().build(config.getRequiredAttribute(STS_CONFIG));
+ // this call will not be required with the next version of jboss-identity
+ // as it will be able to first parse and populate the builder so that
+ // properties, like password, can be overridden.
+ // http://jira.jboss.org/jira/browse/JBID-202
+ wsTrustConfig = checkTypeOfPassword(wsTrustConfig);
+
+ addAssertionToEsbAuthRequest = config.getBooleanAttribute(ADD_TO_ESB_AUTH_REQUEST, false);
+ tokenType = config.getAttribute(TOKEN_TYPE_OPTION);
+ endpointURI = config.getAttribute(ENDPOINT_URI_OPTION);
+ if (tokenType == null && endpointURI == null)
+ {
+ throw new ConfigurationException("One of " + TOKEN_TYPE_OPTION + " or " + ENDPOINT_URI_OPTION + " must be set.");
+ }
+ }
+
+ @Override
+ public void initialise() throws ActionLifecycleException
+ {
+ wsTrustClient = createWSTrustClient();
+ }
+
+ public Message process(final Message message) throws ActionProcessingException
+ {
+ AssertArgument.isNotNull(message, "message");
+ try
+ {
+ Element assertion = wsTrustClient.issueToken(endpointURI, tokenType);
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("SecurityToken valid : " + wsTrustClient.validateToken(assertion));
+ }
+
+ SamlContext.setContext(new SamlCredential(assertion));
+
+ if (addAssertionToEsbAuthRequest)
+ {
+ addToEsbAuthRequest(assertion, message);
+ }
+ }
+ catch (final WSTrustException e)
+ {
+ throw new ActionProcessingException("Caught WSTrustException while calling issueToken: ", e);
+ }
+ return message;
+ }
+
+ private STSClientConfig checkTypeOfPassword(final STSClientConfig config) throws ConfigurationException
+ {
+ final String password = config.getPassword();
+
+ if (PasswordUtil.isPasswordFile(password))
+ {
+ final Builder builder = new STSClientConfig.Builder();
+ builder.serviceName(config.getServiceName());
+ builder.endpointAddress(config.getEndPointAddress());
+ builder.portName(config.getPortName());
+ builder.username(config.getUsername());
+ try
+ {
+ // Set the password using password file.
+ builder.password(new PasswordUtil(password).getPasswordAsString());
+ }
+ catch (final IOException e)
+ {
+ throw new ConfigurationException("Could not read password from file :" + config.getPassword(), e);
+ }
+ return builder.build();
+ }
+ return config;
+ }
+
+ private void addToEsbAuthRequest(final Element assertion, final Message message) throws ActionProcessingException
+ {
+ final SamlCredential samlCredential = new SamlCredential(assertion);
+ Set credentials = Collections.singleton(samlCredential);
+ final AuthenticationRequest authRequest = new AuthenticationRequestImpl.Builder(null, credentials).build();
+ try
+ {
+ log.debug("Adding SamlCredential to ESB Context as an AuthenticationRequest");
+ message.getContext().setContext(SecurityService.AUTH_REQUEST, PublicCryptoUtil.INSTANCE.encrypt((Serializable) authRequest));
+ }
+ catch (final SecurityServiceException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+ }
+
+ STSClient createWSTrustClient() throws ActionLifecycleException
+ {
+ try
+ {
+ return STSClientFactory.getInstance().create(wsTrustConfig);
+ }
+ catch (final ParsingException e)
+ {
+ throw new ActionLifecycleException(e.getMessage(), e);
+ }
+ }
+
+}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/PasswordUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/PasswordUtil.java 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/PasswordUtil.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -20,13 +20,13 @@
*/
package org.jboss.soa.esb.services.security;
+import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
import org.jboss.internal.soa.esb.assertion.AssertArgument;
-import org.jboss.internal.soa.esb.util.StreamUtils;
import org.jboss.security.plugins.FilePassword;
-import org.jboss.soa.esb.ConfigurationException;
/**
* Util class that can read a password from a specified file.
@@ -72,32 +72,21 @@
public static boolean isPasswordFile(final String passwordFile)
{
if (passwordFile == null || "".equals(passwordFile))
- {
return false;
- }
- InputStream resource = null;
- try
- {
- resource = StreamUtils.getResource(passwordFile);
- return resource != null;
- }
- catch (final ConfigurationException e)
- {
- return false;
- }
- finally
- {
- try
- {
- if (resource != null)
- {
- resource.close();
- }
- }
- catch (final IOException ignored)
- {
- }
- }
+
+ try
+ {
+ final URL url = new URL(passwordFile);
+ if (url != null)
+ return true;
+ }
+ catch (final MalformedURLException ignored)
+ {
+ final File pwFile = new File(passwordFile);
+ if (pwFile.exists() && !pwFile.isDirectory())
+ return true;
+ }
+ return false;
}
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/AuthenticationRequestImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/AuthenticationRequestImpl.java 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/AuthenticationRequestImpl.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -88,10 +88,15 @@
private Map<String,Object> properties = new HashMap<String,Object>();
public Builder() {}
+
+ public Builder(final Principal principal)
+ {
+ this.principal = principal;
+ }
public Builder(final Principal principal, final Set<Object> credentials)
{
- this.principal = principal;
+ this(principal);
if ( credentials != null )
{
this.credentials.addAll(credentials);
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSCallbackHandler.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSCallbackHandler.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSCallbackHandler.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSCallbackHandler.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.login;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.jboss.internal.soa.esb.services.security.EsbCallbackHandler;
+import org.jboss.security.auth.callback.ObjectCallback;
+import org.jboss.soa.esb.services.security.SecurityConfig;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+
+public class JBossSTSCallbackHandler implements EsbCallbackHandler
+{
+ private AuthenticationRequest authRequest;
+
+ @SuppressWarnings("unused")
+ private SecurityConfig securityConfig;
+
+ public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException
+ {
+ for (Callback callback : callbacks)
+ {
+ if (callback instanceof ObjectCallback)
+ {
+ final ObjectCallback objectCallback = (ObjectCallback) callback;
+ objectCallback.setCredential(authRequest);
+ }
+ }
+ }
+
+ public void setAuthenticationRequest(AuthenticationRequest authRequest)
+ {
+ this.authRequest = authRequest;
+ }
+
+ public void setSecurityConfig(final SecurityConfig config)
+ {
+ securityConfig = config;
+ }
+}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSConstants.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSConstants.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSConstants.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSConstants.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.login;
+
+/**
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class JBossSTSConstants
+{
+ public static final String SERVICE_NAME_OPTION = "serviceName";
+ public static final String PORT_NAME_OPTION = "portName";
+ public static final String ENDPOINT_ADDRESS_OPTION = "endpointAddress";
+ public static final String USERNAME_OPTION = "username";
+ public static final String PASSWORD_OPTION = "password";
+ public static final String TOKEN_TYPE_OPTION = "tokenType";
+
+ private JBossSTSConstants()
+ {
+ }
+}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModule.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModule.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModule.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModule.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,294 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.login;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+
+import org.apache.log4j.Logger;
+import org.jboss.identity.federation.core.wstrust.STSClient;
+import org.jboss.identity.federation.core.wstrust.STSClientConfig;
+import org.jboss.identity.federation.core.wstrust.STSClientFactory;
+import org.jboss.identity.federation.core.exceptions.ParsingException;
+import org.jboss.identity.federation.core.wstrust.WSTrustException;
+import org.jboss.identity.federation.core.wstrust.STSClientConfig.Builder;
+import org.jboss.security.auth.callback.ObjectCallback;
+import org.jboss.soa.esb.services.security.PasswordUtil;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+import org.w3c.dom.Element;
+
+/**
+ * JAAS LoginModule for JBoss SecurityTokenService (STS).
+ *
+ * This LoginModule only performs validation of existing SAML
+ * Assertions and does not issue and such Assertions.
+ *
+ * <h3>Configuration example</h3>
+ * <pre>{@code
+ * <application-policy name="jbossesb-saml">
+ * <authentication>
+ * <login-module code="org.jboss.soa.esb.services.security.auth.login.JBossSTSLoginModule" flag="required">
+ * <module-option name="configFile">/sts-client.properties</module-option>
+ * </login-module>
+ * </authentication>
+ * </application-policy>
+ * }</pre>
+ *
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class JBossSTSLoginModule implements LoginModule
+{
+ private Logger logger = Logger.getLogger(JBossSTSLoginModule.class);
+
+ /**
+ * This is the required option that should identify the configuration
+ * file for WSTrustClient.
+ */
+ public static final String STS_CONFIG_FILE = "configFile";
+
+ /**
+ * The subject to be populated.
+ */
+ private Subject subject;
+
+ /**
+ * Callback handler used to gather information from the caller.
+ */
+ private CallbackHandler callbackHandler;
+
+ /**
+ * Client that takes care of invoking the SecurityTokenService.
+ */
+ private STSClient wsTrustClient;
+
+ /**
+ * WS-Trust SAML Assertion element.
+ */
+ private Element samlToken;
+
+ /**
+ * The outcome of the authentication process.
+ */
+ private boolean success;
+
+ /**
+ * Initialized this login module. Simple stores the passed in fields and
+ * also validates the options.
+ *
+ * @param subject
+ * The subject to authenticate/populate.
+ * @param callbackHandler
+ * The callbackhandler that will gather information required by
+ * this login module.
+ * @param sharedState
+ * State that is shared with other login modules. Used when
+ * modules are chained/stacked.
+ * @param options
+ * The options that were specified for this login module. See
+ * "Usage" section of this types javadoc.
+ */
+ public void initialize(final Subject subject, final CallbackHandler callbackHandler, final Map<String, ?> sharedState, final Map<String, ?> options)
+ {
+ this.subject = subject;
+
+
+ if (callbackHandler == null)
+ {
+ throw new IllegalArgumentException("CallbackHandler must not be null");
+ }
+ this.callbackHandler = callbackHandler;
+
+ final String configFile = getRequiredOption(options, STS_CONFIG_FILE);
+ // this call will not be required with the next version of jboss-identity
+ // as it will be able to first parse and populate the builder so that
+ // properties, like password, can be overridden.
+ // http://jira.jboss.org/jira/browse/JBID-202
+ final STSClientConfig config = checkTypeOfPassword(new STSClientConfig.Builder().build(configFile));
+ wsTrustClient = createWSTrustClient(config);
+ }
+
+ private STSClientConfig checkTypeOfPassword(final STSClientConfig config)
+ {
+ final String password = config.getPassword();
+
+ if (PasswordUtil.isPasswordFile(password))
+ {
+ final Builder builder = new STSClientConfig.Builder();
+ builder.serviceName(config.getServiceName());
+ builder.endpointAddress(config.getEndPointAddress());
+ builder.portName(config.getPortName());
+ builder.username(config.getUsername());
+ try
+ {
+ // Set the password using password file.
+ builder.password(new PasswordUtil(password).getPasswordAsString());
+ return builder.build();
+ }
+ catch (final IOException e)
+ {
+ throw new IllegalArgumentException("Could not read password from file :" + config.getPassword(), e);
+ }
+ }
+
+ return config;
+ }
+
+ STSClient createWSTrustClient(final STSClientConfig config)
+ {
+ try
+ {
+ return STSClientFactory.getInstance().create(config);
+ }
+ catch (final ParsingException e)
+ {
+ throw new IllegalStateException("Could not create WSTrustClient:", e);
+ }
+ }
+
+ private String getRequiredOption(final Map<String, ?> options, final String optionName)
+ {
+ final String option = (String) options.get(optionName);
+ if (option == null)
+ {
+ throw new IllegalArgumentException("Required option '" + optionName + "' was missing from the login modules configuration");
+ }
+
+ return option;
+ }
+
+ /**
+ * @return true If the login was successful otherwise false.
+ * @throws LoginException
+ * If an error occurs while trying to perform the
+ * authentication.
+ */
+ public boolean login() throws LoginException
+ {
+ try
+ {
+ // See if the AuthenticationRequest has a Saml Token associated with it.
+ samlToken = getSamlTokenFromCaller();
+
+ // Verify that the Saml Token is still valid.
+ success = wsTrustClient.validateToken(samlToken);
+ if (success == false)
+ {
+ // Throw an exception as returing false only says that this login module should be ignored.
+ throw new LoginException("Could not validate the SAML Security Token :" + samlToken);
+ }
+
+ return success;
+ }
+ catch (WSTrustException e)
+ {
+ throw new LoginException("WSTrustException : " + e.getMessage());
+ }
+ catch (final IOException e)
+ {
+ throw new LoginException("IOException : " + e.getMessage());
+ }
+ catch (final UnsupportedCallbackException e)
+ {
+ throw new LoginException("UnsupportedCallbackException : " + e.getMessage());
+ }
+ }
+
+ private Element getSamlTokenFromCaller() throws UnsupportedCallbackException, LoginException, IOException
+ {
+ final ObjectCallback objectCallback = new ObjectCallback("SamlToken: ");
+
+ callbackHandler.handle(new Callback[] { objectCallback });
+
+ final AuthenticationRequest authRequest = (AuthenticationRequest) objectCallback.getCredential();
+ if (authRequest == null)
+ {
+ throw new LoginException("Could not locate a AuthenticationRequest from the callback.");
+ }
+
+ Set<?> credentials = authRequest.getCredentials();
+ for (Object object : credentials)
+ {
+ if (object instanceof SamlCredential)
+ {
+ final SamlCredential samlCredential = (SamlCredential) object;
+ return samlCredential.getAssertionElement();
+ }
+ }
+
+ throw new LoginException("Could not locate a SamplPrincipal in the AuthenticationRequest.");
+ }
+
+ public boolean commit() throws LoginException
+ {
+ if (success)
+ {
+ logger.debug("Successfully validated Assertion. ");
+ removeAllSamlCredentials(subject);
+ // Add the SamlToken to the authenticated Subjects principals
+ subject.getPublicCredentials().add(new SamlCredential(samlToken));
+
+ return true;
+ }
+ else
+ {
+ removeAllSamlCredentials(subject);
+ return false;
+ }
+ }
+
+ /**
+ * Called if the overall authentication failed (phase 2).
+ */
+ public boolean abort() throws LoginException
+ {
+ success = false;
+ clearState();
+ return true;
+ }
+
+ public boolean logout() throws LoginException
+ {
+ clearState();
+ return true;
+ }
+
+ private void clearState()
+ {
+ samlToken = null;
+ removeAllSamlCredentials(subject);
+ }
+
+ private void removeAllSamlCredentials(final Subject subject)
+ {
+ final Set<SamlCredential> samlCredentials = subject.getPublicCredentials(SamlCredential.class);
+ subject.getPublicCredentials().removeAll(samlCredentials);
+ }
+
+}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/SamlContext.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/SamlContext.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/SamlContext.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/SamlContext.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.login;
+
+import org.jboss.soa.esb.services.security.auth.login.SamlCredential;
+
+/**
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public final class SamlContext
+{
+ private static final ThreadLocal<SamlCredential> CONTEXT = new ThreadLocal<SamlCredential>();
+
+ private SamlContext() {}
+
+ public static void clearContext()
+ {
+ CONTEXT.set(null);
+ }
+
+ public static SamlCredential getContext()
+ {
+ return CONTEXT.get();
+ }
+
+ public static void setContext(final SamlCredential principal)
+ {
+ CONTEXT.set(principal);
+ }
+
+}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/SamlCredential.java (from rev 29481, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/SamlCredential.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/SamlCredential.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/SamlCredential.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.login;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.StringWriter;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.util.xml.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Credential that wraps a SAML Assertion.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public final class SamlCredential implements Serializable
+{
+ private static final long serialVersionUID = -8496414959425288835L;
+
+ private String assertion;
+
+ public SamlCredential(final Element assertion)
+ {
+ this.assertion = SamlCredential.assertionToString(assertion);
+ }
+
+ public SamlCredential(final String assertion)
+ {
+ AssertArgument.isNotNull(assertion, "assertion");
+ this.assertion = assertion;
+ }
+
+ public String getAssertion()
+ {
+ return assertion;
+ }
+
+ public Element getAssertionElement() throws IOException
+ {
+ return SamlCredential.assertionToElement(assertion);
+ }
+
+ public static Element assertionToElement(final String assertion) throws IOException
+ {
+ return DOMUtils.parse(assertion);
+ }
+
+ public static String assertionToString(final Element assertion)
+ {
+ AssertArgument.isNotNull(assertion, "assertion");
+ try
+ {
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ final Source source = new DOMSource(assertion);
+ final StringWriter writer = new StringWriter();
+ final Result result = new StreamResult(writer);
+
+ transformer.transform(source, result);
+
+ return writer.toString();
+ }
+ catch (TransformerConfigurationException e)
+ {
+ throw new IllegalStateException(e.getMessage(), e);
+ }
+ catch (TransformerFactoryConfigurationError e)
+ {
+ throw new IllegalStateException(e.getMessage(), e);
+ }
+ catch (TransformerException e)
+ {
+ throw new IllegalStateException(e.getMessage(), e);
+ }
+ }
+}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SOAPSecurityHeaderVisitor.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SOAPSecurityHeaderVisitor.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SOAPSecurityHeaderVisitor.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SOAPSecurityHeaderVisitor.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,271 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.ws;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.xml.namespace.QName;
+
+import org.milyn.SmooksException;
+import org.milyn.cdr.annotation.ConfigParam;
+import org.milyn.container.ExecutionContext;
+import org.milyn.delivery.annotation.Initialize;
+import org.milyn.delivery.sax.SAXElement;
+import org.milyn.delivery.sax.SAXElementVisitor;
+import org.milyn.delivery.sax.SAXText;
+import org.milyn.delivery.sax.SAXVisitor;
+import org.milyn.delivery.sax.WriterUtil;
+import org.milyn.javabean.decoders.BooleanDecoder;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * SOAPSecurityHeaderVisitor is a Smooks Visitor that will add a
+ * SOAP Security Header to a SOAP Envelope.
+ *
+ * The Security Header can be any xml header returned by the abstract
+ * method {@link #getHeaderToInsert()}.
+ * </p>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public abstract class SOAPSecurityHeaderVisitor implements SAXElementVisitor
+{
+ private static final String HEADER_ADDED = "addedToken";
+
+ private String headerElementName;
+ private String headerNS;
+ private String securityElementName;
+ private String securityNS;
+ private String securityPrefix;
+ private boolean addSecurityXmlNsAttribute;
+
+ private QName securityQName;
+ private QName headerQName;
+
+ private SAXVisitor writerOwner = this;
+ private boolean rewriteEntities = true;
+
+ /**
+ * Should be implemented by subclasses and return the security
+ * header to be inserted into the SOAP Security Header.
+ *
+ * @return String The header to be inserted into the SOAP Security Header.
+ */
+ protected abstract String getHeaderToInsert();
+
+ @Initialize
+ public void initialize()
+ {
+ securityQName = new QName(securityNS, securityElementName, securityPrefix);
+ headerQName = new QName(headerNS, headerElementName);
+ }
+
+ /**
+ * Will simply write the start of the element.
+ *
+ * @param element The current {@link SAXElement}.
+ * @param executionContext Smooks {@link ExecutionContext}.
+ */
+ public void visitBefore(final SAXElement element, final ExecutionContext executionContext) throws SmooksException, IOException
+ {
+ WriterUtil.writeStartElement(element, element.getWriter(writerOwner), rewriteEntities);
+ }
+
+ /**
+ * Will write the SAXTex.
+ *
+ * @param element The current {@link SAXElement}.
+ * @param text The {@link SAXText} to write.
+ * @param executionContext Smooks {@link ExecutionContext}.
+ */
+ public void onChildText(final SAXElement element, final SAXText text, final ExecutionContext executionContext) throws SmooksException, IOException
+ {
+ if (element.isWriterOwner(writerOwner))
+ {
+ text.toWriter(element.getWriter(writerOwner), rewriteEntities);
+ }
+ }
+
+ /**
+ * Will create a new Security header element if one does not exist and add the header, the String
+ * returned from {@link #getHeaderToInsert()}, into the newly created Security header.
+ *
+ * If a Security header does exist the header, the String returned from {@link #getHeaderToInsert()},
+ * will be inserted into the existing header.
+ *
+ * @param element The current {@link SAXElement}.
+ * @param text The {@link SAXText} to write.
+ * @param executionContext Smooks {@link ExecutionContext}.
+ */
+ public void visitAfter(final SAXElement element, final ExecutionContext executionContext) throws SmooksException, IOException
+ {
+ if (element.isWriterOwner(writerOwner))
+ {
+ final Boolean headerAdded = (Boolean) executionContext.getAttribute(HEADER_ADDED);
+ if (headerAdded == null)
+ {
+ final QName elementQName = element.getName();
+ if (elementQName.equals(securityQName))
+ {
+ // A Security Header exists so we simply add the header to it.
+ addHeader(element);
+ }
+ else if (elementQName.equals(headerQName))
+ {
+ // No Security Header exists in the SOAP Header so we must create one.
+ final AttributesImpl attributesImpl = new AttributesImpl();
+ if (addSecurityXmlNsAttribute)
+ {
+ // Add a xmlns to the Security Header that is to be created.
+ attributesImpl.addAttribute("", securityQName.getLocalPart(), "xmlns:" + securityQName.getPrefix(), "CDDATA",securityQName.getNamespaceURI());
+ }
+ // Create the Security Header
+ final SAXElement securityElement = new SAXElement(securityQName, attributesImpl, element);
+
+ final Writer writer = element.getWriter(writerOwner);
+ // Write the start of the Security Header element
+ WriterUtil.writeStartElement(securityElement, writer, rewriteEntities);
+ // Add the specific Security Header to the newly created Security Header
+ addHeader(element);
+ // Write the end of the Security Header element
+ WriterUtil.writeEndElement(securityElement, writer);
+ }
+ executionContext.setAttribute(HEADER_ADDED, Boolean.TRUE);
+ }
+
+ WriterUtil.writeEndElement(element, element.getWriter(writerOwner));
+ }
+ }
+
+ /**
+ * Will write the String returned from {@link #getHeaderToInsert()} to the
+ * passed in {@link SAXElement}..
+ *
+ * @param element The current {@link SAXElement}.
+ */
+ private void addHeader(final SAXElement element) throws IOException
+ {
+ Writer writer = element.getWriter(writerOwner);
+ final String header = getHeaderToInsert();
+ if (header != null)
+ {
+ writer.append(header);
+ }
+ }
+
+ /**
+ * No Operation implemented.
+ */
+ public void onChildElement(final SAXElement element, final SAXElement childElement, final ExecutionContext executionContext) throws SmooksException, IOException
+ {
+ // NoOP
+ }
+
+ /**
+ * This is the name of the Security element header. This will be used for matching
+ * a pre-existing Security header element in a SOAP Envelope and also used when
+ * creating a new Security header (that is if one does not exist).
+ * For example:
+ * Envelope/Header/Security
+ *
+ * @param securityElementName The name of the Security header element
+ * @return {@link SOAPSecurityHeaderVisitor} To support method chaining.
+ */
+ @ConfigParam (defaultVal = "Security")
+ public SOAPSecurityHeaderVisitor setSecurityElementName(String securityElementName)
+ {
+ this.securityElementName = securityElementName;
+ return this;
+ }
+
+ /**
+ * The name of the SOAP Header element.
+ *
+ * @param name The name of the SOAP Header element.
+ * @return {@link SOAPSecurityHeaderVisitor} To support method chaining.
+ */
+ @ConfigParam (defaultVal = "Header")
+ public SOAPSecurityHeaderVisitor setHeaderElementName(String name)
+ {
+ this.headerElementName = name;
+ return this;
+ }
+
+ /**
+ * The namespace(ns) of the SOAP Envelope. Used to support different version.
+ *
+ * @param ns The SOAP Envelope namespace.
+ * @return {@link SOAPSecurityHeaderVisitor} To support method chaining.
+ */
+ @ConfigParam (defaultVal = "http://schemas.xmlsoap.org/soap/envelope/")
+ public SOAPSecurityHeaderVisitor setHeaderNS(String ns)
+ {
+ this.headerNS = ns;
+ return this;
+ }
+
+ /**
+ * The namespace(ns) of the SOAP Secuirty Headerl. Used to support different version.
+ *
+ * @param ns The SOAP SecurityHeader namespace.
+ * @return {@link SOAPSecurityHeaderVisitor} To support method chaining.
+ */
+ @ConfigParam (defaultVal = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")
+ public SOAPSecurityHeaderVisitor setSecurityNS(String securityNS)
+ {
+ this.securityNS = securityNS;
+ return this;
+ }
+
+ /**
+ * This is the Security Header prefix which will be used when creating a new Security header.
+ * For example, setting this to sec would generate a Security Header looking like:
+ * <pre>
+ * <sec:Security xmlns:sec=...
+ * </pre>
+ *
+ * @param prefix The prefix for the Security Header element.
+ * @return {@link SOAPSecurityHeaderVisitor} To support method chaining.
+ */
+ @ConfigParam (defaultVal = "wsse")
+ public SOAPSecurityHeaderVisitor setSecurityPrefix(String prefix)
+ {
+ this.securityPrefix = prefix;
+ return this;
+ }
+
+ /**
+ * Determines if an xmlns attribute should be added to a created Security Header
+ * element. This might not be needed or desired if you know that this declaration
+ * exist in the higher up in the SOAP Envelope.
+ *
+ * @param add True will add the xmlns attribute to a created Security Header element. False will not.
+ * @return {@link SOAPSecurityHeaderVisitor} To support method chaining.
+ */
+ @ConfigParam (defaultVal = "false", decoder = BooleanDecoder.class)
+ public SOAPSecurityHeaderVisitor setAddSecurityXmlNSAttribute(final boolean add)
+ {
+ this.addSecurityXmlNsAttribute = add;
+ return this;
+ }
+}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractor.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractor.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractor.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractor.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.ws;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.soa.esb.lifecycle.LifecycleResourceException;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequestImpl;
+import org.jboss.soa.esb.services.security.auth.SecurityInfoExtractor;
+import org.jboss.soa.esb.services.security.auth.login.SamlCredential;
+import org.jboss.soa.esb.smooks.resource.SmooksResource;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.milyn.Smooks;
+import org.milyn.container.ExecutionContext;
+import org.milyn.delivery.DOMModel;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Extracts SAML Assertions from a SOAP Message. </p>
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class SamlAssertionExtractor implements SecurityInfoExtractor<String>
+{
+ /**
+ * Smooks configuration file which specified the extraction
+ */
+ private static final String SMOOK_CONFIG_FILE = "smooks-saml.xml";
+
+ /**
+ * Smooks instance the will perform the extraction
+ */
+ private Smooks smooks;
+
+ /**
+ * Creates an instance using the default Smooks config file.
+ */
+ public SamlAssertionExtractor()
+ {
+ createSmooks(SMOOK_CONFIG_FILE);
+ }
+
+ /**
+ * Creates an instance of Smooks using the passed in config file.
+ *
+ * @param configFile
+ * - the Smooks config file to use.
+ */
+ public SamlAssertionExtractor(final String configFile)
+ {
+ createSmooks(configFile);
+ }
+
+ public Node extractSamlAssertion(final String soap) throws IOException
+ {
+ if (soap == null || !soap.startsWith("<"))
+ {
+ return null;
+ }
+
+ final ExecutionContext execContext = smooks.createExecutionContext();
+ smooks.filterSource(execContext, new StreamSource(new StringReader(soap)));
+
+ final DOMModel nodeModel = DOMModel.getModel(execContext);
+ return nodeModel.getModels().get("Assertion");
+ }
+
+ public AuthenticationRequest extractSecurityInfo(final String soap)
+ {
+ if (soap == null || !soap.startsWith("<"))
+ {
+ return null;
+ }
+
+ Node samlToken;
+ try
+ {
+ samlToken = extractSamlAssertion(soap);
+ }
+ catch (final IOException e)
+ {
+ throw new SecurityException("Could not extract saml token info from :" + soap, e);
+ }
+
+ if (samlToken != null)
+ {
+ Set credential = Collections.singleton(new SamlCredential((Element)samlToken));
+ return new AuthenticationRequestImpl.Builder(null, credential).build();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private void createSmooks(final String configFile)
+ {
+ final InputStream is = ClassUtil.getResourceAsStream(configFile, getClass());
+ if (is == null)
+ {
+ throw new IllegalArgumentException("Failed to located configuration file resource: " + configFile);
+ }
+ try
+ {
+ this.smooks = SmooksResource.createSmooksResource(is);
+ }
+ catch (final LifecycleResourceException lre)
+ {
+ throw new IllegalStateException("Could not parse " + configFile, lre);
+ }
+ catch (final SAXException e)
+ {
+ throw new IllegalStateException("Could not parse " + configFile, e);
+ }
+ catch (final IOException e)
+ {
+ throw new IllegalStateException("Could not parse " + configFile, e);
+ }
+ }
+
+}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlVisitor.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlVisitor.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlVisitor.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlVisitor.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.ws;
+
+import org.jboss.soa.esb.services.security.auth.login.SamlContext;
+import org.jboss.soa.esb.services.security.auth.login.SamlCredential;
+
+/**
+ * Extends {@link SOAPSecurityHeaderVisitor} to add a SAML Assertion
+ * to a SOAP Security Header.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class SamlVisitor extends SOAPSecurityHeaderVisitor
+{
+ @Override
+ protected String getHeaderToInsert()
+ {
+ SamlCredential samlPrincipal = SamlContext.getContext();
+ if (samlPrincipal != null)
+ {
+ return samlPrincipal.getAssertion();
+ }
+ return null;
+ }
+
+}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector-template.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector-template.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector-template.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector-template.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
+
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ <param name="default.serialization.on">true</param>
+ </params>
+
+ <resource-config selector="@selector@" selector-namespace="@selectorNamespace@">
+ <resource>org.jboss.soa.esb.services.security.auth.ws.SamlVisitor</resource>
+ <param name="securityNS">@securityNamespace@</param>
+ <param name="headerNS">@headerNamespace@</param>
+ <param name="addSecurityXmlNSAttribute">true</param>
+ </resource-config>
+
+</smooks-resource-list>
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
+
+ <import file="/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector-template.xml">
+ <param name="selector">/Envelope/Header/Security</param>
+ <param name="selectorNamespace">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</param>
+ <param name="securityNamespace">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</param>
+ <param name="headerNamespace">http://schemas.xmlsoap.org/soap/envelope/</param>
+ </import>
+
+ <import file="/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-injector-template.xml">
+ <param name="selector">/Envelope/Header</param>
+ <param name="selectorNamespace">http://schemas.xmlsoap.org/soap/envelope/</param>
+ <param name="securityNamespace">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</param>
+ <param name="headerNamespace">http://schemas.xmlsoap.org/soap/envelope/</param>
+ </import>
+
+</smooks-resource-list>
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-template.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-template.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-template.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-template.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
+
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ </params>
+
+ <resource-config selector="/Envelope/Header/Security/Assertion" selector-namespace="@saml-namespace@">
+ <resource>org.milyn.delivery.DomModelCreator</resource>
+ </resource-config>
+
+</smooks-resource-list>
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-saml.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
+
+ <import file="/org/jboss/soa/esb/services/security/auth/ws/smooks-saml-template.xml">
+ <param name="saml-namespace">urn:oasis:names:tc:SAML:2.0:assertion</param>
+ </import>
+
+</smooks-resource-list>
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-ws-security.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-ws-security.xml 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-ws-security.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -3,6 +3,7 @@
<params>
<param name="stream.filter.type">SAX</param>
+ <param name="default.serialization.on">false</param>
</params>
<import file="/org/jboss/soa/esb/services/security/auth/ws/smooks-ws-security-template.xml">
Modified: labs/jbossesb/trunk/product/rosetta/tests/build.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/build.xml 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/rosetta/tests/build.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -123,6 +123,7 @@
<fileset dir="${org.jboss.esb.module.tests.src.dir}" includes="**/*.war" />
<fileset dir="${org.jboss.esb.module.tests.src.dir}" includes="**/*.xsd" />
<fileset dir="${org.jboss.esb.module.tests.src.dir}" includes="**/*.xslt" />
+ <fileset dir="${org.jboss.esb.module.tests.src.dir}" includes="**/*.properties" />
</copy>
<copy file="${org.jboss.esb.root.dir}/etc/schemas/xml/jbossesb-1.0.1.xsd" todir="${org.jboss.esb.tests.classes.dir}"/>
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/actions/security)
Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/JBossSTSActionUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/JBossSTSActionUnitTest.java 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/JBossSTSActionUnitTest.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,188 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
- * LLC, and individual contributors by the @authors tag. See the copyright.txt
- * in the distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
- * site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.actions.security;
-
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import junit.framework.JUnit4TestAdapter;
-
-import org.jboss.identity.federation.api.wstrust.WSTrustClient;
-import org.jboss.identity.federation.core.wstrust.plugins.saml.SAMLUtil;
-import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.services.security.auth.login.JBossSTSConstants;
-import org.jboss.soa.esb.services.security.auth.login.SamlContext;
-import org.junit.Test;
-import org.w3c.dom.Element;
-
-/**
- * Unit test for {@link JBossSTSAction}.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class JBossSTSActionUnitTest
-{
- @Test
- public void initialiseWSTrustClient() throws Exception
- {
- WSTrustClient mockWSTrustclient = mock(WSTrustClient.class);
- Element securityToken = SAMLUtil.toElement(new AssertionType());
- when(mockWSTrustclient.issueToken((any(String.class)))).thenReturn(securityToken);
-
- ConfigTree config = new ConfigBuilder().serviceName("dummy").portName("dummy").endpointAddress("dummy").tokenType("dummy").username("dummy").password("dummy").build();
- JBossSTSAction stsAction = new MockSTSAction(config, mockWSTrustclient);
- stsAction.initialise();
-
- Message message = MessageFactory.getInstance().getMessage();
- stsAction.process(message);
- Object object = SamlContext.getContext().getAssertionElement();
- assertTrue(object instanceof Element);
- SamlContext.clearContext();
- }
-
- @Test (expected = ConfigurationException.class)
- public void shouldThrowIfServiceNameIsMissing() throws ConfigurationException
- {
- new JBossSTSAction(new ConfigBuilder().portName("dummy").endpointAddress("dummy").tokenType("dummy").username("dummy").password("dummy").build());
- }
-
- @Test (expected = ConfigurationException.class)
- public void shouldThrowIfPortNameIsMissing() throws ConfigurationException
- {
- new JBossSTSAction(new ConfigBuilder().serviceName("dummy").endpointAddress("dummy").tokenType("dummy").username("dummy").password("dummy").build());
- }
-
- @Test (expected = ConfigurationException.class)
- public void shouldThrowIfEndpointAddresIsMissing() throws ConfigurationException
- {
- new JBossSTSAction(new ConfigBuilder().serviceName("dummy").portName("dummy").tokenType("dummy").username("dummy").password("dummy").build());
- }
-
- @Test (expected = ConfigurationException.class)
- public void shouldThrowIfUsernameIsMissing() throws ConfigurationException
- {
- new JBossSTSAction(new ConfigBuilder().serviceName("dummy").portName("dummy").endpointAddress("dummy").tokenType("dummy").password("dummy").build());
- }
-
- @Test (expected = ConfigurationException.class)
- public void shouldThrowIfPasswordIsMissing() throws ConfigurationException
- {
- new JBossSTSAction(new ConfigBuilder().serviceName("dummy").portName("dummy").endpointAddress("dummy").tokenType("dummy").username("dummy").build());
- }
-
- @Test (expected = ConfigurationException.class)
- public void shouldThrowIfTokenTypeIsMissing() throws ConfigurationException
- {
- new JBossSTSAction(new ConfigBuilder().serviceName("dummy").portName("dummy").endpointAddress("dummy").username("dummy").build());
- }
-
- private static class ConfigBuilder
- {
- private ConfigTree config;
-
- public ConfigBuilder()
- {
- config = new ConfigTree(getClass().getSimpleName());
- }
-
- public ConfigBuilder serviceName(final String serviceName)
- {
- config.setAttribute(JBossSTSConstants.SERVICE_NAME_OPTION, serviceName);
- return this;
- }
-
- public ConfigBuilder portName(final String portname)
- {
- config.setAttribute(JBossSTSConstants.PORT_NAME_OPTION, portname);
- return this;
- }
-
- public ConfigBuilder endpointAddress(final String endpoint)
- {
- config.setAttribute(JBossSTSConstants.ENDPOINT_ADDRESS_OPTION, endpoint);
- return this;
- }
-
- public ConfigBuilder tokenType(final String tokenType)
- {
- config.setAttribute(JBossSTSConstants.TOKEN_TYPE_OPTION, tokenType);
- return this;
- }
-
- public ConfigBuilder username(final String username)
- {
- config.setAttribute(JBossSTSConstants.USERNAME_OPTION, username);
- return this;
- }
-
- public ConfigBuilder password(final String password)
- {
- config.setAttribute(JBossSTSConstants.PASSWORD_OPTION, password);
- return this;
- }
-
- public ConfigBuilder addToEsbAuthRequestMessage(final boolean add)
- {
- config.setAttribute(JBossSTSAction.ADD_TO_ESB_AUTH_REQUEST, Boolean.toString(add));
- return this;
- }
-
- public ConfigTree build()
- {
- return config;
- }
- }
-
- private class MockSTSAction extends JBossSTSAction
- {
- private WSTrustClient client;
-
- public MockSTSAction(ConfigTree config) throws ConfigurationException
- {
- super(config);
- }
-
- public MockSTSAction(ConfigTree config, final WSTrustClient client) throws ConfigurationException
- {
- super(config);
- this.client = client;
- }
-
- @Override
- WSTrustClient createWSTrustClient(Message message) throws ActionProcessingException
- {
- return client;
- }
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(JBossSTSActionUnitTest.class);
- }
-
-}
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/JBossSTSActionUnitTest.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/JBossSTSActionUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/JBossSTSActionUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/JBossSTSActionUnitTest.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions.security;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.identity.federation.core.wstrust.STSClient;
+import org.jboss.identity.federation.core.wstrust.plugins.saml.SAMLUtil;
+import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.services.security.auth.login.JBossSTSConstants;
+import org.jboss.soa.esb.services.security.auth.login.SamlContext;
+import org.junit.Test;
+import org.w3c.dom.Element;
+
+/**
+ * Unit test for {@link JBossSTSAction}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class JBossSTSActionUnitTest
+{
+ private String configFile = "org/jboss/soa/esb/actions/security/jboss-sts-client.properties";
+
+ @Test
+ public void process() throws Exception
+ {
+ STSClient mockWSTrustclient = mock(STSClient.class);
+ Element securityToken = SAMLUtil.toElement(new AssertionType());
+ when(mockWSTrustclient.issueToken((any(String.class)), any(String.class))).thenReturn(securityToken);
+
+ ConfigTree config = new ConfigBuilder().configFile(configFile).tokenType("dummy").build();
+ JBossSTSAction stsAction = new MockSTSAction(config, mockWSTrustclient);
+ stsAction.initialise();
+
+ Message message = MessageFactory.getInstance().getMessage();
+ stsAction.process(message);
+ Object object = SamlContext.getContext().getAssertionElement();
+ assertTrue(object instanceof Element);
+ SamlContext.clearContext();
+ }
+
+ @Test (expected = ConfigurationException.class)
+ public void shouldThrowIfTokenTypeIsMissing() throws ConfigurationException
+ {
+ new JBossSTSAction(new ConfigBuilder().configFile(configFile).build());
+ }
+
+ private static class ConfigBuilder
+ {
+ private ConfigTree config;
+
+ public ConfigBuilder()
+ {
+ config = new ConfigTree(getClass().getSimpleName());
+ }
+
+ public ConfigBuilder configFile(final String file)
+ {
+ config.setAttribute(JBossSTSAction.STS_CONFIG, file);
+ return this;
+ }
+
+ public ConfigBuilder tokenType(final String tokenType)
+ {
+ config.setAttribute(JBossSTSConstants.TOKEN_TYPE_OPTION, tokenType);
+ return this;
+ }
+
+ public ConfigBuilder addToEsbAuthRequestMessage(final boolean add)
+ {
+ config.setAttribute(JBossSTSAction.ADD_TO_ESB_AUTH_REQUEST, Boolean.toString(add));
+ return this;
+ }
+
+ public ConfigTree build()
+ {
+ return config;
+ }
+ }
+
+ private class MockSTSAction extends JBossSTSAction
+ {
+ private STSClient client;
+
+ public MockSTSAction(ConfigTree config) throws ConfigurationException
+ {
+ super(config);
+ }
+
+ public MockSTSAction(ConfigTree config, final STSClient client) throws ConfigurationException
+ {
+ super(config);
+ this.client = client;
+ }
+
+ @Override
+ STSClient createWSTrustClient()
+ {
+ return client;
+ }
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(JBossSTSActionUnitTest.class);
+ }
+
+}
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/jboss-sts-client.properties (from rev 29481, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/jboss-sts-client.properties)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/jboss-sts-client.properties (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/security/jboss-sts-client.properties 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,5 @@
+serviceName=JBossSTS
+portName=JBossSTSPort
+endpointAddress=http://localhost:8080/jboss-sts/JBossSTS
+username=admin
+password=admin
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModuleUnitTest.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModuleUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModuleUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModuleUnitTest.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.login;
+
+import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.identity.federation.core.wstrust.STSClient;
+import org.jboss.identity.federation.core.wstrust.STSClientConfig;
+import org.jboss.identity.federation.core.wstrust.plugins.saml.SAMLUtil;
+import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequestImpl;
+import org.junit.Test;
+import org.w3c.dom.Element;
+
+/**
+ * Unit test for {@link JBossSTSLoginModule}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class JBossSTSLoginModuleUnitTest
+{
+ @Test
+ public void loginValidToken() throws Exception
+ {
+ final STSClient client = mock(STSClient.class);
+ when(client.validateToken(any(Element.class))).thenReturn(true);
+
+ final JBossSTSLoginModule loginModule = new MockSTSLoginModule(client);
+
+ final Element samlToken = createSamlToken();
+
+ final JBossSTSCallbackHandler callbackHandler = new JBossSTSCallbackHandler();
+ final SamlCredential samlCredential = new SamlCredential(samlToken);
+ Set credential = Collections.singleton(samlCredential);
+ final AuthenticationRequest authRequest = new AuthenticationRequestImpl.Builder(null, credential).build();
+ callbackHandler.setAuthenticationRequest(authRequest);
+ callbackHandler.setSecurityConfig(null);
+
+ Subject subject = new Subject();
+ loginModule.initialize(subject, callbackHandler, null, allOptions());
+
+ // Simulate Phase 1
+ boolean login = loginModule.login();
+ assertTrue(login);
+
+ // Simulate Phase 2
+ boolean commit = loginModule.commit();
+ assertTrue(commit);
+
+ Set<SamlCredential> samlCredentials = subject.getPublicCredentials(SamlCredential.class);
+ assertEquals(1, samlCredentials.size());
+
+ // Try to commit again to make sure the multiple SamlCredentials are not added to the
+ // Subject public credentials.
+ commit = loginModule.commit();
+ samlCredentials = subject.getPublicCredentials(SamlCredential.class);
+ assertEquals(1, samlCredentials.size());
+ }
+
+ @Test(expected = LoginException.class)
+ public void loginInValidToken() throws Exception
+ {
+ final STSClient client = mock(STSClient.class);
+ when(client.validateToken(any(Element.class))).thenReturn(false);
+
+ final JBossSTSLoginModule loginModule = new MockSTSLoginModule(client);
+
+ final Element samlToken = createSamlToken();
+
+ final JBossSTSCallbackHandler callbackHandler = new JBossSTSCallbackHandler();
+ final SamlCredential samlCredential = new SamlCredential(samlToken);
+ Set credential = Collections.singleton(samlCredential);
+ final AuthenticationRequest authRequest = new AuthenticationRequestImpl.Builder(null, credential).build();
+ callbackHandler.setAuthenticationRequest(authRequest);
+ callbackHandler.setSecurityConfig(null);
+
+ loginModule.initialize(new Subject(), callbackHandler, null, allOptions());
+
+ // Simulate Phase 1
+ boolean login = loginModule.login();
+ assertTrue(login);
+ }
+
+ @Test (expected = IllegalArgumentException.class)
+ public void missingCallbackHanlder()
+ {
+ Map<String, String> allOptions = allOptions();
+ allOptions.remove(JBossSTSConstants.SERVICE_NAME_OPTION);
+ final JBossSTSLoginModule loginModule = new MockSTSLoginModule(mock(STSClient.class));
+ loginModule.initialize(new Subject(), null, null, allOptions());
+ }
+
+ private Element createSamlToken() throws Exception
+ {
+ AssertionType assertionType = new AssertionType();
+ return SAMLUtil.toElement(assertionType);
+ }
+
+ /**
+ * Returns all requried options.
+ *
+ * @return Map Containing all the required options of the login module.
+ */
+ private Map<String, String> allOptions()
+ {
+ final Map<String, String> options = new HashMap<String, String>();
+ options.put(JBossSTSLoginModule.STS_CONFIG_FILE, "org/jboss/soa/esb/services/security/auth/login/jboss-sts-client.properties");
+ return options;
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(JBossSTSLoginModuleUnitTest.class);
+ }
+
+ private class MockSTSLoginModule extends JBossSTSLoginModule
+ {
+
+ private STSClient client;
+
+ public MockSTSLoginModule(final STSClient client)
+ {
+ this.client = client;
+ }
+
+ @Override
+ STSClient createWSTrustClient(final STSClientConfig config)
+ {
+ return client;
+ }
+
+
+ }
+}
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/SamlCredentialUnitTest.java (from rev 29481, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/SamlCredentialUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/SamlCredentialUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/SamlCredentialUnitTest.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.login;
+
+import static org.junit.Assert.assertTrue;
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.util.XMLHelper;
+import org.jboss.util.xml.DOMUtils;
+import org.junit.Test;
+import org.w3c.dom.Element;
+
+/**
+ * Unit test for {@link SamlCredential}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class SamlCredentialUnitTest
+{
+ @Test
+ public void stringConstructor() throws Exception
+ {
+ final SamlCredential samlPrincipal = new SamlCredential(StreamUtils.readStreamString(getClass().getResourceAsStream("assertion.xml"), "UTF-8"));
+
+ final String expected = StreamUtils.readStreamString(getClass().getResourceAsStream("assertion-expected.xml"), "UTF-8");
+ final String actual = samlPrincipal.getAssertion();
+
+ assertTrue(XMLHelper.compareXMLContent(expected, actual));
+ }
+
+ @Test
+ public void elementConstructor() throws Exception
+ {
+ final Element assertionElement = DOMUtils.parse(getClass().getResourceAsStream("assertion.xml"));
+ final String expectedAssertion = SamlCredential.assertionToString(assertionElement);
+
+ final SamlCredential samlPrincipal = new SamlCredential(assertionElement);
+ final String actualAssertion = samlPrincipal.getAssertion();
+
+ assertTrue(XMLHelper.compareXMLContent(expectedAssertion, actualAssertion));
+ }
+
+ @Test (expected = IllegalArgumentException.class)
+ public void shoudThrowIfStringIsNull()
+ {
+ new SamlCredential((String)null);
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(SamlCredentialUnitTest.class);
+ }
+
+}
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/assertion-expected.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/assertion-expected.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/assertion-expected.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/assertion-expected.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,30 @@
+<Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ID="ID_74414f7f-1339-4f80-b29a-c947d9177445" IssueInstant="2009-09-10T13:49:30.422Z" Version="2.0">
+ <Issuer>JBossSTS</Issuer>
+ <Subject>
+ <NameID NameQualifier="urn:jboss:identity-federation">beve</NameID>
+ <SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
+ </Subject>
+ <Conditions NotBefore="2009-09-10T13:49:30.422Z" NotOnOrAfter="2009-09-10T15:49:30.422Z"/>
+ <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:SignedInfo><dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ <dsig:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ <dsig:Reference URI="#ID_74414f7f-1339-4f80-b29a-c947d9177445" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:Transforms xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ </dsig:Transforms>
+ <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ <dsig:DigestValue xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">so9bv09wxSnauPiq6iC2zs6ubrQ=</dsig:DigestValue>
+ </dsig:Reference>
+ </dsig:SignedInfo>
+ <dsig:SignatureValue>Lf4DYODLtVxSVmd23HJzHTy61ZYDnpaJRTVbRLR2i2zU7v9mskYCVbXY8gm5PYY2V+iYvi+dJ3QlWP9dQu+DHK9rVJSGxSmzfPjrnMC84HH9j2BZBEdKVCpNCAFJQRL+E1jlRB194sjCiuxoMnlR927uMiNcHJRoBSi03kP5tOw=</dsig:SignatureValue>
+ <dsig:KeyInfo>
+ <dsig:KeyValue xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:RSAKeyValue xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:Modulus xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">suGIyhVTbFvDwZdx8Av62zmP+aGOlsBN8WUE3eEEcDtOIZgO78SImMQGwB2C0eIVMhiLRzVPqoW1dCPAveTm653zHOmubaps1fY0lLJDSZbTbhjeYhoQmmaBro/tDpVw5lKJns2qVnMuRK19ju2dxpKwlYGGtrP5VQv00dfNPbs=
+ </dsig:Modulus>
+ <dsig:Exponent xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">AQAB</dsig:Exponent>
+ </dsig:RSAKeyValue>
+ </dsig:KeyValue>
+ </dsig:KeyInfo>
+ </dsig:Signature>
+</Assertion>
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/assertion.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/assertion.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/assertion.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/assertion.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ID="ID_74414f7f-1339-4f80-b29a-c947d9177445" IssueInstant="2009-09-10T13:49:30.422Z" Version="2.0">
+ <Issuer>JBossSTS</Issuer>
+ <Subject>
+ <NameID NameQualifier="urn:jboss:identity-federation">beve</NameID>
+ <SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
+ </Subject>
+ <Conditions NotBefore="2009-09-10T13:49:30.422Z" NotOnOrAfter="2009-09-10T15:49:30.422Z"/>
+ <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:SignedInfo><dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ <dsig:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ <dsig:Reference URI="#ID_74414f7f-1339-4f80-b29a-c947d9177445" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:Transforms xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ </dsig:Transforms>
+ <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ <dsig:DigestValue xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">so9bv09wxSnauPiq6iC2zs6ubrQ=</dsig:DigestValue>
+ </dsig:Reference>
+ </dsig:SignedInfo>
+ <dsig:SignatureValue>Lf4DYODLtVxSVmd23HJzHTy61ZYDnpaJRTVbRLR2i2zU7v9mskYCVbXY8gm5PYY2V+iYvi+dJ3QlWP9dQu+DHK9rVJSGxSmzfPjrnMC84HH9j2BZBEdKVCpNCAFJQRL+E1jlRB194sjCiuxoMnlR927uMiNcHJRoBSi03kP5tOw=</dsig:SignatureValue>
+ <dsig:KeyInfo>
+ <dsig:KeyValue xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:RSAKeyValue xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:Modulus xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">suGIyhVTbFvDwZdx8Av62zmP+aGOlsBN8WUE3eEEcDtOIZgO78SImMQGwB2C0eIVMhiLRzVPqoW1dCPAveTm653zHOmubaps1fY0lLJDSZbTbhjeYhoQmmaBro/tDpVw5lKJns2qVnMuRK19ju2dxpKwlYGGtrP5VQv00dfNPbs=
+ </dsig:Modulus>
+ <dsig:Exponent xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">AQAB</dsig:Exponent>
+ </dsig:RSAKeyValue>
+ </dsig:KeyValue>
+ </dsig:KeyInfo>
+ </dsig:Signature>
+</Assertion>
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/jboss-sts-client.properties (from rev 29481, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/jboss-sts-client.properties)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/jboss-sts-client.properties (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/login/jboss-sts-client.properties 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,5 @@
+serviceName=JBossSTS
+portName=JBossSTSPort
+endpointAddress=http://test:8080/JBossSTS
+username=user1
+password=pass1
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractorUnitTest.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractorUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractorUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractorUnitTest.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.ws;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.identity.federation.core.wstrust.WSTrustException;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.Test;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+/**
+ * Unit test for {@link SamlAssertionExtractor}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class SamlAssertionExtractorUnitTest
+{
+ @Test
+ public void test() throws ConfigurationException, SAXException, IOException, ParserConfigurationException, WSTrustException
+ {
+ final SamlAssertionExtractor extractor = new SamlAssertionExtractor();
+ final Node samlAssertion = extractor.extractSamlAssertion(readFile("soap-saml-example.xml"));
+
+ assertEquals("saml:Assertion", samlAssertion.getNodeName());
+ }
+
+ private String readFile(final String fileName) throws SAXException, IOException, ParserConfigurationException, ConfigurationException
+ {
+ InputStream inputStream = ClassUtil.getResourceAsStream(fileName, getClass());
+ return new String(StreamUtils.readStream(inputStream));
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(SamlAssertionExtractorUnitTest.class);
+ }
+
+}
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlVisitorUnitTest.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlVisitorUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlVisitorUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlVisitorUnitTest.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.security.auth.ws;
+
+import static org.junit.Assert.assertTrue;
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.util.XMLHelper;
+import org.jboss.soa.esb.services.security.auth.login.SamlContext;
+import org.jboss.soa.esb.services.security.auth.login.SamlCredential;
+import org.junit.After;
+import org.junit.Test;
+import org.milyn.FilterSettings;
+import org.milyn.Smooks;
+import org.milyn.StreamFilterType;
+import org.milyn.payload.StringResult;
+import org.milyn.payload.StringSource;
+
+/**
+ * Unit test for {@link SamlVisitor}
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class SamlVisitorUnitTest
+{
+ private static final String SECURITY_NS = "http://security";
+ private static final String HEADER_NS = "http://header";
+ private static final String SECURITY_START = "<t:Security xmlns:t=\"" + SECURITY_NS + "\">";
+ private static final String HEADER_START = "<h:Header xmlns:h=\"" + HEADER_NS + "\">";
+
+ @Test
+ public void addAssertionToEmptySecurityHeader() throws Exception
+ {
+ final Smooks smooks = createSmooks("Envelope/Header/Security");
+
+ final StringSource source = new StringSource("<Envelope><Header>" + SECURITY_START + "</t:Security></Header></Envelope>");
+ final StringResult result = new StringResult();
+
+ final SamlCredential samlPrincipal = new SamlCredential("<dummyAssertion/>");
+ SamlContext.setContext(samlPrincipal);
+
+ smooks.filterSource(source, result);
+
+ final String expected = "<Envelope><Header>" + SECURITY_START + "<dummyAssertion/></t:Security></Header></Envelope>";
+ final String actual = result.toString();
+
+ assertTrue(XMLHelper.compareXMLContent(expected, actual));
+ }
+
+ /**
+ * This test shows that it's is possible have the the {@link SamlVisitor#getHeaderToInsert()
+ * method return null which will simply produce an unchanged security header.
+ */
+ @Test
+ public void addNoAssertionToEmptySecurityHeader() throws Exception
+ {
+ final Smooks smooks = createSmooks("Envelope/Header/Security");
+
+ final String expected = "<Envelope><Header>" + SECURITY_START + "</t:Security></Header></Envelope>";
+ final StringSource source = new StringSource(expected);
+ final StringResult result = new StringResult();
+
+ smooks.filterSource(source, result);
+
+ final String actual = result.toString();
+
+ assertTrue(XMLHelper.compareXMLContent(expected, actual));
+ }
+
+ @Test
+ public void addAssertionToSOAPHeader() throws Exception
+ {
+ final Smooks smooks = createSmooks("Envelope/Header");
+
+ final String soap = "<Envelope>" + HEADER_START + "</h:Header></Envelope>";
+ final StringSource source = new StringSource(soap);
+ final StringResult result = new StringResult();
+
+ final SamlCredential samlPrincipal = new SamlCredential("<dummyAssertion/>");
+ SamlContext.setContext(samlPrincipal);
+
+ smooks.filterSource(source, result);
+
+ final String expected = "<Envelope>" + HEADER_START + SECURITY_START + "<dummyAssertion/></t:Security></h:Header></Envelope>";
+ final String actual = result.toString();
+ assertTrue(XMLHelper.compareXMLContent(expected, actual));
+ }
+
+ @Test
+ public void configFromFileWithSecurityHeader() throws Exception
+ {
+ final Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-saml-injector.xml"));
+
+ final String soap = StreamUtils.readStreamString(getClass().getResourceAsStream("saml-inject.xml"), "UTF-8");
+ final StringSource source = new StringSource(soap);
+ final StringResult result = new StringResult();
+
+ final SamlCredential samlPrincipal = new SamlCredential("<dummyAssertion/>");
+ SamlContext.setContext(samlPrincipal);
+
+ smooks.filterSource(source, result);
+
+ final String expected = StreamUtils.readStreamString(getClass().getResourceAsStream("saml-inject-expected.xml"), "UTF-8");
+ final String actual = result.toString();
+ assertTrue(XMLHelper.compareXMLContent(expected, actual));
+ }
+
+ @Test
+ public void configFromFileWithoutSecurityHeader() throws Exception
+ {
+ final Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-saml-injector.xml"));
+
+ final String soap = StreamUtils.readStreamString(getClass().getResourceAsStream("saml-inject-no-security-header.xml"), "UTF-8");
+ final StringSource source = new StringSource(soap);
+ final StringResult result = new StringResult();
+
+ final SamlCredential samlPrincipal = new SamlCredential("<dummyAssertion/>");
+ SamlContext.setContext(samlPrincipal);
+
+ smooks.filterSource(source, result);
+
+ final String expected = StreamUtils.readStreamString(getClass().getResourceAsStream("saml-inject-expected.xml"), "UTF-8");
+ final String actual = result.toString();
+ assertTrue(XMLHelper.compareXMLContent(expected, actual));
+ }
+
+ private Smooks createSmooks(final String selector)
+ {
+ final Smooks smooks = new Smooks();
+ smooks.setFilterSettings(new FilterSettings().setFilterType(StreamFilterType.SAX));
+
+ final SOAPSecurityHeaderVisitor samlVisitor = new SamlVisitor();
+ samlVisitor.setSecurityElementName("Security").setSecurityNS(SECURITY_NS).setSecurityPrefix("t").setAddSecurityXmlNSAttribute(true);
+ samlVisitor.setHeaderNS(HEADER_NS).setHeaderElementName("Header");
+
+ smooks.addVisitor(samlVisitor, selector);
+ return smooks;
+ }
+
+ @After
+ public void teardown()
+ {
+ SamlContext.clearContext();
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(SamlVisitorUnitTest.class);
+ }
+}
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject-expected.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject-expected.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject-expected.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject-expected.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,14 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <soap:Header>
+ <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
+ <dummyAssertion/>
+ </wsse:Security>
+ </soap:Header>
+
+ <soap:Body>
+ </soap:Body>
+
+</soap:Envelope>
+
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject-no-security-header.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject-no-security-header.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject-no-security-header.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject-no-security-header.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,11 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <soap:Header>
+ </soap:Header>
+
+ <soap:Body>
+ </soap:Body>
+
+</soap:Envelope>
+
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-inject.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,13 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <soap:Header>
+ <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
+ </wsse:Security>
+ </soap:Header>
+
+ <soap:Body>
+ </soap:Body>
+
+</soap:Envelope>
+
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/soap-saml-example.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/soap-saml-example.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/soap-saml-example.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/soap-saml-example.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,35 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <soap:Header>
+ <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext">
+ <saml:Assertion
+ xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+ Version="2.0"
+ IssueInstant="2005-04-01T16:58:33.173Z">
+ <saml:Issuer>http://authority.example.com/</saml:Issuer>
+ <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">...</ds:Signature>
+ <saml:Subject>
+ <saml:NameID format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">
+ jygH5F90l
+ </saml:NameID>
+ </saml:Subject>
+ <saml:AuthnStatement
+ AuthnInstant="2005-04-01T16:57:30.000Z"
+ SessionIndex="6345789">
+ <saml:AuthnContext>
+ <saml:AuthnContextClassRef>
+ urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
+ </saml:AuthnContextClassRef>
+ </saml:AuthnContext>
+ </saml:AuthnStatement>
+ </saml:Assertion>
+ </wsse:Security>
+ </soap:Header>
+
+ <soap:Body>
+ </soap:Body>
+
+</soap:Envelope>
+
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/build.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/build.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,96 +0,0 @@
-<project name="Quickstart_Security_Saml" default="deploy" basedir=".">
-
- <description>
- ${ant.project.name}
- ${line.separator}
- </description>
-
- <!-- additional deploys -->
- <property name="additional.deploys" value="jboss-wsse-client.xml, smooks/*.xml, jboss-sts.properties"/>
-
- <target name="quickstart-specific-predeploys">
- <copy file="${basedir}/jboss-sts.war" todir="${org.jboss.esb.server.deploy.dir}"/>
- </target>
-
- <target name="quickstart-specific-undeploys">
- <delete file="${org.jboss.esb.server.deploy.dir}/jboss-sts.war"/>
- </target>
-
- <!-- Import the base Ant build script... -->
- <import file="../conf/base-build.xml"/>
-
- <target name="quickstart-specific-checks" depends="assert-ws-available"/>
-
-
- <target name="quickstart-specific-dependencies">
- <path id="quickstart-dependencies-classpath">
- <fileset dir="${org.jboss.esb.server.home}/client" includes="jbossws-client.jar,jboss-remoting.jar" />
- </path>
- </target>
-
- <target name="quickstart-specific-assemblies">
- <!-- Overriden from the target of the same name in base-build.xml. -->
- <!-- Called by the "deploy" target. Don't call directly!! -->
-
- <!-- Build the webservice... -->
- <war warfile="build/${ant.project.name}.war"
- webxml="${basedir}/war/resources/WEB-INF/web.xml">
- <fileset dir="${basedir}/war/view">
- <include name="**/*"/>
- </fileset>
- </war>
- </target>
-
- <target name="runtest" depends="compile" description="sends a JMS message to queue/quickstart_security_saml_gw">
- <echo>Runs Test JMS Sender</echo>
- <!--
- <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.securitysaml.test.SendMessage" failonerror="true">
- <arg value="01" />
- <arg value="8767" />
- <classpath refid="exec-classpath" />
- </java>
- -->
- <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.securitysaml.test.SendJMSMessage" failonerror="true">
- <arg value="queue/quickstart_security_saml_gw"/>
- <arg value="soap-request.xml"/>
- <classpath refid="exec-classpath"/>
- </java>
- </target>
-
- <!--target name="runtest" depends="compile" description="run tests over jms, http, and socket">
- <antcall target="saygoodbye_over_http" />
- </target-->
-
- <target name="saygoodbye_over_http" depends="compile">
- <echo></echo>
- <echo>Invoke JBR Gateway with successful login</echo>
- <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.securitysaml.test.SendMessage" failonerror="true">
- <arg value="01" />
- <arg value="8765" />
- <classpath refid="exec-classpath" />
- </java>
- <echo></echo>
- <echo></echo>
- <echo>Invoke JBR Gateway with unsuccessful login</echo>
- <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.securitysaml.test.SendMessage" failonerror="true">
- <arg value="02" />
- <arg value="8765" />
- <classpath refid="exec-classpath" />
- </java>
- </target>
-
- <target name="quickstart-specific-deploys">
- <copy todir="${build.dir}" filtering="true" overwrite="true">
-
- <filterset>
- <filter token="KEYSTORE_PATH" value="${basedir}/keystore"/>
- <filter token="ROLES_FILE_PATH" value="${basedir}/roles.properties"/>
- </filterset>
- <fileset dir="${basedir}">
- <include name="login-config.xml"/>
- </fileset>
- </copy>
- </target>
-
-
-</project>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/build.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/build.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/build.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/build.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,68 @@
+<project name="Quickstart_Security_Saml" default="deploy" basedir=".">
+
+ <description>
+ ${ant.project.name}
+ ${line.separator}
+ </description>
+
+ <!-- additional deploys -->
+ <property name="additional.deploys" value="jboss-wsse-client.xml, smooks/*.xml, jboss-sts-client.properties"/>
+
+ <target name="quickstart-specific-predeploys">
+ <copy file="${basedir}/jboss-sts.war" todir="${org.jboss.esb.server.deploy.dir}"/>
+ </target>
+
+ <target name="quickstart-specific-undeploys">
+ <delete file="${org.jboss.esb.server.deploy.dir}/jboss-sts.war"/>
+ </target>
+
+ <!-- Import the base Ant build script... -->
+ <import file="../conf/base-build.xml"/>
+
+ <target name="quickstart-specific-checks" depends="assert-ws-available"/>
+
+
+ <target name="quickstart-specific-dependencies">
+ <path id="quickstart-dependencies-classpath">
+ <fileset dir="${org.jboss.esb.server.home}/client" includes="jbossws-client.jar,jboss-remoting.jar" />
+ </path>
+ </target>
+
+ <target name="quickstart-specific-assemblies">
+ <!-- Overriden from the target of the same name in base-build.xml. -->
+ <!-- Called by the "deploy" target. Don't call directly!! -->
+
+ <!-- Build the webservice... -->
+ <war warfile="build/${ant.project.name}.war"
+ webxml="${basedir}/war/resources/WEB-INF/web.xml">
+ <fileset dir="${basedir}/war/view">
+ <include name="**/*"/>
+ </fileset>
+ </war>
+ </target>
+
+ <target name="runtest" depends="compile" description="sends a JMS message to queue/quickstart_security_saml_gw">
+ <echo>Runs Test JMS Sender</echo>
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.securitysaml.test.SendJMSMessage" failonerror="true">
+ <arg value="queue/quickstart_security_saml_gw"/>
+ <arg value="soap-request.xml"/>
+ <classpath refid="exec-classpath"/>
+ </java>
+ </target>
+
+ <target name="quickstart-specific-deploys">
+ <copy todir="${build.dir}" filtering="true" overwrite="true">
+
+ <filterset>
+ <filter token="KEYSTORE_PATH" value="${basedir}/keystore"/>
+ <filter token="ROLES_FILE_PATH" value="${basedir}/roles.properties"/>
+ <filter token="STS_CONFIG_FILE_PATH" value="${basedir}/jboss-sts-client.properties"/>
+ </filterset>
+ <fileset dir="${basedir}">
+ <include name="login-config.xml"/>
+ </fileset>
+ </copy>
+ </target>
+
+
+</project>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/deployment.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/deployment.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/deployment.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,7 +0,0 @@
-<jbossesb-deployment>
- <depends>jboss.esb:deployment=soap.esb</depends>
- <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_gw</depends>
- <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb</depends>
- <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb_reply</depends>
- <depends>jboss.web.deployment:war=/jboss-sts</depends>
-</jbossesb-deployment>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/deployment.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/deployment.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/deployment.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/deployment.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,6 @@
+<jbossesb-deployment>
+ <depends>jboss.esb:deployment=soap.esb</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_gw</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb_reply</depends>
+</jbossesb-deployment>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jbm-queue-service.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbm-queue-service.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_gw"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb_reply"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
-</server>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbm-queue-service.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jbm-queue-service.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbm-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbm-queue-service.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_gw"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb_reply"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jbmq-queue-service.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbmq-queue-service.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_gw">
- <depends optional-attribute-name="DestinationManager">
- jboss.mq:service=DestinationManager
- </depends>
- </mbean>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb">
- <depends optional-attribute-name="DestinationManager">
- jboss.mq:service=DestinationManager
- </depends>
- </mbean>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb_reply">
- <depends optional-attribute-name="DestinationManager">
- jboss.mq:service=DestinationManager
- </depends>
- </mbean>
-</server>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbmq-queue-service.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jbmq-queue-service.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbmq-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jbmq-queue-service.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_gw">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_security_saml_esb_reply">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+</server>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jboss-esb.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-esb.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,69 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb
- xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
- parameterReloadSecs="5">
-
- <providers>
- <jms-provider name="JBossMessageing" connection-factory="ConnectionFactory">
- <jms-bus busid="quickstartGatewayChannel">
- <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_security_saml_gw"/>
- </jms-bus>
- <jms-bus busid="quickstartEsbChannel">
- <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_security_saml_esb"/>
- </jms-bus>
- </jms-provider>
- </providers>
-
- <services>
-
- <service category="SamlSecurityQuickstart" name="unsecuredService" description="" invmScope="GLOBAL">
-
- <listeners>
- <jms-listener name="JMSGatewayListener" busidref="quickstartGatewayChannel" is-gateway="true"/>
- </listeners>
-
- <actions mep="OneWay">
-
- <action name="issueToken" class="org.jboss.soa.esb.actions.security.JBossSTSAction">
- <property name="serviceName" value="JBossSTS"/>
- <property name="portName" value="JBossSTSPort"/>
- <property name="endpointAddress" value="http://localhost:8080/jboss-sts/JBossSTS"/>
- <property name="username" value="admin"/>
- <property name="password" value="admin"/>
- <property name="tokenType" value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"/>
- <property name="addToEsbAuthRequest" value="true"/>
- </action>
-
- <action name="addSamlSecurityHeader" class="org.jboss.soa.esb.smooks.SmooksAction">
- <property name="smooksConfig" value="/smooks/smooks-saml-injector.xml" />
- </action>
-
- <action name="routeAction" class="org.jboss.soa.esb.actions.StaticRouter">
- <property name="destinations">
- <route-to service-category="SamlSecurityQuickstart" service-name="securedService"/>
- </property>
- </action>
-
- </actions>
- </service>
-
-
- <service category="SamlSecurityQuickstart" name="securedService" description="">
-
- <security moduleName="jbossesb-saml" callbackHandler="org.jboss.soa.esb.services.security.auth.login.JBossSTSCallbackHandler"/>
-
- <listeners>
- <jms-listener name="JMS-ESBListener" busidref="quickstartEsbChannel"/>
- </listeners>
- <actions mep="OneWay">
-
- <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
- <property name="jbossws-endpoint" value="GoodbyeWorldWS"/>
- </action>
-
- </actions>
- </service>
-
- </services>
-
-</jbossesb>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-esb.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jboss-esb.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-esb.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-esb.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,78 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb
+ xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
+ parameterReloadSecs="5">
+
+ <providers>
+ <jms-provider name="JBossMessageing" connection-factory="ConnectionFactory">
+ <jms-bus busid="quickstartGatewayChannel">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_security_saml_gw"/>
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_security_saml_esb"/>
+ </jms-bus>
+ </jms-provider>
+ </providers>
+
+ <services>
+
+ <service category="SamlSecurityQuickstart" name="issueTokenService"
+ invmScope="GLOBAL"
+ description="This service is used to demonstrate using the JBossSTSAction to request JBossSTS to issue a SAML Token for the user configured in jboss-sts-client.properites">
+
+ <listeners>
+ <jms-listener name="JMSGatewayListener" busidref="quickstartGatewayChannel" is-gateway="true"/>
+ </listeners>
+
+ <actions mep="OneWay">
+
+ <action name="issueToken" class="org.jboss.soa.esb.actions.security.JBossSTSAction">
+ <property name="configFile" value="jboss-sts-client.properties"/>
+ <!--property name="tokenType" value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"/-->
+ <property name="endpointURI" value="http://security_saml/goodbyeworld"/>
+ <property name="addToEsbAuthRequest" value="true"/>
+ </action>
+
+ <action name="addSamlSecurityHeader" class="org.jboss.soa.esb.smooks.SmooksAction">
+ <property name="smooksConfig" value="/smooks/smooks-saml-injector.xml" />
+ </action>
+
+ <action name="routeAction" class="org.jboss.soa.esb.actions.StaticRouter">
+ <property name="destinations">
+ <route-to service-category="SamlSecurityQuickstart" service-name="securedSamlService"/>
+ </property>
+ </action>
+
+ </actions>
+ </service>
+
+
+ <service category="SamlSecurityQuickstart" name="securedSamlService"
+ invmScope="GLOBAL"
+ description="This service is used to demonstrate that an ESB service can be configured using SAML Security.">
+ <security moduleName="jbossesb-saml" callbackHandler="org.jboss.soa.esb.services.security.auth.login.JBossSTSCallbackHandler"/>
+ <actions mep="OneWay">
+
+ <action name="routeAction" class="org.jboss.soa.esb.actions.StaticRouter">
+ <property name="destinations">
+ <route-to service-category="SamlSecurityQuickstart" service-name="unsecuredService"/>
+ </property>
+ </action>
+ </actions>
+ </service>
+
+ <service category="SamlSecurityQuickstart" name="unsecuredService"
+ invmScope="GLOBAL"
+ description="This service is used to demonstate calling a Web Service that has been configured for SAML Assertion validation using JBossSTS.">
+ <actions mep="OneWay">
+
+ <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
+ <property name="jbossws-endpoint" value="GoodbyeWorldWS"/>
+ </action>
+
+ </actions>
+ </service>
+
+ </services>
+
+</jbossesb>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-sts-client.properties (from rev 29481, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jboss-sts-client.properties)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-sts-client.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-sts-client.properties 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,5 @@
+serviceName=JBossSTS
+portName=JBossSTSPort
+endpointAddress=http://localhost:8080/jboss-sts/JBossSTS
+username=admin
+password=admin
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-sts.war
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-sts.war (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jboss-sts.war)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-wsse-client.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jboss-wsse-client.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-wsse-client.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
- <config>
- <username/>
- </config>
-</jboss-ws-security>
-
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-wsse-client.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jboss-wsse-client.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-wsse-client.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jboss-wsse-client.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
+ <config>
+ <username/>
+ </config>
+</jboss-ws-security>
+
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jndi.properties
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jndi.properties 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jndi.properties 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,5 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming
-java.naming.factory.url.pkgs=org.jnp.interfaces
-
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jndi.properties (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/jndi.properties)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jndi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/jndi.properties 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/login-config.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/login-config.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/login-config.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,24 +0,0 @@
- <!-- Copy+Paste *into* <server>/<configname>/conf/login-config.xml -->
-
- <application-policy name = "CertLogin">
- <authentication>
- <login-module code = "org.jboss.soa.esb.services.security.auth.login.CertificateLoginModule" flag = "required" >
- <module-option name = "keyStoreURL">file://@KEYSTORE_PATH@</module-option>
- <module-option name = "keyStorePassword">storepassword</module-option>
- <module-option name = "rolesPropertiesFile">file://@ROLES_FILE_PATH@</module-option>
- </login-module>
- </authentication>
- </application-policy>
-
- <application-policy name = "jbossesb-saml">
- <authentication>
- <login-module code="org.jboss.soa.esb.services.security.auth.login.JBossSTSLoginModule" flag="required">
- <module-option name="serviceName">JBossSTS</module-option>
- <module-option name="portName">JBossSTSPort</module-option>
- <module-option name="endpointAddress">http://localhost:8080/jboss-sts/JBossSTS</module-option>
- <module-option name="username">admin</module-option>
- <module-option name="password">admin</module-option>
- </login-module>
- </authentication>
- </application-policy>
-
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/login-config.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/login-config.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/login-config.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/login-config.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,9 @@
+ <!-- Copy&Paste *into* <server>/<configname>/conf/login-config.xml -->
+ <application-policy name = "jbossesb-saml">
+ <authentication>
+ <login-module code="org.jboss.soa.esb.services.security.auth.login.JBossSTSLoginModule" flag="required">
+ <module-option name="configFile">@STS_CONFIG_FILE_PATH@</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/readme.txt
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/readme.txt 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/readme.txt 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,33 +0,0 @@
-Overview:
-=========
- This quickstart demonstrates JBossESB support for SAML. The SAML support is provided by
- using JBoss Security Token Service (JBossSTS).
-
-
- The following will be demonstrated by this quickstart:
- * Configuring a service to use JBossSTSLoginModule to validate a SAML Assertion.
- In JBossESB a service may be configured to use the JBossSTSLoginModule. This JAAS Login Module
- expects the caller to have a SAML Assertion in its AuthenticationRequest.
-
- * Using the JBossSTSAction to request a SAML Assertion from JBossSTS
- This action would be used when a call to one or more internal or external
- service require a valid SAML Assertion. This would be called once and authentication
- would only be performed once.
-
-Running this quickstart:
-========================
- Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
- and a more detailed descripton of the different ways to run the quickstarts.
-
-To Run:
-===========================
- 1. Type 'ant deploy'.
- 2. Copy+Paste the contents of *build*/login-config.xml *into* <server>/<configname>/conf/login-config.xml
- 3. Deploy jboss-sts.war to the application server by copying it into the deploy directory.
- 4. Start the server.
- 5. 'ant runtest' will send a HTTP request to a JBossRemoting Gatway
- 6. 'ant sendesb' will invoke the Service directly using the ServiceInvoker
-
- # Please refer to the "Security" section of the ServiceGuide.pdf for more details on the security features of JBossESB.
-
-
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/readme.txt (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/readme.txt)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/readme.txt (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/readme.txt 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,46 @@
+Overview:
+=========
+ This quickstart demonstrates JBossESB support for SAML. The SAML support is provided by
+ using JBoss Security Token Service (JBossSTS).
+
+ The following will be demonstrated by this quickstart:
+ * Using the JBossSTSAction to isssue a SAML Assertion from JBossSTS
+ * Injecting the SAML Assertion into a SOAP Message
+ * Calling a second service in the esb that is secured using the JBossSTSLoginModule which will validate the security token.
+ * Using SOAPProcessor to invoke an externa Web Service that is secured by JBossSTS.
+
+ (Note that this quickstart only works with AS 5.1.0.GA or higher)
+
+Running this quickstart:
+========================
+ Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
+ and a more detailed descripton of the different ways to run the quickstarts.
+
+To Run:
+========================
+ 1. Type 'ant deploy'.
+ 2. Copy&Paste the contents of build/login-config.xml into <server>/<configname>/conf/login-config.xml
+ 3. Start the server.
+ 4. 'ant runtest' will send a HTTP request to a JBossRemoting Gatway
+
+ # Please refer to the "Security" section of the ServiceGuide.pdf for more details on the security features of JBossESB.
+
+
+Quickstart content
+==================
+# jboss-sts.war
+The JBossSTS.war is the JBoss Identity WS-Trust Security Token Service implementation.
+
+# jboss-sts-client.properties
+The configuration for the JBossSTSAction and JBossSTSLoginModule.
+
+# login-config.xml
+The JBoss security configuration fragment required for this quickstart. This will be filtered by Ant
+and the outputted login-config.xml content in the build directory should be compied into the servers
+login-config.xml
+
+# soap-request.xml
+The soap request sent to the esb.
+
+
+
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/smooks)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector-template.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector-template.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector-template.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
-
- <params>
- <param name="stream.filter.type">SAX</param>
- <param name="default.serialization.on">true</param>
- </params>
-
- <resource-config selector="@selector@" selector-namespace="@selectorNamespace@">
- <resource>org.jboss.soa.esb.services.security.auth.ws.SamlVisitor</resource>
- <param name="securityNS">@securityNamespace@</param>
- <param name="headerNS">@headerNamespace@</param>
- <param name="addXmlNS">@addXmlNs@</param>
- </resource-config>
-
-</smooks-resource-list>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector-template.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector-template.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector-template.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector-template.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
+
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ <param name="default.serialization.on">true</param>
+ </params>
+
+ <resource-config selector="@selector@" selector-namespace="@selectorNamespace@">
+ <resource>org.jboss.soa.esb.services.security.auth.ws.SamlVisitor</resource>
+ <param name="securityNS">@securityNamespace@</param>
+ <param name="headerNS">@headerNamespace@</param>
+ <param name="addXmlNS">@addXmlNs@</param>
+ </resource-config>
+
+</smooks-resource-list>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
-
- <import file="smooks-saml-injector-template.xml">
- <param name="selector">/Envelope/Header/Security</param>
- <param name="selectorNamespace">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</param>
- <param name="securityNamespace">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</param>
- <param name="headerNamespace">http://schemas.xmlsoap.org/soap/envelope/</param>
- </import>
-
- <import file="smooks-saml-injector-template.xml">
- <param name="selector">/Envelope/Header</param>
- <param name="selectorNamespace">http://schemas.xmlsoap.org/soap/envelope/</param>
- <param name="securityNamespace">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</param>
- <param name="headerNamespace">http://schemas.xmlsoap.org/soap/envelope/</param>
- <param name="addXmlNs">false</param>
- </import>
-
-</smooks-resource-list>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/smooks/smooks-saml-injector.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
+
+ <import file="smooks-saml-injector-template.xml">
+ <param name="selector">/Envelope/Header/Security</param>
+ <param name="selectorNamespace">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</param>
+ <param name="securityNamespace">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</param>
+ <param name="headerNamespace">http://schemas.xmlsoap.org/soap/envelope/</param>
+ </import>
+
+ <import file="smooks-saml-injector-template.xml">
+ <param name="selector">/Envelope/Header</param>
+ <param name="selectorNamespace">http://schemas.xmlsoap.org/soap/envelope/</param>
+ <param name="securityNamespace">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</param>
+ <param name="headerNamespace">http://schemas.xmlsoap.org/soap/envelope/</param>
+ <param name="addXmlNs">false</param>
+ </import>
+
+</smooks-resource-list>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/soap-request.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/soap-request.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/soap-request.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,9 +0,0 @@
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:good="http://security_saml/goodbyeworld" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
- <soapenv:Header>
- </soapenv:Header>
- <soapenv:Body>
- <good:sayGoodbye>
- <message>Goodbye!!</message>
- </good:sayGoodbye>
- </soapenv:Body>
-</soapenv:Envelope>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/soap-request.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/soap-request.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/soap-request.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/soap-request.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,9 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:good="http://security_saml/goodbyeworld" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
+ <soapenv:Header>
+ </soapenv:Header>
+ <soapenv:Body>
+ <good:sayGoodbye>
+ <message>Goodbye!!</message>
+ </good:sayGoodbye>
+ </soapenv:Body>
+</soapenv:Envelope>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/SendJMSMessage.java 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/SendJMSMessage.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package org.jboss.soa.esb.samples.quickstart.securitysaml.test;
-
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.Client;
-
-import javax.jms.JMSException;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.net.InetAddress;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-
-import org.jboss.soa.esb.actions.StoreMessageToFile;
-
-public class SendJMSMessage {
- QueueConnection conn;
- QueueSession session;
- Queue que;
-
- public void sendMessageOverJMS(String message, String destination) throws JMSException, NamingException {
- QueueSender sender = null;
-
- setupJMSConnection(destination);
- try {
- ObjectMessage tm = null;
-
- sender = session.createSender(que);
- tm = session.createObjectMessage(message);
- tm.setStringProperty(StoreMessageToFile.PROPERTY_JBESB_FILENAME, "SecuritySamlTest.log");
- sender.send(tm);
- } finally {
- if(sender != null) {
- sender.close();
- }
- cleanupJMSConnection();
- }
- }
-
- public void setupJMSConnection(final String destination) throws JMSException, NamingException
- {
- InitialContext iniCtx = new InitialContext();
- Object tmp = iniCtx.lookup("ConnectionFactory");
- QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
- conn = qcf.createQueueConnection();
- que = (Queue) iniCtx.lookup(destination);
- session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
- conn.start();
- }
-
- public void cleanupJMSConnection() throws JMSException
- {
- conn.stop();
- session.close();
- conn.close();
- }
-
- public static void main(String... args) throws Throwable
- {
- SendJMSMessage sm = new SendJMSMessage();
- String destination = args[0];
- String payload = StreamUtils.getResourceAsString(args[1], "UTF-8");
-
- try
- {
- sm.sendMessageOverJMS(payload, destination);
- }
- catch(final Exception e)
- {
- System.err.println("Call was not successful. See server.log for details. Exception was:");
- e.printStackTrace();
- }
- }
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/SendJMSMessage.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/SendJMSMessage.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/SendJMSMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/test/SendJMSMessage.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.securitysaml.test;
+
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Client;
+
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.net.InetAddress;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+
+import org.jboss.soa.esb.actions.StoreMessageToFile;
+
+public class SendJMSMessage {
+ QueueConnection conn;
+ QueueSession session;
+ Queue que;
+
+ public void sendMessageOverJMS(String message, String destination) throws JMSException, NamingException {
+ QueueSender sender = null;
+
+ setupJMSConnection(destination);
+ try {
+ ObjectMessage tm = null;
+
+ sender = session.createSender(que);
+ tm = session.createObjectMessage(message);
+ tm.setStringProperty(StoreMessageToFile.PROPERTY_JBESB_FILENAME, "SecuritySamlTest.log");
+ sender.send(tm);
+ } finally {
+ if(sender != null) {
+ sender.close();
+ }
+ cleanupJMSConnection();
+ }
+ }
+
+ public void setupJMSConnection(final String destination) throws JMSException, NamingException
+ {
+ InitialContext iniCtx = new InitialContext();
+ Object tmp = iniCtx.lookup("ConnectionFactory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+ conn = qcf.createQueueConnection();
+ que = (Queue) iniCtx.lookup(destination);
+ session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ conn.start();
+ }
+
+ public void cleanupJMSConnection() throws JMSException
+ {
+ conn.stop();
+ session.close();
+ conn.close();
+ }
+
+ public static void main(String... args) throws Throwable
+ {
+ SendJMSMessage sm = new SendJMSMessage();
+ String destination = args[0];
+ String payload = StreamUtils.getResourceAsString(args[1], "UTF-8");
+
+ try
+ {
+ sm.sendMessageOverJMS(payload, destination);
+ }
+ catch(final Exception e)
+ {
+ System.err.println("Call was not successful. See server.log for details. Exception was:");
+ e.printStackTrace();
+ }
+ }
+}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/GoodbyeWorldWS.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/GoodbyeWorldWS.java 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/GoodbyeWorldWS.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,56 +0,0 @@
-package org.jboss.soa.esb.samples.quickstart.securitysaml.webservice;
-
-import javax.jws.WebService;
-import javax.jws.WebMethod;
-import javax.jws.Oneway;
-import javax.jws.WebParam;
-import javax.jws.HandlerChain;
-import javax.jws.soap.SOAPBinding;
-
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.actions.soap.SOAPProcessor;
-
-/**
- * @author
- */
- at HandlerChain(file="handlerchain.xml")
- at WebService(name = "GoodbyeWorldWS", targetNamespace="http://security_saml/goodbyeworld")
-public class GoodbyeWorldWS {
-
- @WebMethod
- public String sayGoodbye(@WebParam(name="message") String message) {
-
- Message esbMessage = SOAPProcessor.getMessage();
- if(esbMessage != null) {
- System.out.println("**** SOAPRequest perhaps mediated by ESB:\n" + esbMessage.getBody().get());
- // System.out.println("\n" + esbMessage.toString() + "\n");
- }
- System.out.println("Web Service Parameter - message=" + message);
- return "... Ah Goodbye then!!!! - " + message;
- }
-
- @WebMethod
- public String sayAdios(String message) {
- Message esbMessage = SOAPProcessor.getMessage();
- if(esbMessage != null) {
- System.out.println("**** SOAPRequest perhaps mediated by ESB:\n" + esbMessage.getBody().get());
- // System.out.println("\n" + esbMessage.toString() + "\n");
- }
- System.out.println("Web Service Parameter - message=" + message);
- return "... Adios Amigo!!!! - " + message;
- }
-
- @WebMethod
- @Oneway
- public void sayGoodbyeWithoutResponse(@WebParam(name="message") String message) {
-
- Message esbMessage = SOAPProcessor.getMessage();
- if(esbMessage != null) {
- System.out.println("**** SOAPRequest perhaps mediated by ESB:\n" + esbMessage.getBody().get());
- }
- System.out.println("Web Service Parameter - message=" + message);
- }
-
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/GoodbyeWorldWS.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/GoodbyeWorldWS.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/GoodbyeWorldWS.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/GoodbyeWorldWS.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,48 @@
+package org.jboss.soa.esb.samples.quickstart.securitysaml.webservice;
+
+import javax.jws.WebService;
+import javax.jws.WebMethod;
+import javax.jws.Oneway;
+import javax.jws.WebParam;
+import javax.jws.HandlerChain;
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.actions.ActionUtils;
+import org.jboss.soa.esb.actions.soap.SOAPProcessor;
+
+ at HandlerChain(file="handlerchain.xml")
+ at WebService(name = "GoodbyeWorldWS", targetNamespace="http://security_saml/goodbyeworld")
+public class GoodbyeWorldWS {
+
+ @WebMethod
+ public String sayGoodbye(@WebParam(name="message") String message) {
+ Message esbMessage = SOAPProcessor.getMessage();
+ System.out.println("Succesfully invoked WS!");
+ System.out.println("SOAPRequest perhaps mediated by ESB:\n" + esbMessage.getBody().get());
+ return "... Ah Goodbye then!!!! - " + message;
+ }
+
+ @WebMethod
+ public String sayAdios(String message) {
+ Message esbMessage = SOAPProcessor.getMessage();
+ if(esbMessage != null) {
+ System.out.println("**** SOAPRequest perhaps mediated by ESB:\n" + esbMessage.getBody().get());
+ }
+ System.out.println("Web Service Parameter - message=" + message);
+ return "... Adios Amigo!!!! - " + message;
+ }
+
+ @WebMethod
+ @Oneway
+ public void sayGoodbyeWithoutResponse(@WebParam(name="message") String message) {
+
+ Message esbMessage = SOAPProcessor.getMessage();
+ if(esbMessage != null) {
+ System.out.println("**** SOAPRequest perhaps mediated by ESB:\n" + esbMessage.getBody().get());
+ }
+ System.out.println("Web Service Parameter - message=" + message);
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/handlerchain.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/handlerchain.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/handlerchain.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jws:handler-config xmlns:jws="http://java.sun.com/xml/ns/javaee">
- <jws:handler-chains>
- <jws:handler-chain>
- <jws:handler>
- <jws:handler-class>org.jboss.soa.esb.services.security.auth.ws.JBossSTSSecurityHandler</jws:handler-class>
- </jws:handler>
- </jws:handler-chain>
- </jws:handler-chains>
-</jws:handler-config>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/handlerchain.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/handlerchain.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/handlerchain.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/src/org/jboss/soa/esb/samples/quickstart/securitysaml/webservice/handlerchain.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jws:handler-config xmlns:jws="http://java.sun.com/xml/ns/javaee">
+ <jws:handler-chains>
+ <jws:handler-chain>
+ <jws:handler>
+ <jws:handler-class>org.jboss.identity.federation.core.wstrust.handlers.STSSaml20Handler</jws:handler-class>
+ </jws:handler>
+ </jws:handler-chain>
+ </jws:handler-chains>
+</jws:handler-config>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/war)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/war/resources)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/WEB-INF (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/war/resources/WEB-INF)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/WEB-INF/web.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/war/resources/WEB-INF/web.xml 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/WEB-INF/web.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
-
- <servlet>
- <servlet-name>GoodbyeWorldWS</servlet-name>
- <servlet-class>org.jboss.soa.esb.samples.quickstart.securitysaml.webservice.GoodbyeWorldWS</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>GoodbyeWorldWS</servlet-name>
- <url-pattern>/GoodbyeWorldWS</url-pattern>
- </servlet-mapping>
-
-</web-app>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/WEB-INF/web.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/war/resources/WEB-INF/web.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/WEB-INF/web.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/resources/WEB-INF/web.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>GoodbyeWorldWS</servlet-name>
+ <servlet-class>org.jboss.soa.esb.samples.quickstart.securitysaml.webservice.GoodbyeWorldWS</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>GoodbyeWorldWS</servlet-name>
+ <url-pattern>/GoodbyeWorldWS</url-pattern>
+ </servlet-mapping>
+
+ <env-entry>
+ <env-entry-name>STSClientConfig</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>/jboss-sts-client.properties</env-entry-value>
+ </env-entry>
+
+</web-app>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/view (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/war/view)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/view/index.jsp
===================================================================
--- labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/war/view/index.jsp 2009-09-17 12:42:49 UTC (rev 29393)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/view/index.jsp 2009-10-13 04:38:56 UTC (rev 29585)
@@ -1,9 +0,0 @@
-<html>
- <body>
- This is just a place holder.<br>
- Verify the that the WS has been deployed by hitting
- <a href="http://localhost:8080/jbossws">
- http://localhost:8080/jbossws
- </a>
- </body>
-</html>
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/view/index.jsp (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/samples/quickstarts/security_saml/war/view/index.jsp)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/view/index.jsp (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/security_saml/war/view/index.jsp 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,9 @@
+<html>
+ <body>
+ This is just a place holder.<br>
+ Verify the that the WS has been deployed by hitting
+ <a href="http://localhost:8080/jbossws">
+ http://localhost:8080/jbossws
+ </a>
+ </body>
+</html>
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/services/base-project-build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/base-project-build.xml 2009-10-12 19:56:25 UTC (rev 29584)
+++ labs/jbossesb/trunk/product/services/base-project-build.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -38,6 +38,7 @@
<fileset dir="${esb.main.lib}" includes="jboss-system-4.2.2.GA.jar" />
<fileset dir="lib/ext" includes="*.jar" />
<fileset dir="lib/ext/build-time" includes="*.jar" />
+ <fileset dir="${esb.product.lib.ext}/endorsed" includes="jboss-saaj.jar" />
<fileset dir="${esb.product.lib.dir}" includes="*.jar" /> <!-- Product Jars. -->
<fileset dir="${esb.product.lib.ext}" includes="*.jar" />
<fileset dir="${esb.main.lib}" includes="*.jar" />
Copied: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandler.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandler.java)
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandler.java (rev 0)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandler.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions.soap;
+
+import java.io.IOException;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.soa.esb.services.security.auth.login.SamlContext;
+import org.jboss.soa.esb.services.security.auth.login.SamlCredential;
+import org.w3c.dom.Element;
+
+/**
+ * SOAPSamlHandler is a SOAP Protocol Handler that will add a security header to
+ * all outgoing messages if a SamlPrincipal has been set using the
+ * {@link SamlContext}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class SOAPSamlHandler implements SOAPHandler<SOAPMessageContext>
+{
+ public final static String WSSE_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+ QName securityQName = new QName(SOAPSamlHandler.WSSE_NS, "Security");
+
+ public boolean handleMessage(final SOAPMessageContext soapContext)
+ {
+ final Boolean outBound = (Boolean) soapContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ if (outBound.booleanValue())
+ return true;
+
+ try
+ {
+ final SamlCredential samlPrincipal = SamlContext.getContext();
+ if (samlPrincipal != null)
+ {
+ final Element assertionElement = samlPrincipal.getAssertionElement();
+ SOAPSamlHandlerUtil.addAssertion(soapContext, securityQName, assertionElement);
+ }
+ }
+ catch (final SOAPException e)
+ {
+ throw new WebServiceException(e.getMessage(), e);
+ }
+ catch (IOException e)
+ {
+ throw new WebServiceException(e.getMessage(), e);
+ }
+
+ return true;
+ }
+
+ public Set<QName> getHeaders()
+ {
+ return null;
+ }
+
+ public void close(final MessageContext messageContext)
+ {
+ }
+
+ public boolean handleFault(final SOAPMessageContext soapContext)
+ {
+ return false;
+ }
+
+}
Copied: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandlerUtil.java (from rev 29481, labs/jbossesb/workspace/dbevenius/saml_support/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandlerUtil.java)
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandlerUtil.java (rev 0)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandlerUtil.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions.soap;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.w3c.dom.Element;
+
+/**
+ * Util methods for handling SAML related tasks for SOAP Protocol Handlers.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class SOAPSamlHandlerUtil
+{
+ private static final SOAPFactory SOAP_FACTORY = createSOAPFactory();
+
+ private SOAPSamlHandlerUtil()
+ {
+ }
+
+ public static SOAPElement addAssertion(final SOAPMessageContext soapContext, final QName securityHeader, final Element assertion) throws SOAPException
+ {
+ AssertArgument.isNotNull(soapContext, "soapContext");
+ AssertArgument.isNotNull(assertion, "assertion");
+
+ final SOAPEnvelope envelope = soapContext.getMessage().getSOAPPart().getEnvelope();
+ SOAPHeader header = envelope.getHeader();
+ if (header == null)
+ {
+ header = envelope.addHeader();
+ }
+ final SOAPElement securityElement = header.addChildElement(securityHeader);
+ // Add the assertion element.
+ return securityElement.addChildElement(SOAP_FACTORY.createElement(assertion));
+ }
+
+ private static SOAPFactory createSOAPFactory()
+ {
+ try
+ {
+ return SOAPFactory.newInstance();
+ }
+ catch (final SOAPException e)
+ {
+ throw new IllegalStateException(e.getMessage(), e);
+ }
+ }
+
+}
Copied: labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandlerUnitTest.java (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandlerUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandlerUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/SOAPSamlHandlerUnitTest.java 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions.soap;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.util.XMLHelper;
+import org.jboss.soa.esb.services.security.auth.login.SamlContext;
+import org.jboss.soa.esb.services.security.auth.login.SamlCredential;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link SOAPSamlHandler}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class SOAPSamlHandlerUnitTest
+{
+ private QName assertionQName = new QName("urn:oasis:names:tc:SAML:2.0:assertion", "Assertion");
+
+ @Test
+ public void handleMessage() throws Exception
+ {
+ final SOAPSamlHandler handler = new SOAPSamlHandler();
+ final SOAPMessageContext messageContext = mock(SOAPMessageContext.class);
+ final SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
+
+ when(messageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)).thenReturn(true);
+ when(messageContext.getMessage()).thenReturn(soapMessage);
+
+ SamlCredential samlPrincipal = new SamlCredential(StreamUtils.readStreamString(getClass().getResourceAsStream("assertion.xml"), "UTF-8"));
+ SamlContext.setContext(samlPrincipal);
+
+ boolean result = handler.handleMessage(messageContext);
+ assertTrue(result);
+
+ final SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
+ final Iterator<SOAPElement> securityHeaders = envelope.getHeader().getChildElements(new QName("Security", "wsse", SOAPSamlHandler.WSSE_NS));
+
+ while (securityHeaders.hasNext())
+ {
+ final SOAPElement securityElement = securityHeaders.next();
+ final Iterator<SOAPElement> assertions = securityElement.getChildElements(assertionQName);
+ while (assertions.hasNext())
+ {
+ final SOAPElement assertionElement = assertions.next();
+ final String expected = samlPrincipal.getAssertion();
+ final String actual = SamlCredential.assertionToString(assertionElement);
+ assertTrue(XMLHelper.compareXMLContent(expected, actual));
+ }
+ }
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(SOAPSamlHandlerUnitTest.class);
+ }
+
+}
Copied: labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/assertion.xml (from rev 29393, labs/jbossesb/workspace/dbevenius/saml_support/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/assertion.xml)
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/assertion.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/assertion.xml 2009-10-13 04:38:56 UTC (rev 29585)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ID="ID_74414f7f-1339-4f80-b29a-c947d9177445" IssueInstant="2009-09-10T13:49:30.422Z" Version="2.0">
+ <Issuer>JBossSTS</Issuer>
+ <Subject>
+ <NameID NameQualifier="urn:jboss:identity-federation">beve</NameID>
+ <SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
+ </Subject>
+ <Conditions NotBefore="2009-09-10T13:49:30.422Z" NotOnOrAfter="2009-09-10T15:49:30.422Z"/>
+ <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:SignedInfo><dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ <dsig:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ <dsig:Reference URI="#ID_74414f7f-1339-4f80-b29a-c947d9177445" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:Transforms xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ </dsig:Transforms>
+ <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
+ <dsig:DigestValue xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">so9bv09wxSnauPiq6iC2zs6ubrQ=</dsig:DigestValue>
+ </dsig:Reference>
+ </dsig:SignedInfo>
+ <dsig:SignatureValue>Lf4DYODLtVxSVmd23HJzHTy61ZYDnpaJRTVbRLR2i2zU7v9mskYCVbXY8gm5PYY2V+iYvi+dJ3QlWP9dQu+DHK9rVJSGxSmzfPjrnMC84HH9j2BZBEdKVCpNCAFJQRL+E1jlRB194sjCiuxoMnlR927uMiNcHJRoBSi03kP5tOw=</dsig:SignatureValue>
+ <dsig:KeyInfo>
+ <dsig:KeyValue xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:RSAKeyValue xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+ <dsig:Modulus xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">suGIyhVTbFvDwZdx8Av62zmP+aGOlsBN8WUE3eEEcDtOIZgO78SImMQGwB2C0eIVMhiLRzVPqoW1dCPAveTm653zHOmubaps1fY0lLJDSZbTbhjeYhoQmmaBro/tDpVw5lKJns2qVnMuRK19ju2dxpKwlYGGtrP5VQv00dfNPbs=
+ </dsig:Modulus>
+ <dsig:Exponent xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">AQAB</dsig:Exponent>
+ </dsig:RSAKeyValue>
+ </dsig:KeyValue>
+ </dsig:KeyInfo>
+ </dsig:Signature>
+</Assertion>
Added: labs/jbossesb/trunk/testlib/mockito-all-1.8.0.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/testlib/mockito-all-1.8.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the jboss-svn-commits
mailing list