[SMX4-1145]add cxf-ws-security-signature example which demonstrate how to use signaturePropRefId in OSGi container

git-svn-id: https://svn.apache.org/repos/asf/servicemix/smx4/features/trunk@1343136 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/assemblies/apache-servicemix-jbi/src/main/filtered-resources/README.txt b/assemblies/apache-servicemix-jbi/src/main/filtered-resources/README.txt
index d69b271..858b55d 100644
--- a/assemblies/apache-servicemix-jbi/src/main/filtered-resources/README.txt
+++ b/assemblies/apache-servicemix-jbi/src/main/filtered-resources/README.txt
@@ -63,6 +63,11 @@
   Service, then it will leverage cxf JAASLoginInterceptor to authenticate against karaf
   default jaas configuration.
 
+- cxf-ws-security-signature
+  Create a web service with CXF using WS-SECURITY Signature action and expose it through the OSGi HTTP
+  Service, the main purpose is to demonstrate how to use signaturePropRefId WSS4J configuration in
+  OSGi container.
+
 
 Karaf examples
 ==============
diff --git a/assemblies/apache-servicemix/src/main/filtered-resources/features.xml b/assemblies/apache-servicemix/src/main/filtered-resources/features.xml
index 46c93c0..c559198 100644
--- a/assemblies/apache-servicemix/src/main/filtered-resources/features.xml
+++ b/assemblies/apache-servicemix/src/main/filtered-resources/features.xml
@@ -133,6 +133,13 @@
         <bundle dependency="true">mvn:org.apache.servicemix/servicemix-utils/${servicemix.utils.version}</bundle>
         <bundle>mvn:org.apache.servicemix.examples/cxf-ws-security-blueprint/${version}</bundle>
     </feature>
+    <feature name="examples-cxf-ws-security-signature" version="${version}" resolver="(obr)">
+        <feature version="${cxf.version}">cxf</feature>
+        <bundle dependency="true">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jbi-api-1.0/${servicemix.specs.version}</bundle>
+        <bundle dependency="true">mvn:org.apache.servicemix/servicemix-utils/${servicemix.utils.version}</bundle>
+        <bundle dependency="true">mvn:org.springframework/spring-beans/${spring.version}</bundle>
+        <bundle>mvn:org.apache.servicemix.examples/cxf-ws-security-signature/${version}</bundle>
+    </feature>
     <feature name="examples-cxf-ws-rm" version="${version}" resolver="(obr)">
         <bundle>mvn:org.apache.servicemix.examples/cxf-ws-rm/${version}</bundle>
     </feature>
diff --git a/examples/cxf/cxf-ws-security-signature/README.txt b/examples/cxf/cxf-ws-security-signature/README.txt
new file mode 100644
index 0000000..ce3c7df
--- /dev/null
+++ b/examples/cxf/cxf-ws-security-signature/README.txt
@@ -0,0 +1,249 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+CXF WS-SECURITY OSGi HTTP WEB SERVICE
+=========================
+
+Purpose
+-------
+Create a web service with CXF using WS-SECURITY Signature action and expose it through the OSGi HTTP
+Service, the main purpose is to demonstrate how to use signaturePropRefId WSS4J configuration in
+OSGi container.
+
+
+Explanation
+-----------
+The web service is a simple JAX-WS web service with ws-security Signature and UsernameToken action called HelloWorldSecurity. The 
+interface and the implementation are located in the src/main/java/org/
+apache/servicemix/examples/cxf directory of this example.
+
+The beans.xml file, located in the src/main/resources/META-INF/spring
+directory:
+
+
+1. Configures the web service endpoint as follows:
+
+    <jaxws:endpoint id="helloWorld"
+        implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
+        address="/HelloWorldSecurity">
+        <jaxws:inInterceptors>
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+                <constructor-arg>
+                    <map>
+                        <entry key="action" value="UsernameToken Signature"/>
+                        <entry key="passwordType" value="PasswordText"/>
+                        <entry key="passwordCallbackRef">
+                            <ref bean="myPasswordCallback"/>
+                        </entry>
+                        <entry key="signaturePropRefId" value="wsCryptoProperties"/>
+                        <entry key="wsCryptoProperties" value-ref="wsCryptoProperties"/>
+                    </map>
+                </constructor-arg>
+            </bean>
+            <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
+        </jaxws:inInterceptors>
+    </jaxws:endpoint>
+    
+    <util:properties id="wsCryptoProperties">
+
+       <prop
+            key="org.apache.ws.security.crypto.provider">org.apache.ws.security.components.crypto.Merlin</prop>
+
+       <prop
+            key="org.apache.ws.security.crypto.merlin.keystore.type">jks</prop>
+
+       <prop
+           key="org.apache.ws.security.crypto.merlin.keystore.password">storepassword</prop>
+
+       <prop
+           key="org.apache.ws.security.crypto.merlin.file">server-truststore.jks</prop>
+    </util:properties>
+
+Prerequisites for Running the Example
+-------------------------------------
+1. You must have the following installed on your machine:
+
+   - JDK 1.6 or higher
+   
+   - Maven 2.2.1 or higher
+   
+  For more information, see the README in the top-level examples
+  directory.
+
+
+2. Start ServiceMix by running the following command:
+
+  <servicemix_home>/bin/servicemix          (on UNIX)
+  <servicemix_home>\bin\servicemix          (on Windows)
+
+
+Running the Example
+-------------------
+You can run the example in two ways:
+
+- A. Using a Prebuilt Deployment Bundle: Quick and Easy
+This option is useful if you want to see the example up and
+running as quickly as possible.
+
+- B. Building the Example Bundle Yourself
+This option is useful if you want to change the example in any
+way. It tells you how to build and deploy the example. This
+option might be slower than option A because, if you do not
+already have the required bundles in your local Maven
+repository, Maven will have to download the bundles it needs.
+
+A. Using a Prebuilt Deployment Bundle: Quick and Easy
+-----------------------------------------------------
+To install and run a prebuilt version of this example, enter
+the following command in the ServiceMix console:
+
+  features:install examples-cxf-ws-security-signature
+  
+This command makes use of the ServiceMix features facility. For
+more information about the features facility, see the README.txt
+file in the examples parent directory.
+
+To view the service WSDL, open your browser and go to the following
+URL:
+
+  http://localhost:8181/cxf/HelloWorldSecurity?wsdl
+
+Note, if you use Safari, right click the window and select
+'Show Source'.
+
+Running a Client
+----------------
+To run the java code client:
+
+1. Change to the <servicemix_home>/examples/cxf-ws-security-signature
+   directory.
+
+2. Run the following command:
+
+     mvn compile exec:java
+
+   If the client request is successful, 
+   it will print out
+       <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:sayHelloResponse xmlns:ns2="http://cxf.apache.org/wsse/handler/helloworld"><return>Hello CXF</return></ns2:sayHelloResponse></soap:Body></soap:Envelope>
+   in the ServiceMix console:
+
+
+Changing /cxf servlet alias
+---------------------------
+By default CXF Servlet is assigned a '/cxf' alias. You can
+change it in a couple of ways
+
+a. Add org.apache.cxf.osgi.cfg to the /etc directory and set
+   the 'org.apache.cxf.servlet.context' property, for example:
+   
+     org.apache.cxf.servlet.context=/custom
+   
+b. Use shell config commands, for example :
+   
+     config:edit org.apache.cxf.osgi   
+     config:propset org.apache.cxf.servlet.context /super
+     config:update
+
+
+B. Building the Example Bundle Yourself
+---------------------------------------
+To install and run the example where you build the example bundle
+yourself, complete the following steps:
+
+1. If you have already run the example using the prebuilt version as
+   described above, you must first uninstall the examples-cxf-ws-security-signature
+   feature by entering the following command in the ServiceMix console:
+
+     features:uninstall examples-cxf-ws-security-signature
+
+   
+2. Build the example by opening a command prompt, changing directory to
+   examples/cxf-ws-security-signature (this example) and entering the following Maven
+   command:
+
+     mvn install
+   
+   If all of the required OSGi bundles are available in your local
+   Maven repository, the example will build very quickly. Otherwise
+   it may take some time for Maven to download everything it needs.
+   
+   The mvn install command builds the example deployment bundle and
+   copies it to your local Maven repository and to the target directory
+   of this example.
+     
+3. Install the example by entering the following command in
+   the ServiceMix console:
+   
+     features:install examples-cxf-ws-security-signature
+       
+   It makes use of the ServiceMix features facility. For more
+   information about the features facility, see the README.txt file
+   in the examples parent directory.
+
+To view the service WSDL, open your browser and go to the following
+URL:
+
+  http://localhost:8181/cxf/HelloWorldSecurity?wsdl
+
+Note, if you use Safari, right click the window and select
+'Show Source'.
+
+You can try running a client against your service by following the
+instructions in the "Running a Client" section above.
+
+
+Stopping and Uninstalling the Example
+-------------------------------------
+To stop the example, you must first know the bundle ID that ServiceMix
+has assigned to it. To get the bundle ID, enter the following command
+at the ServiceMix console:
+
+  osgi:list
+
+At the end of the listing, you should see an entry similar to the
+following:
+
+  [170] [Active     ] [Started] [  60] Apache ServiceMix Example :: CXF WS SECURITY OSGI (4.2.0.0)
+
+In this case, the bundle ID is 170.
+
+To stop the example, enter the following command at the ServiceMix
+console:
+
+  osgi:stop <bundle_id>
+
+For example:
+
+  osgi:stop 170
+
+To uninstall the example, enter one of the following commands in
+the ServiceMix console:
+
+  features:uninstall examples-cxf-ws-security-signature
+ 
+or
+ 
+  osgi:uninstall <bundle_id>
+  
+
+Viewing the Log Entries
+-----------------------
+You can view the entries in the log file in the data/log
+directory of your ServiceMix installation, or by typing
+the following command in the ServiceMix console:
+
+  log:display
diff --git a/examples/cxf/cxf-ws-security-signature/pom.xml b/examples/cxf/cxf-ws-security-signature/pom.xml
new file mode 100755
index 0000000..3cf1243
--- /dev/null
+++ b/examples/cxf/cxf-ws-security-signature/pom.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.examples</groupId>
+        <artifactId>cxf</artifactId>
+        <version>4.5.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>cxf-ws-security-signature</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache ServiceMix :: Features :: Examples :: CXF WS-Security Signature OSGi</name>
+    <description>CXF example using WS-Security Signature Action</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix</groupId>
+            <artifactId>servicemix-utils</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ws.security</groupId>
+            <artifactId>wss4j</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Bundle-Description>${project.description}</Bundle-Description>
+                        <Import-Package>
+                            javax.jws,
+                            javax.xml.bind.annotation,
+                            javax.xml.namespace,
+                            javax.wsdl,
+                            META-INF.cxf,
+                            META-INF.cxf.osgi,
+                            org.apache.cxf.bus,
+                            org.apache.cxf.bus.spring,
+                            org.apache.cxf.bus.resource,
+                            org.apache.cxf.configuration.spring,
+                            org.apache.cxf.resource,
+                            org.apache.cxf.transport.http,
+                            org.apache.cxf.ws.security.wss4j,
+                            org.springframework.beans.factory.config,
+                            javax.security.auth.callback,
+                            org.apache.ws.security,
+                            org.apache.servicemix.util,
+                            org.apache.ws.security.processor,
+                            org.apache.cxf.binding.soap.saaj
+                        </Import-Package>
+                        <Export-Package>org.apache.servicemix.examples.cxf</Export-Package>
+                        <Require-Bundle>org.apache.cxf.bundle</Require-Bundle>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <configuration>
+                    <mainClass>org.apache.servicemix.examples.cxf.Client</mainClass>
+                    <includePluginDependencies>false</includePluginDependencies>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/Client.java b/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/Client.java
new file mode 100755
index 0000000..8890c39
--- /dev/null
+++ b/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/Client.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.examples.cxf;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.servicemix.util.FileUtil;
+
+public class Client{
+    public static void main(String[] args) {
+        try {
+        new Client().sendRequest();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    public void sendRequest() throws Exception {
+        URLConnection connection = new URL("http://localhost:8181/cxf/HelloWorldSecurity")
+                .openConnection();
+        connection.setDoInput(true);
+        connection.setDoOutput(true);
+        OutputStream os = connection.getOutputStream();
+        // Post the request file.
+        InputStream fis = getClass().getClassLoader().getResourceAsStream("org/apache/servicemix/examples/cxf/request.xml");
+        FileUtil.copyInputStream(fis, os);
+        // Read the response.
+        InputStream is = connection.getInputStream();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        FileUtil.copyInputStream(is, baos);
+        System.out.println("the response is =====>");
+        System.out.println(baos.toString());
+    }
+
+}
diff --git a/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java b/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java
new file mode 100644
index 0000000..f5ecab0
--- /dev/null
+++ b/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.examples.cxf;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+@WebService(name = "HelloWorld", targetNamespace = "http://cxf.apache.org/wsse/handler/helloworld")
+public interface HelloWorld {
+    @WebMethod
+    String sayHello(@WebParam(name = "toWhom") String to);
+
+}
diff --git a/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java b/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java
new file mode 100755
index 0000000..075e4ec
--- /dev/null
+++ b/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.examples.cxf;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+@WebService(name = "HelloWorld", targetNamespace = "http://cxf.apache.org/wsse/handler/helloworld", 
+            endpointInterface = "org.apache.servicemix.examples.cxf.HelloWorld")
+public class HelloWorldImpl implements HelloWorld {
+    @WebMethod
+    public String sayHello(@WebParam(name = "toWhom") String toWhom) {
+        return "Hello " + toWhom;
+
+    }
+}
diff --git a/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/ServerPasswordCallback.java b/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/ServerPasswordCallback.java
new file mode 100755
index 0000000..8aab9b9
--- /dev/null
+++ b/examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/ServerPasswordCallback.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.servicemix.examples.cxf;
+
+import java.io.IOException;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import org.apache.ws.security.WSPasswordCallback;
+
+public class ServerPasswordCallback implements CallbackHandler {
+
+    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+
+        WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
+
+        if (pc.getIdentifier().equals("clientx509v1")) {
+            pc.setPassword("storepassword");
+        }
+    }
+
+}
+
+
diff --git a/examples/cxf/cxf-ws-security-signature/src/main/resources/META-INF/spring/beans.xml b/examples/cxf/cxf-ws-security-signature/src/main/resources/META-INF/spring/beans.xml
new file mode 100755
index 0000000..124ad12
--- /dev/null
+++ b/examples/cxf/cxf-ws-security-signature/src/main/resources/META-INF/spring/beans.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:jaxws="http://cxf.apache.org/jaxws"
+    xmlns:util="http://www.springframework.org/schema/util"
+    xsi:schemaLocation="
+    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+
+
+    <bean id="myPasswordCallback" class="org.apache.servicemix.examples.cxf.ServerPasswordCallback"/>
+
+    <jaxws:endpoint id="helloWorld"
+        implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
+        address="/HelloWorldSecurity">
+        <jaxws:inInterceptors>
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+                <constructor-arg>
+                    <map>
+                        <entry key="action" value="UsernameToken Signature"/>
+                        <entry key="passwordType" value="PasswordText"/>
+                        <entry key="passwordCallbackRef">
+                            <ref bean="myPasswordCallback"/>
+                        </entry>
+                        <entry key="signaturePropRefId" value="wsCryptoProperties"/>
+                        <entry key="wsCryptoProperties" value-ref="wsCryptoProperties"/>
+                    </map>
+                </constructor-arg>
+            </bean>
+            <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
+        </jaxws:inInterceptors>
+    </jaxws:endpoint>
+    
+    <util:properties id="wsCryptoProperties">
+
+       <prop
+            key="org.apache.ws.security.crypto.provider">org.apache.ws.security.components.crypto.Merlin</prop>
+
+       <prop
+            key="org.apache.ws.security.crypto.merlin.keystore.type">jks</prop>
+
+       <prop
+           key="org.apache.ws.security.crypto.merlin.keystore.password">storepassword</prop>
+
+       <prop
+           key="org.apache.ws.security.crypto.merlin.file">server-truststore.jks</prop>
+    </util:properties>
+
+
+</beans>
+<!-- END SNIPPET: beans -->
diff --git a/examples/cxf/cxf-ws-security-signature/src/main/resources/org/apache/servicemix/examples/cxf/request.xml b/examples/cxf/cxf-ws-security-signature/src/main/resources/org/apache/servicemix/examples/cxf/request.xml
new file mode 100644
index 0000000..568f684
--- /dev/null
+++ b/examples/cxf/cxf-ws-security-signature/src/main/resources/org/apache/servicemix/examples/cxf/request.xml
@@ -0,0 +1 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustUnderstand="1"><wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-56A4FA49B9789303C913375794129791">MIICNjCCAZ8CBEo1POgwDQYJKoZIhvcNAQEEBQAwYjELMAkGA1UEBhMCSU4xCzAJBgNVBAgTAk1QMQ8wDQYDVQQHEwZJTkRPUkUxDzANBgNVBAoTBkFwYWNoZTEMMAoGA1UECxMDRGV2MRYwFAYDVQQDEw1NYXlhbmsgTWlzaHJhMB4XDTA5MDYxNDE4MDk0NFoXDTE5MDYxMjE4MDk0NFowYjELMAkGA1UEBhMCSU4xCzAJBgNVBAgTAk1QMQ8wDQYDVQQHEwZJTkRPUkUxDzANBgNVBAoTBkFwYWNoZTEMMAoGA1UECxMDRGV2MRYwFAYDVQQDEw1NYXlhbmsgTWlzaHJhMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdPhcimx7/CFX4H8isKEKCbRK6Kr+qeCMCby9I/Q/NY1bNqy6nsD+Y5BxSc2yCUnyLsRdmAHIxUwRQ9X5s8FP9+T1nwuoPzBvjcoZqWgDhe9RvydkijuzsFan/PY4oemd5EIoQu80ZpcFqb00xyDY3DkPgymXNsZ2uAM1ccsx90QIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAGXIE7pFNInlyjHnq89zgvHJfZNE44El6Cd5V55JvL+LZUnynU2Y8WaUwD2Qvc1QTr9R7u6nhZ8abyB7TSx3idiN6KUSNtBHOeWUTmfGbAJqO/J6R2A9J20KCvss28D05rRI3z52VQHnMBzgirL6M5ClWBZfl2Q3bNKnOImjoNhK</wsse:BinarySecurityToken><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="SIG-3"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="soap"/></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><ds:Reference URI="#id-2"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList=""/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><ds:DigestValue>kK3EYmWcAMgQmq0d+yhzRuG4Myg=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>H0MlO30M1NNQ1M8h1CYvRxWpCKYH9qTkRDpsIZCIdAkjW5lQlWNQ7svUCKpZZzo+dFlS/JeU1dHIXVp7JxB+dLiRBMuuJ4Z4ONwzsBA03Kx+/jNYc3aScLRwW85DMTaVnTqHLIPoO4uhJyUfKicOF3/BHp1A+Ctj5zeBb0LmIN8=</ds:SignatureValue><ds:KeyInfo Id="KI-56A4FA49B9789303C913375794129862"><wsse:SecurityTokenReference wsu:Id="STR-56A4FA49B9789303C913375794129893"><wsse:Reference URI="#X509-56A4FA49B9789303C913375794129791" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/></wsse:SecurityTokenReference></ds:KeyInfo></ds:Signature><wsse:UsernameToken wsu:Id="UsernameToken-1"><wsse:Username>clientx509v1</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">storepassword</wsse:Password></wsse:UsernameToken></wsse:Security></soap:Header><soap:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-2"><ns2:sayHello xmlns:ns2="http://cxf.apache.org/wsse/handler/helloworld"><toWhom>CXF</toWhom></ns2:sayHello></soap:Body></soap:Envelope>
diff --git a/examples/cxf/cxf-ws-security-signature/src/main/resources/server-truststore.jks b/examples/cxf/cxf-ws-security-signature/src/main/resources/server-truststore.jks
new file mode 100644
index 0000000..2447028
--- /dev/null
+++ b/examples/cxf/cxf-ws-security-signature/src/main/resources/server-truststore.jks
Binary files differ
diff --git a/examples/cxf/pom.xml b/examples/cxf/pom.xml
index 39108f4..16df217 100644
--- a/examples/cxf/pom.xml
+++ b/examples/cxf/pom.xml
@@ -41,6 +41,7 @@
         <module>cxf-ws-security-osgi</module>
         <module>cxf-ws-security-blueprint</module>
         <module>cxf-ws-rm</module>
+        <module>cxf-ws-security-signature</module>
     </modules>
 
 </project>