Author: alessio.soldano(a)jboss.com
Date: 2012-09-11 12:35:26 -0400 (Tue, 11 Sep 2012)
New Revision: 16709
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SamlCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2312Impl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2313Impl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples23xTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService23x.wsdl
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
Log:
[JBWS-3405] Adding some WS-SecurityPolicy Examples 1.0 2.3.x testcases (SAML 1.1 Bearer,
Sender-Vouches, Holder-of-Key)
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2012-09-11
16:04:36 UTC (rev 16708)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2012-09-11
16:35:26 UTC (rev 16709)
@@ -166,6 +166,28 @@
</manifest>
</war>
+ <!-- jaxws-samples-wsse-policy-oasis-23x -->
+ <war
+
warfile="${tests.output.dir}/test-libs/jaxws-samples-wsse-policy-oasis-23x.war"
needxmlfile='false'>
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/ServiceIface.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service23*Impl.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/wsse/policy/jaxws/Say*.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/KeystorePasswordCallback.class"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/oasis/WEB-INF">
+ <include name="wsdl/*.xsd"/>
+ <include name="wsdl/SecurityService23x.wsdl"/>
+ </webinf>
+ <zipfileset
dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/oasis/WEB-INF"
prefix="WEB-INF/classes">
+ <include name="bob.jks" />
+ <include name="bob.properties" />
+ </zipfileset>
+ <manifest>
+ <attribute name="Dependencies"
value="org.apache.ws.security,org.apache.cxf"/>
+ </manifest>
+ </war>
+
<!-- jaxws-samples-wsse-policy-oasis-client -->
<jar
destfile="${tests.output.dir}/test-libs/jaxws-samples-wsse-policy-oasis-client.jar">
<metainf
dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/oasis/META-INF">
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SamlCallbackHandler.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SamlCallbackHandler.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SamlCallbackHandler.java 2012-09-11
16:35:26 UTC (rev 16709)
@@ -0,0 +1,122 @@
+package org.jboss.test.ws.jaxws.samples.wsse.policy.oasis;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.cert.X509Certificate;
+import java.util.Collections;
+import java.util.Properties;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.components.crypto.Crypto;
+import org.apache.ws.security.components.crypto.CryptoFactory;
+import org.apache.ws.security.components.crypto.CryptoType;
+import org.apache.ws.security.saml.ext.SAMLCallback;
+import org.apache.ws.security.saml.ext.bean.AttributeBean;
+import org.apache.ws.security.saml.ext.bean.AttributeStatementBean;
+import org.apache.ws.security.saml.ext.bean.KeyInfoBean;
+import org.apache.ws.security.saml.ext.bean.KeyInfoBean.CERT_IDENTIFIER;
+import org.apache.ws.security.saml.ext.bean.SubjectBean;
+import org.apache.ws.security.saml.ext.builder.SAML1Constants;
+import org.apache.ws.security.saml.ext.builder.SAML2Constants;
+import org.opensaml.common.SAMLVersion;
+
+public class SamlCallbackHandler implements CallbackHandler
+{
+ private String confirmationMethod = SAML2Constants.CONF_BEARER;
+
+ private boolean saml2;
+
+ public SamlCallbackHandler()
+ {
+ }
+
+ public void setConfirmationMethod(String confirmationMethod)
+ {
+ this.confirmationMethod = confirmationMethod;
+ }
+
+ public void setSaml2(boolean isSaml2)
+ {
+ saml2 = isSaml2;
+ }
+
+ public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException
+ {
+ for (int i = 0; i < callbacks.length; i++)
+ {
+ if (callbacks[i] instanceof SAMLCallback)
+ {
+ SAMLCallback callback = (SAMLCallback) callbacks[i];
+ if (saml2)
+ {
+ callback.setSamlVersion(SAMLVersion.VERSION_20);
+ }
+ callback.setIssuer("sts");
+ String subjectName = "uid=sts-client,o=jbws-cxf-sts.com";
+ String subjectQualifier = "www.jbws-cxf-sts.org";
+
+ SubjectBean subjectBean = new SubjectBean(subjectName, subjectQualifier,
confirmationMethod);
+ if (SAML2Constants.CONF_HOLDER_KEY.equals(confirmationMethod)
+ || SAML1Constants.CONF_HOLDER_KEY.equals(confirmationMethod))
+ {
+ try
+ {
+ KeyInfoBean keyInfo = createKeyInfo();
+ subjectBean.setKeyInfo(keyInfo);
+ }
+ catch (Exception ex)
+ {
+ throw new IOException("Problem creating KeyInfo: " +
ex.getMessage());
+ }
+ }
+
+ callback.setSubject(subjectBean);
+
+ AttributeStatementBean attrBean = new AttributeStatementBean();
+ attrBean.setSubject(subjectBean);
+
+ AttributeBean attributeBean = new AttributeBean();
+ if (saml2)
+ {
+ attributeBean.setQualifiedName("subject-role");
+ }
+ else
+ {
+ attributeBean.setSimpleName("subject-role");
+ attributeBean.setQualifiedName("http://custom-ns");
+ }
+
attributeBean.setAttributeValues(Collections.singletonList("system-user"));
+ attrBean.setSamlAttributes(Collections.singletonList(attributeBean));
+ callback.setAttributeStatementData(Collections.singletonList(attrBean));
+ }
+ }
+ }
+
+ protected KeyInfoBean createKeyInfo() throws Exception
+ {
+ InputStream is =
Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties").openStream();
+ Properties props = new Properties();
+ try
+ {
+ props.load(is);
+ }
+ finally
+ {
+ is.close();
+ }
+ Crypto crypto = CryptoFactory.getInstance(props);
+ CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
+ cryptoType.setAlias("alice");
+ X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
+
+ KeyInfoBean keyInfo = new KeyInfoBean();
+ keyInfo.setCertificate(certs[0]);
+ keyInfo.setCertIdentifer(CERT_IDENTIFIER.X509_CERT);
+
+ return keyInfo;
+ }
+
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java 2012-09-11
16:35:26 UTC (rev 16709)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.ws.jaxws.samples.wsse.policy.oasis;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+import org.jboss.ws.api.annotation.WebContext;
+
+@WebService
+(
+ portName = "SecurityService2311Port",
+ serviceName = "SecurityService",
+ wsdlLocation = "WEB-INF/wsdl/SecurityService23x.wsdl",
+ targetNamespace =
"http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy/oasis-samples",
+ endpointInterface =
"org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServiceIface"
+)
+@Stateless
+@WebContext(urlPattern = "SecurityService2311")
+public class Service2311Impl implements ServiceIface
+{
+ public String sayHello()
+ {
+ return "Hello - (WSS1.0) SAML1.1 Assertion (Bearer)";
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2312Impl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2312Impl.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2312Impl.java 2012-09-11
16:35:26 UTC (rev 16709)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.ws.jaxws.samples.wsse.policy.oasis;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+import org.jboss.ws.api.annotation.WebContext;
+
+@WebService
+(
+ portName = "SecurityService2312Port",
+ serviceName = "SecurityService",
+ wsdlLocation = "WEB-INF/wsdl/SecurityService23x.wsdl",
+ targetNamespace =
"http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy/oasis-samples",
+ endpointInterface =
"org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServiceIface"
+)
+@Stateless
+@WebContext(urlPattern = "SecurityService2312",
transportGuarantee="CONFIDENTIAL")
+public class Service2312Impl implements ServiceIface
+{
+ public String sayHello()
+ {
+ return "Hello - (WSS1.0) SAML1.1 Assertion (Sender Vouches) over SSL";
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2313Impl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2313Impl.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2313Impl.java 2012-09-11
16:35:26 UTC (rev 16709)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.ws.jaxws.samples.wsse.policy.oasis;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
+import org.jboss.ws.api.annotation.WebContext;
+
+@WebService
+(
+ portName = "SecurityService2313Port",
+ serviceName = "SecurityService",
+ wsdlLocation = "WEB-INF/wsdl/SecurityService23x.wsdl",
+ targetNamespace =
"http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy/oasis-samples",
+ endpointInterface =
"org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServiceIface"
+)
+@EndpointProperties(value = {
+ @EndpointProperty(key = "ws-security.signature.properties", value =
"bob.properties"),
+ @EndpointProperty(key = "ws-security.signature.username", value =
"bob"),
+ @EndpointProperty(key = "ws-security.callback-handler", value =
"org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.KeystorePasswordCallback")
+ }
+)
+@Stateless
+@WebContext(urlPattern = "SecurityService2313",
transportGuarantee="CONFIDENTIAL")
+public class Service2313Impl implements ServiceIface
+{
+ public String sayHello()
+ {
+ return "Hello - (WSS1.0) SAML1.1 Assertion (HK) over SSL";
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples23xTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples23xTestCase.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples23xTestCase.java 2012-09-11
16:35:26 UTC (rev 16709)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.ws.jaxws.samples.wsse.policy.oasis;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.wsf.test.JBossWSTest;
+
+/**
+ * WS-Security Policy examples
+ *
+ * From OASIS WS-SecurityPolicy Examples Version 1.0
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 10-Sep-2012
+ */
+public final class WSSecurityPolicyExamples23xTestCase extends JBossWSTest
+{
+ private final String NS =
"http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy/oasis-samples";
+ private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-oasis-23x/";
+ private final QName serviceName = new QName(NS, "SecurityService");
+
+ public static Test suite()
+ {
+ /** System properties - currently set at testsuite start time
+ System.setProperty("javax.net.ssl.trustStore",
"my.truststore");
+ System.setProperty("javax.net.ssl.trustStorePassword",
"changeit");
+ System.setProperty("javax.net.ssl.trustStoreType", "jks");
+ System.setProperty("javax.net.ssl.keyStore", "my.keystore");
+ System.setProperty("javax.net.ssl.keyStorePassword",
"changeit");
+ System.setProperty("javax.net.ssl.keyStoreType", "jks");
+ System.setProperty("org.jboss.security.ignoreHttpsHost",
"true");
+ */
+ JBossWSCXFTestSetup setup = new
JBossWSCXFTestSetup(WSSecurityPolicyExamples23xTestCase.class,
+
"jaxws-samples-wsse-policy-oasis-23x.war,jaxws-samples-wsse-policy-oasis-client.jar");
+ Map<String, String> sslOptions = new HashMap<String, String>();
+ sslOptions.put("certificate-key-file",
System.getProperty("org.jboss.ws.testsuite.server.keystore"));
+ sslOptions.put("password", "changeit");
+ sslOptions.put("verify-client", "true"); //enable SSL mutual
authentication (https client cert is checked on server side)
+ sslOptions.put("key-alias", "tomcat");
+ sslOptions.put("ca-certificate-file",
System.getProperty("org.jboss.ws.testsuite.server.truststore"));
+ sslOptions.put("ca-certificate-password", "changeit");
+ setup.setHttpsConnectorRequirement(sslOptions);
+ return setup;
+ }
+
+ /**
+ * 2.3.1.1 (WSS1.0) SAML1.1 Assertion (Bearer)
+ *
+ * @throws Exception
+ */
+ public void test2311() throws Exception
+ {
+ Service service = Service.create(new URL(serviceURL +
"SecurityService2311?wsdl"), serviceName);
+ ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS,
"SecurityService2311Port"), ServiceIface.class);
+
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SAML_CALLBACK_HANDLER,
new SamlCallbackHandler());
+ assertTrue(proxy.sayHello().equals("Hello - (WSS1.0) SAML1.1 Assertion
(Bearer)"));
+ }
+
+ /**
+ * 2.3.1.2 (WSS1.0) SAML1.1 Assertion (Sender Vouches) over SSL
+ *
+ * @throws Exception
+ */
+ public void test2312() throws Exception
+ {
+ Service service = Service.create(new URL(serviceURL +
"SecurityService2312?wsdl"), serviceName);
+ ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS,
"SecurityService2312Port"), ServiceIface.class);
+ SamlCallbackHandler cbh = new SamlCallbackHandler();
+
cbh.setConfirmationMethod("urn:oasis:names:tc:SAML:1.0:cm:sender-vouches");
+
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SAML_CALLBACK_HANDLER,
cbh);
+ assertTrue(proxy.sayHello().equals("Hello - (WSS1.0) SAML1.1 Assertion (Sender
Vouches) over SSL"));
+ }
+
+ /**
+ * 2.3.1.3 (WSS1.0) SAML1.1 Assertion (HK) over SSL
+ *
+ * @throws Exception
+ */
+ public void test2313() throws Exception
+ {
+ Service service = Service.create(new URL(serviceURL +
"SecurityService2313?wsdl"), serviceName);
+ ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS,
"SecurityService2313Port"), ServiceIface.class);
+ SamlCallbackHandler cbh = new SamlCallbackHandler();
+
cbh.setConfirmationMethod("urn:oasis:names:tc:SAML:1.0:cm:holder-of-key");
+ ((BindingProvider)
proxy).getRequestContext().put(SecurityConstants.SAML_CALLBACK_HANDLER, cbh);
+ ((BindingProvider)
proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
+
Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
+
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME,
"alice");
+
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new
KeystorePasswordCallback());
+
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SELF_SIGN_SAML_ASSERTION,
"true");
+ assertTrue(proxy.sayHello().equals("Hello - (WSS1.0) SAML1.1 Assertion (HK)
over SSL"));
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService23x.wsdl
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService23x.wsdl
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService23x.wsdl 2012-09-11
16:35:26 UTC (rev 16709)
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="SecurityService"
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+
xmlns:tns="http://www.jboss.org/jbossws/ws-extensions/wssecuritypoli...
+
xmlns:wsp="http://www.w3.org/ns/ws-policy"
+
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-w...
+
xmlns:wsaws="http://www.w3.org/2005/08/addressing"
+
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy&...
+
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702&...
+
targetNamespace="http://www.jboss.org/jbossws/ws-extensions/wssecuri...
+ <wsdl:types>
+ <xsd:schema>
+ <xsd:import
namespace="http://www.jboss.org/jbossws/ws-extensions/wssecuritypoli...
schemaLocation="SecurityService_schema1.xsd"/>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="sayHello">
+ <wsdl:part name="parameters" element="tns:sayHello"/>
+ </wsdl:message>
+ <wsdl:message name="sayHelloResponse">
+ <wsdl:part name="parameters"
element="tns:sayHelloResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="ServiceIface">
+ <wsdl:operation name="sayHello">
+ <wsdl:input message="tns:sayHello"/>
+ <wsdl:output message="tns:sayHelloResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="SecurityService2311PortBinding"
type="tns:ServiceIface">
+ <wsp:PolicyReference URI="#SecurityService2311_policy"/>
+ <soap:binding
transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
+ <wsdl:operation name="sayHello">
+ <soap:operation soapAction=""/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="SecurityService2312PortBinding"
type="tns:ServiceIface">
+ <wsp:PolicyReference URI="#SecurityService2312_policy"/>
+ <soap:binding
transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
+ <wsdl:operation name="sayHello">
+ <soap:operation soapAction=""/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="SecurityService2313PortBinding"
type="tns:ServiceIface">
+ <wsp:PolicyReference URI="#SecurityService2313_policy"/>
+ <soap:binding
transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
+ <wsdl:operation name="sayHello">
+ <soap:operation soapAction=""/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="SecurityService">
+ <wsdl:port name="SecurityService2311Port"
binding="tns:SecurityService2311PortBinding">
+ <soap:address
location="http://@jboss.bind.address@:8080/jaxws-samples-wsse-policy-oasis/SecurityService2311"/>
+ </wsdl:port>
+ <wsdl:port name="SecurityService2312Port"
binding="tns:SecurityService2312PortBinding">
+ <soap:address
location="https://@jboss.bind.address@:8443/jaxws-samples-wsse-policy-oasis/SecurityService2312"/>
+ </wsdl:port>
+ <wsdl:port name="SecurityService2313Port"
binding="tns:SecurityService2313PortBinding">
+ <soap:address
location="https://@jboss.bind.address@:8443/jaxws-samples-wsse-policy-oasis/SecurityService2313"/>
+ </wsdl:port>
+ </wsdl:service>
+ <!-- 2.3.1.1 (WSS1.0) SAML1.1 Assertion (Bearer) -->
+ <wsp:Policy wsu:Id="SecurityService2311_policy">
+ <sp:SupportingTokens>
+ <wsp:Policy>
+ <sp:SamlToken
+
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/...
+ <wsp:Policy>
+ <sp:WssSamlV11Token10/>
+ </wsp:Policy>
+ </sp:SamlToken>
+ </wsp:Policy>
+ </sp:SupportingTokens>
+ </wsp:Policy>
+ <!-- 2.3.1.2 (WSS1.0) SAML1.1 Assertion (Sender Vouches) over SSL -->
+ <wsp:Policy wsu:Id="SecurityService2312_policy">
+ <sp:TransportBinding>
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken>
+ <wsp:Policy>
+ <sp:RequireClientCertificate/>
+ </wsp:Policy>
+ </sp:HttpsToken>
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ </wsp:Policy>
+ </sp:TransportBinding>
+ <sp:SignedSupportingTokens>
+ <wsp:Policy>
+ <sp:SamlToken
+
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/...
+ <wsp:Policy>
+ <sp:WssSamlV11Token10/>
+ </wsp:Policy>
+ </sp:SamlToken>
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+ </wsp:Policy>
+ <!-- 2.3.1.3 (WSS1.0) SAML1.1 Assertion (HK) over SSL -->
+ <wsp:Policy wsu:Id="SecurityService2313_policy">
+ <sp:TransportBinding>
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken>
+ <wsp:Policy>
+ <sp:RequireClientCertificate/>
+ </wsp:Policy>
+ </sp:HttpsToken>
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic128 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ </wsp:Policy>
+ </sp:TransportBinding>
+ <sp:SignedEndorsingSupportingTokens>
+ <wsp:Policy>
+ <sp:SamlToken
+
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/...
+ <wsp:Policy>
+ <sp:WssSamlV11Token10/>
+ </wsp:Policy>
+ </sp:SamlToken>
+ </wsp:Policy>
+ </sp:SignedEndorsingSupportingTokens>
+ </wsp:Policy>
+</wsdl:definitions>
\ No newline at end of file