Author: alessio.soldano(a)jboss.com
Date: 2013-06-13 12:10:21 -0400 (Thu, 13 Jun 2013)
New Revision: 17669
Added:
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/EndpointFour.java
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/EndpointFourImpl.java
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3648-b/policies/
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3648-b/policies/My-WSSE-conf-BINDING.xml
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3648-b/policies/org.jboss.wsf.stack.cxf.policy.PolicyAttachmentStore
Modified:
stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicyAttachmentStore.java
stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicySetsAnnotationListener.java
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
stack/cxf/branches/JBWS-3648/modules/server/src/test/java/org/jboss/wsf/stack/cxf/configuration/BusHolderTest.java
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3098/BusHolderLifeCycleTestCase.java
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/PolicyAttachmentTestCase.java
Log:
Scan deployment for custom policy sets definitions
Modified:
stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicyAttachmentStore.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicyAttachmentStore.java 2013-06-13
10:40:12 UTC (rev 17668)
+++
stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicyAttachmentStore.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -51,8 +51,7 @@
public class PolicyAttachmentStore
{
private static final String POLICY_ATTACHMENT_LOCATION =
"META-INF/policies/";
- private volatile Map<String, List<PolicyAttachment>> attachments;
- private ClassLoader cl;
+ private final Map<String, List<PolicyAttachment>> attachments;
private static PolicyAttachmentStore defaultServerInstance;
/**
@@ -62,7 +61,9 @@
* @param cl
*/
public PolicyAttachmentStore(ClassLoader cl) {
- this.cl = cl;
+ Map<String, List<PolicyAttachment>> map = new HashMap<String,
List<PolicyAttachment>>();
+ parsePolicyAttachmentResources(cl, map);
+ attachments = map;
}
/**
@@ -78,18 +79,12 @@
return defaultServerInstance;
}
+ public void merge(PolicyAttachmentStore pas) {
+ this.attachments.putAll(pas.attachments);
+ }
+
public List<PolicyAttachment> get(String setName)
{
- if (attachments == null) {
- synchronized (PolicyAttachmentStore.class)
- {
- if (attachments == null) {
- Map<String, List<PolicyAttachment>> map = new
HashMap<String, List<PolicyAttachment>>();
- parsePolicyAttachmentResources(cl, map);
- attachments = map;
- }
- }
- }
List<PolicyAttachment> l = attachments.get(setName);
if (l != null && !l.isEmpty()) {
return Collections.unmodifiableList(l);
@@ -98,6 +93,10 @@
}
}
+ public boolean isEmpty() {
+ return attachments.isEmpty();
+ }
+
private static void parsePolicyAttachmentResources(ClassLoader cl, Map<String,
List<PolicyAttachment>> map) {
try {
Enumeration<URL> urls = getResources(cl, POLICY_ATTACHMENT_LOCATION +
PolicyAttachmentStore.class.getName());
Modified:
stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicySetsAnnotationListener.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicySetsAnnotationListener.java 2013-06-13
10:40:12 UTC (rev 17668)
+++
stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicySetsAnnotationListener.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -65,6 +65,17 @@
this.store = PolicyAttachmentStore.getDefaultInstance();
}
+ public PolicySetsAnnotationListener(ClassLoader cl) {
+ this.store = PolicyAttachmentStore.getDefaultInstance();
+ if (cl != null) {
+ PolicyAttachmentStore pas = new PolicyAttachmentStore(cl);
+ if (!pas.isEmpty()) {
+ pas.merge(this.store);
+ this.store = pas;
+ }
+ }
+ }
+
public PolicySetsAnnotationListener(PolicyAttachmentStore store) {
this.store = store;
}
Modified:
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2013-06-13
10:40:12 UTC (rev 17668)
+++
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -92,8 +92,9 @@
* @param resolver The ResourceResolver to configure, if any
* @param configurer The JBossWSCXFConfigurer to install in the bus, if
any
* @param wsmd The current JBossWebservicesMetaData, if any
+ * @param depRuntimeClassLoader The current deployment classloader
*/
- public void configure(ResourceResolver resolver, Configurer configurer,
JBossWebservicesMetaData wsmd)
+ public void configure(ResourceResolver resolver, Configurer configurer,
JBossWebservicesMetaData wsmd, ClassLoader depRuntimeClassLoader)
{
bus.setProperty(org.jboss.wsf.stack.cxf.client.Constants.DEPLOYMENT_BUS, true);
busHolderListener = new BusHolderLifeCycleListener();
@@ -116,7 +117,7 @@
setAdditionalWorkQueues(bus, props);
setWSDiscovery(bus, props);
- policySetsListener = new PolicySetsAnnotationListener();
+ policySetsListener = new PolicySetsAnnotationListener(depRuntimeClassLoader);
bus.getExtension(FactoryBeanListenerManager.class).addListener(policySetsListener);
}
Modified:
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2013-06-13
10:40:12 UTC (rev 17668)
+++
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -79,15 +79,16 @@
* @param resolver The ResourceResolver to configure, if any
* @param configurer The JBossWSCXFConfigurer to install in the bus, if
any
* @param wsmd The current JBossWebservicesMetaData, if any
+ * @param depRuntimeClassLoader The current deployment classloader
*/
@Override
- public void configure(ResourceResolver resolver, Configurer configurer,
JBossWebservicesMetaData wsmd)
+ public void configure(ResourceResolver resolver, Configurer configurer,
JBossWebservicesMetaData wsmd, ClassLoader depRuntimeClassLoader)
{
if (configured)
{
throw Messages.MESSAGES.busAlreadyConfigured(bus);
}
- super.configure(resolver, configurer, wsmd);
+ super.configure(resolver, configurer, wsmd, depRuntimeClassLoader);
for (DDEndpoint dde : metadata.getEndpoints())
{
Modified:
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2013-06-13
10:40:12 UTC (rev 17668)
+++
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -122,15 +122,16 @@
* @param configurer The JBossWSCXFConfigurer to install in the bus, if
any
* @param dep The current JBossWS-SPI Deployment
* @param wsmd The current JBossWebservicesMetaData, if any
+ * @param depRuntimeClassLoader The current deployment classloader
*/
@Override
- public void configure(ResourceResolver resolver, Configurer configurer,
JBossWebservicesMetaData wsmd)
+ public void configure(ResourceResolver resolver, Configurer configurer,
JBossWebservicesMetaData wsmd, ClassLoader depRuntimeClassLoader)
{
if (configured)
{
throw MESSAGES.busAlreadyConfigured(ctx);
}
- super.configure(resolver, configurer, wsmd);
+ super.configure(resolver, configurer, wsmd, depRuntimeClassLoader);
GenericApplicationContext jbosswsCxfContext = null;
//load stuff from provided jbossws-cxf.xml DD
Modified:
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2013-06-13
10:40:12 UTC (rev 17668)
+++
stack/cxf/branches/JBWS-3648/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -126,7 +126,7 @@
Configurer configurer =
holder.createServerConfigurer(dep.getAttachment(BindingCustomization.class),
new WSDLFilePublisher(aDep), dep.getService().getEndpoints(),
aDep.getRootFile(), epConfigName, epConfigFile);
- holder.configure(resolver, configurer, wsmd);
+ holder.configure(resolver, configurer, wsmd, dep.getRuntimeClassLoader());
dep.addAttachment(BusHolder.class, holder);
}
finally
Modified:
stack/cxf/branches/JBWS-3648/modules/server/src/test/java/org/jboss/wsf/stack/cxf/configuration/BusHolderTest.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/server/src/test/java/org/jboss/wsf/stack/cxf/configuration/BusHolderTest.java 2013-06-13
10:40:12 UTC (rev 17668)
+++
stack/cxf/branches/JBWS-3648/modules/server/src/test/java/org/jboss/wsf/stack/cxf/configuration/BusHolderTest.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -64,7 +64,7 @@
}
BusHolder holder = new NonSpringBusHolder(new DDBeans());
try {
- holder.configure(null, null, wsmd);
+ holder.configure(null, null, wsmd, null);
return
holder.getBus().getExtension(PolicyEngine.class).getAlternativeSelector().getClass().getName();
} finally {
holder.close();
Modified:
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2013-06-13
10:40:12 UTC (rev 17668)
+++
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2013-06-13
16:10:21 UTC (rev 17669)
@@ -346,6 +346,7 @@
<!-- jaxws-cxf-jbws3648-b -->
<war warfile="${tests.output.dir}/test-libs/jaxws-cxf-jbws3648-b.war"
needxmlfile='false'>
<classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/cxf/jbws3648/EndpointFour*.class"/>
<include
name="org/jboss/test/ws/jaxws/cxf/jbws3648/EndpointThree*.class"/>
<include
name="org/jboss/test/ws/jaxws/cxf/jbws3648/KeystorePasswordCallback.class"/>
</classes>
@@ -353,6 +354,8 @@
<include name="bob.jks" />
<include name="bob.properties" />
</zipfileset>
+ <zipfileset
dir="${tests.output.dir}/test-resources/jaxws/cxf/jbws3648-b/policies"
+ prefix="WEB-INF/classes/META-INF/policies"/>
<manifest>
<attribute name="Dependencies"
value="org.jboss.ws.cxf.jbossws-cxf-client, org.apache.ws.security"/>
</manifest>
Modified:
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3098/BusHolderLifeCycleTestCase.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3098/BusHolderLifeCycleTestCase.java 2013-06-13
10:40:12 UTC (rev 17668)
+++
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3098/BusHolderLifeCycleTestCase.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -63,7 +63,7 @@
Bus bus = holder.getBus();
TestLifeCycleListener listener = new TestLifeCycleListener();
bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(listener);
- holder.configure(null, null, null);
+ holder.configure(null, null, null, null);
holder.close();
assertEquals("preShutdown method on listener should be called exactly once;
number of actual calls: "
+ listener.getCount(), 1, listener.getCount());
@@ -74,7 +74,7 @@
Bus bus = holder.getBus();
TestLifeCycleListener listener = new TestLifeCycleListener();
bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(listener);
- holder.configure(null, null, null);
+ holder.configure(null, null, null, null);
bus.shutdown(true);
holder.close();
assertEquals("preShutdown method on listener should be called exactly once;
number of actual calls: "
@@ -86,7 +86,7 @@
Bus bus = holder.getBus();
TestLifeCycleListener listener = new TestLifeCycleListener();
bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(listener);
- holder.configure(null, null, null);
+ holder.configure(null, null, null, null);
assertEquals("preShutdown method on listener shouldn't be called before
holder is closed: number of actual calls: "
+ listener.getCount(), 0, listener.getCount());
holder.close();
Added:
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/EndpointFour.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/EndpointFour.java
(rev 0)
+++
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/EndpointFour.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, 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.cxf.jbws3648;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.wsf.stack.cxf.policy.PolicySets;
+
+@WebService(name = "EndpointFour", targetNamespace =
"http://org.jboss.ws.jaxws.cxf/jbws3648")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+@PolicySets({"My-WSSE-conf", "WS-Addressing"})
+public interface EndpointFour
+{
+ String echo(String input);
+}
Added:
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/EndpointFourImpl.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/EndpointFourImpl.java
(rev 0)
+++
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/EndpointFourImpl.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, 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.cxf.jbws3648;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
+import org.jboss.logging.Logger;
+
+@WebService(name = "EndpointFour",
+ targetNamespace = "http://org.jboss.ws.jaxws.cxf/jbws3648",
+ serviceName = "ServiceFour",
+ endpointInterface =
"org.jboss.test.ws.jaxws.cxf.jbws3648.EndpointFour")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+@EndpointProperties(value = {
+ @EndpointProperty(key = "ws-security.signature.properties", value =
"bob.properties"),
+ @EndpointProperty(key = "ws-security.encryption.properties", value =
"bob.properties"),
+ @EndpointProperty(key = "ws-security.signature.username", value =
"bob"),
+ @EndpointProperty(key = "ws-security.encryption.username", value =
"alice"),
+ @EndpointProperty(key = "ws-security.callback-handler", value =
"org.jboss.test.ws.jaxws.cxf.jbws3648.KeystorePasswordCallback")
+ }
+)
+public class EndpointFourImpl implements EndpointThree
+{
+ @WebMethod
+ public String echo(String input)
+ {
+ Logger.getLogger(this.getClass()).info("echo: " + input);
+ return input;
+ }
+}
Modified:
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/PolicyAttachmentTestCase.java
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/PolicyAttachmentTestCase.java 2013-06-13
10:40:12 UTC (rev 17668)
+++
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3648/PolicyAttachmentTestCase.java 2013-06-13
16:10:21 UTC (rev 17669)
@@ -63,12 +63,12 @@
QName serviceName = new
QName("http://org.jboss.ws.jaxws.cxf/jbws3648", "ServiceThree");
Service service = Service.create(wsdlURL, serviceName);
EndpointThree proxy = (EndpointThree)service.getPort(EndpointThree.class);
- setupWsse(proxy);
+ setupWsse((BindingProvider)proxy);
- assertEquals("Foo", proxy.echo("Foo"));
+ assertEquals("Foo3", proxy.echo("Foo3"));
final String m = bos.toString();
assertTrue("WS-Addressing was not enabled!",
m.contains("http://www.w3.org/2005/08/addressing") &&
m.contains("http://www.w3.org/2005/08/addressing/anonymous"));
- assertTrue("WS-Security was not enabled!",
m.contains("http://www.w3.org/2001/04/xmlenc#rsa-1_5"));
+ assertTrue("WS-Security was not enabled!",
m.contains("http://www.w3.org/2001/04/xmlenc#rsa-1_5") &&
m.contains("http://www.w3.org/2001/04/xmlenc#tripledes-cbc"));
} finally {
bus.shutdown(true);
pw.close();
@@ -76,12 +76,37 @@
}
}
- private void setupWsse(EndpointThree proxy)
+ public void testEndpointWithCustomWSSEAndWSA() throws Exception {
+ Bus bus = BusFactory.newInstance().createBus();
+ BusFactory.setThreadDefaultBus(bus);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ PrintWriter pw = new PrintWriter(bos);
+ try {
+ bus.getInInterceptors().add(new LoggingInInterceptor(pw));
+
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-cxf-jbws3648-b/ServiceFour" + "?wsdl");
+ QName serviceName = new
QName("http://org.jboss.ws.jaxws.cxf/jbws3648", "ServiceFour");
+ Service service = Service.create(wsdlURL, serviceName);
+ EndpointFour proxy = (EndpointFour)service.getPort(EndpointFour.class);
+ setupWsse((BindingProvider)proxy);
+
+ assertEquals("Foo4", proxy.echo("Foo4"));
+ final String m = bos.toString();
+ assertTrue("WS-Addressing was not enabled!",
m.contains("http://www.w3.org/2005/08/addressing") &&
m.contains("http://www.w3.org/2005/08/addressing/anonymous"));
+ assertTrue("WS-Security was not enabled!",
m.contains("http://www.w3.org/2001/04/xmlenc#rsa-1_5") &&
m.contains("http://www.w3.org/2001/04/xmlenc#aes256-cbc"));
+ } finally {
+ bus.shutdown(true);
+ pw.close();
+ bos.close();
+ }
+ }
+
+ private void setupWsse(BindingProvider proxy)
{
-
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new
KeystorePasswordCallback());
-
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
-
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES,
Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
-
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME,
"alice");
-
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME,
"bob");
+ proxy.getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new
KeystorePasswordCallback());
+ proxy.getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
+ proxy.getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES,
Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
+ proxy.getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME,
"alice");
+ proxy.getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME,
"bob");
}
}
Added:
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3648-b/policies/My-WSSE-conf-BINDING.xml
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3648-b/policies/My-WSSE-conf-BINDING.xml
(rev 0)
+++
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3648-b/policies/My-WSSE-conf-BINDING.xml 2013-06-13
16:10:21 UTC (rev 17669)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy wsu:Id="My-WSSE-conf_binding_policy"
+
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-w...
+
xmlns:wsp="http://www.w3.org/ns/ws-policy"
+
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702&...
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding>
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/...
+ <wsp:Policy>
+ <sp:WssX509V1Token11/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/...
+ <wsp:Policy>
+ <sp:WssX509V1Token11/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256Rsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:ProtectTokens/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ <sp:EncryptBeforeSigning/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:SignedParts>
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts>
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <sp:Wss10>
+ <wsp:Policy>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
\ No newline at end of file
Added:
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3648-b/policies/org.jboss.wsf.stack.cxf.policy.PolicyAttachmentStore
===================================================================
---
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3648-b/policies/org.jboss.wsf.stack.cxf.policy.PolicyAttachmentStore
(rev 0)
+++
stack/cxf/branches/JBWS-3648/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3648-b/policies/org.jboss.wsf.stack.cxf.policy.PolicyAttachmentStore 2013-06-13
16:10:21 UTC (rev 17669)
@@ -0,0 +1 @@
+My-WSSE-conf
\ No newline at end of file