You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by gm...@apache.org on 2012/05/30 17:28:16 UTC

svn commit: r1344308 - in /cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts: ./ keys/ src/demo/ src/main/ src/main/java/ src/main/java/demo/ src/main/java/demo/wssec/ src/main/java/demo/wssec/client/ src/main/java/demo/wssec/server/ s...

Author: gmazza
Date: Wed May 30 15:28:11 2012
New Revision: 1344308

URL: http://svn.apache.org/viewvc?rev=1344308&view=rev
Log:
Better Mavenized the STS sample -- following standard directory format

Added:
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/Client.java
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/ClientCallbackHandler.java
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/GreeterImpl.java
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/Server.java
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/ServerCallbackHandler.java
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/STSCallbackHandler.java
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/Server.java
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/clientKeystore.properties
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/serviceKeystore.properties
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/stsKeystore.properties
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-client.xml
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-server.xml
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-sts.xml
Removed:
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/keys/clientKeystore.properties
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/keys/serviceKeystore.properties
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/keys/stsKeystore.properties
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/demo/
Modified:
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/pom.xml

Modified: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/pom.xml?rev=1344308&r1=1344307&r2=1344308&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/pom.xml (original)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/pom.xml Wed May 30 15:28:11 2012
@@ -35,7 +35,6 @@
         <cxf.version>${project.version}</cxf.version>
     </properties>
     <build>
-        <sourceDirectory>src</sourceDirectory>
         <plugins>
             <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
@@ -57,9 +56,6 @@
                                 <wsdlOption>
                                     <wsdl>${basedir}/wsdl/hello_world.wsdl</wsdl>
                                 </wsdlOption>
-                                <wsdlOption>
-                                    <wsdl>${basedir}/wsdl/ws-trust-1.4-service.wsdl</wsdl>
-                                </wsdlOption>
                             </wsdlOptions>
                         </configuration>
                         <goals>
@@ -68,28 +64,6 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copyxmlfiles</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                        <configuration>
-                            <tasks>
-                                <copy file="${basedir}/src/demo/wssec/sts/wssec-sts.xml" todir="${basedir}/target/classes/demo/wssec/sts" />
-                                <copy file="${basedir}/src/demo/wssec/server/wssec-server.xml" todir="${basedir}/target/classes/demo/wssec/server" />
-                                <copy file="${basedir}/src/demo/wssec/client/wssec-client.xml" todir="${basedir}/target/classes/demo/wssec/client" />
-                                <copy todir="${basedir}/target/classes/keys">
-                                    <fileset dir="${basedir}/keys" />
-                                </copy>
-                            </tasks>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
         </plugins>
     </build>
     <profiles>

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/Client.java?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/Client.java (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/Client.java Wed May 30 15:28:11 2012
@@ -0,0 +1,84 @@
+/**
+ * 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 demo.wssec.client;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.hello_world_soap_http.Greeter;
+import org.springframework.core.io.ClassPathResource;
+
+public final class Client {
+
+    private static final QName SERVICE_NAME
+        = new QName("http://apache.org/hello_world_soap_http", "SOAPService");
+
+    private static final QName PORT_NAME =
+        new QName("http://apache.org/hello_world_soap_http", "SoapPort");
+
+
+    private Client() {
+    }
+
+    public static void main(String args[]) throws Exception {
+        
+        if (args.length == 0) {
+            System.out.println("please specify wsdl");
+            System.exit(1);
+        }
+        
+        URL wsdlURL;
+        File wsdlFile = new File(args[0]);
+        if (wsdlFile.exists()) {
+            wsdlURL = wsdlFile.toURI().toURL();
+        } else {
+            wsdlURL = new URL(args[0]);
+        }
+        
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = new ClassPathResource("wssec-client.xml").getURL();
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+
+        Service service = Service.create(wsdlURL, SERVICE_NAME);
+        Greeter port = service.getPort(PORT_NAME, Greeter.class);
+
+        System.out.println("Invoking greetMe...");
+        try {
+            String resp = port.greetMe(System.getProperty("user.name"));
+            System.out.println("Server responded with: " + resp);
+            System.out.println();
+
+        } catch (Exception e) {
+            System.out.println("Invocation failed with the following: " + e.getCause());
+            System.out.println();
+        }
+
+        System.exit(0);
+    }
+
+}

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/ClientCallbackHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/ClientCallbackHandler.java?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/ClientCallbackHandler.java (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/client/ClientCallbackHandler.java Wed May 30 15:28:11 2012
@@ -0,0 +1,51 @@
+/**
+ * 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 demo.wssec.client;
+
+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 ClientCallbackHandler implements CallbackHandler {
+
+    public void handle(Callback[] callbacks) throws IOException,
+            UnsupportedCallbackException {
+        for (int i = 0; i < callbacks.length; i++) {
+            if (callbacks[i] instanceof WSPasswordCallback) {
+                WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
+                if (pc.getUsage() == WSPasswordCallback.DECRYPT || 
+                    pc.getUsage() == WSPasswordCallback.SIGNATURE) {
+                    if ("myclientkey".equals(pc.getIdentifier())) {
+                        pc.setPassword("ckpass");
+                    }
+                } else if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN) {
+                    if ("alice".equals(pc.getIdentifier())) {
+                        pc.setPassword("clarinet");
+                        break;
+                    } else if ("bob".equals(pc.getIdentifier())) {
+                        pc.setPassword("trombone");
+                        break;
+                    }
+                }
+            }
+        }
+    }
+}

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/GreeterImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/GreeterImpl.java?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/GreeterImpl.java (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/GreeterImpl.java Wed May 30 15:28:11 2012
@@ -0,0 +1,43 @@
+/**
+ * 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 demo.wssec.server;
+
+import java.util.logging.Logger;
+import org.apache.hello_world_soap_http.Greeter;
+
+@javax.jws.WebService(name = "Greeter", serviceName = "SOAPService", 
+                      targetNamespace = "http://apache.org/hello_world_soap_http", 
+                      wsdlLocation = "file:./wsdl/hello_world.wsdl")
+                  
+public class GreeterImpl implements Greeter {
+
+    private static final Logger LOG = 
+        Logger.getLogger(GreeterImpl.class.getPackage().getName());
+    
+    /* (non-Javadoc)
+     * @see org.objectweb.hello_world_soap_http.Greeter#greetMe(java.lang.String)
+     */
+    public String greetMe(String me) {
+        LOG.info("Executing operation greetMe");
+        System.out.println("Executing operation greetMe");
+        System.out.println("Message received: " + me + "\n");
+        return "Hello " + me;
+    }
+}

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/Server.java?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/Server.java (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/Server.java Wed May 30 15:28:11 2012
@@ -0,0 +1,50 @@
+/**
+ * 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 demo.wssec.server;
+
+import java.net.URL;
+
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.springframework.core.io.ClassPathResource;
+
+public class Server {
+
+    protected Server() throws Exception {
+        System.out.println("Starting Server");
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = new ClassPathResource("wssec-server.xml").getURL();
+        Bus bus = bf.createBus(busFile.toString());
+        BusFactory.setDefaultBus(bus);
+    }
+
+    public static void main(String args[]) throws Exception {
+        System.out.println();
+        new Server();
+        System.out.println("Server ready...");
+
+        Thread.sleep(5 * 60 * 1000);
+        System.out.println("Server exiting");
+        System.exit(0);
+    }
+}

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/ServerCallbackHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/ServerCallbackHandler.java?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/ServerCallbackHandler.java (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/server/ServerCallbackHandler.java Wed May 30 15:28:11 2012
@@ -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 demo.wssec.server;
+
+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 ServerCallbackHandler implements CallbackHandler {
+
+    public void handle(Callback[] callbacks) throws IOException,
+            UnsupportedCallbackException {
+        for (int i = 0; i < callbacks.length; i++) {
+            if (callbacks[i] instanceof WSPasswordCallback) {
+                WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
+                if ("myservicekey".equals(pc.getIdentifier())) {
+                    pc.setPassword("skpass");
+                    break;
+                }
+            }
+        }
+    }
+}

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/STSCallbackHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/STSCallbackHandler.java?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/STSCallbackHandler.java (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/STSCallbackHandler.java Wed May 30 15:28:11 2012
@@ -0,0 +1,48 @@
+/**
+ * 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 demo.wssec.sts;
+
+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 STSCallbackHandler implements CallbackHandler {
+
+    public void handle(Callback[] callbacks) throws IOException,
+            UnsupportedCallbackException {
+        for (int i = 0; i < callbacks.length; i++) {
+            if (callbacks[i] instanceof WSPasswordCallback) {
+                WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
+                if (pc.getUsage() == WSPasswordCallback.DECRYPT || 
+                    pc.getUsage() == WSPasswordCallback.SIGNATURE) {
+                    if ("mystskey".equals(pc.getIdentifier())) {
+                        pc.setPassword("stskpass");
+                    }
+                } else if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN) {
+                    if ("alice".equals(pc.getIdentifier())) {
+                        pc.setPassword("clarinet");
+                    }
+                }
+            }
+        }
+    }
+}
+

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/Server.java?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/Server.java (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/java/demo/wssec/sts/Server.java Wed May 30 15:28:11 2012
@@ -0,0 +1,49 @@
+/**
+ * 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 demo.wssec.sts;
+
+import java.net.URL;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.springframework.core.io.ClassPathResource;
+
+public class Server {
+
+    protected Server() throws Exception {
+        System.out.println("Starting STS");
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = new ClassPathResource("wssec-sts.xml").getURL();
+        Bus bus = bf.createBus(busFile.toString());
+        BusFactory.setDefaultBus(bus);
+    }
+
+    public static void main(String args[]) throws Exception {
+        System.out.println();
+        new Server();
+        System.out.println("Server ready...");
+
+        Thread.sleep(5 * 60 * 1000);
+        System.out.println("Server exiting");
+        System.exit(0);
+    }
+}

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/clientKeystore.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/clientKeystore.properties?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/clientKeystore.properties (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/clientKeystore.properties Wed May 30 15:28:11 2012
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=cspass
+org.apache.ws.security.crypto.merlin.keystore.alias=myclientkey
+org.apache.ws.security.crypto.merlin.keystore.file=keys/clientstore.jks
+

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/serviceKeystore.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/serviceKeystore.properties?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/serviceKeystore.properties (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/serviceKeystore.properties Wed May 30 15:28:11 2012
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=sspass
+org.apache.ws.security.crypto.merlin.keystore.alias=myservicekey
+org.apache.ws.security.crypto.merlin.keystore.file=keys/servicestore.jks
+

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/stsKeystore.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/stsKeystore.properties?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/stsKeystore.properties (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/stsKeystore.properties Wed May 30 15:28:11 2012
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=stsspass
+org.apache.ws.security.crypto.merlin.keystore.file=keys/stsstore.jks
+

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-client.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-client.xml?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-client.xml (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-client.xml Wed May 30 15:28:11 2012
@@ -0,0 +1,86 @@
+<?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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:cxf="http://cxf.apache.org/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:sec="http://cxf.apache.org/configuration/security"
+  xmlns:http="http://cxf.apache.org/transports/http/configuration"
+  xmlns:jaxws="http://cxf.apache.org/jaxws"
+  xsi:schemaLocation="
+           http://cxf.apache.org/core
+           http://cxf.apache.org/schemas/core.xsd
+           http://cxf.apache.org/configuration/security
+           http://cxf.apache.org/schemas/configuration/security.xsd
+           http://cxf.apache.org/jaxws
+           http://cxf.apache.org/schemas/jaxws.xsd
+           http://cxf.apache.org/transports/http/configuration
+           http://cxf.apache.org/schemas/configuration/http-conf.xsd
+           http://www.springframework.org/schema/beans
+           http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <cxf:bus>
+        <cxf:features>
+            <cxf:logging/>
+        </cxf:features>
+    </cxf:bus>
+
+    <jaxws:client name="{http://apache.org/hello_world_soap_http}SoapPort" createdFromAPI="true">
+       <jaxws:properties>
+           <entry key="ws-security.signature.properties" value="clientKeystore.properties"/>
+           <entry key="ws-security.signature.username" value="myclientkey"/>
+           <entry key="ws-security.callback-handler" 
+                  value="demo.wssec.client.ClientCallbackHandler"/>
+           <entry key="ws-security.encryption.properties" value="clientKeystore.properties"/> 
+           <entry key="ws-security.encryption.username" value="myservicekey"/>
+           <entry key="ws-security.sts.client">
+               <bean class="org.apache.cxf.ws.security.trust.STSClient">
+                   <constructor-arg ref="cxf"/>
+                   <property name="wsdlLocation" 
+                             value="http://localhost:8080/SecurityTokenService/UT?wsdl"/>
+                   <property name="serviceName" 
+                             value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService"/>
+                   <property name="endpointName" 
+                             value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}UT_Port"/>
+                   <property name="properties">
+                       <map>
+                           <entry key="ws-security.username" value="alice"/>
+                           <entry key="ws-security.callback-handler" 
+                                  value="demo.wssec.client.ClientCallbackHandler"/>
+                           <entry key="ws-security.encryption.properties" value="clientKeystore.properties"/> 
+                           <entry key="ws-security.encryption.username" value="mystskey"/>
+                           <!-- Because of the PublicKey requirement in the InitiatorToken element
+                                in the WSP WSDL, the client needs to have the STS add its public
+                                key to the SAML assertion, as configured in the three lines below.  
+                           -->                        
+                           <entry key="ws-security.sts.token.username" value="myclientkey"/>
+                           <entry key="ws-security.sts.token.properties" value="clientKeystore.properties"/> 
+                           <!-- If usecert = true, sends entire certificate in an X509Certificate element, else
+                                sends cert ID in a KeyValue element -->
+                           <entry key="ws-security.sts.token.usecert" value="true"/> 
+                       </map>
+                   </property>
+               </bean>            
+           </entry> 
+       </jaxws:properties>
+   </jaxws:client>
+
+</beans> 
+

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-server.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-server.xml?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-server.xml (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-server.xml Wed May 30 15:28:11 2012
@@ -0,0 +1,65 @@
+<?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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:cxf="http://cxf.apache.org/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:sec="http://cxf.apache.org/configuration/security"
+  xmlns:http="http://cxf.apache.org/transports/http/configuration"
+  xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+  xmlns:jaxws="http://cxf.apache.org/jaxws"
+  xsi:schemaLocation="
+            http://cxf.apache.org/core
+            http://cxf.apache.org/schemas/core.xsd 
+            http://cxf.apache.org/configuration/security  		      
+            http://cxf.apache.org/schemas/configuration/security.xsd
+            http://cxf.apache.org/jaxws
+            http://cxf.apache.org/schemas/jaxws.xsd
+            http://cxf.apache.org/transports/http/configuration
+            http://cxf.apache.org/schemas/configuration/http-conf.xsd
+            http://cxf.apache.org/transports/http-jetty/configuration
+            http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+            http://www.springframework.org/schema/beans
+            http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <cxf:bus>
+        <cxf:features>
+            <cxf:logging/>
+        </cxf:features>
+    </cxf:bus>
+
+    <jaxws:endpoint id="server"
+      implementor="demo.wssec.server.GreeterImpl"
+      endpointName="s:SoapPort"
+      serviceName="s:SOAPService"
+      address="http://localhost:9001/SoapContext/SoapPort"
+      wsdlLocation="wsdl/hello_world.wsdl"
+      xmlns:s="http://apache.org/hello_world_soap_http">
+        
+      <jaxws:properties>
+         <entry key="ws-security.signature.username" value="myservicekey"/>
+         <entry key="ws-security.callback-handler" 
+                value="demo.wssec.server.ServerCallbackHandler"/>
+         <entry key="ws-security.signature.properties" value="serviceKeystore.properties"/>
+         <entry key="ws-security.encryption.properties" value="serviceKeystore.properties"/>
+      </jaxws:properties> 
+    </jaxws:endpoint>
+
+</beans>

Added: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-sts.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-sts.xml?rev=1344308&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-sts.xml (added)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/sts/src/main/resources/wssec-sts.xml Wed May 30 15:28:11 2012
@@ -0,0 +1,88 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:cxf="http://cxf.apache.org/core"
+    xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:test="http://apache.org/hello_world_soap_http"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
+    xsi:schemaLocation="
+        http://cxf.apache.org/core
+        http://cxf.apache.org/schemas/core.xsd
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+        http://cxf.apache.org/jaxws                                     
+        http://cxf.apache.org/schemas/jaxws.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util-2.0.xsd">
+
+    <cxf:bus>
+        <cxf:features>
+            <cxf:logging />
+        </cxf:features>
+    </cxf:bus>
+
+    <bean id="utSTSProviderBean"
+        class="org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider">
+        <property name="issueOperation" ref="utIssueDelegate" />
+        <property name="validateOperation" ref="utValidateDelegate" />
+    </bean>
+
+    <bean id="utIssueDelegate" class="org.apache.cxf.sts.operation.TokenIssueOperation">
+        <property name="tokenProviders" ref="utSamlTokenProvider" />
+        <property name="services" ref="utService" />
+        <property name="stsProperties" ref="utSTSProperties" />
+    </bean>
+
+    <bean id="utValidateDelegate" class="org.apache.cxf.sts.operation.TokenValidateOperation">
+        <property name="tokenValidators" ref="utSamlTokenValidator" />
+        <property name="stsProperties" ref="utSTSProperties" />
+    </bean>
+
+    <bean id="utSamlTokenProvider" class="org.apache.cxf.sts.token.provider.SAMLTokenProvider">
+    </bean>
+
+    <bean id="utSamlTokenValidator" class="org.apache.cxf.sts.token.validator.SAMLTokenValidator">
+    </bean>
+
+    <bean id="utService" class="org.apache.cxf.sts.service.StaticService">
+        <property name="endpoints" ref="utEndpoints" />
+    </bean>
+
+    <util:list id="utEndpoints">
+        <value>http://localhost:(\d)*/SoapContext/SoapPort</value>
+    </util:list>
+
+    <bean id="utSTSProperties" class="org.apache.cxf.sts.StaticSTSProperties">
+        <property name="signaturePropertiesFile" value="stsKeystore.properties" />
+        <property name="signatureUsername" value="mystskey" />
+        <property name="callbackHandlerClass" value="demo.wssec.sts.STSCallbackHandler" />
+        <property name="issuer" value="DoubleItSTSIssuer" />
+    </bean>
+
+    <jaxws:endpoint id="UTSTS" implementor="#utSTSProviderBean"
+        address="http://localhost:8080/SecurityTokenService/UT" wsdlLocation="wsdl/ws-trust-1.4-service.wsdl"
+        xmlns:ns1="http://docs.oasis-open.org/ws-sx/ws-trust/200512/"
+        serviceName="ns1:SecurityTokenService" endpointName="ns1:UT_Port">
+        <jaxws:properties>
+            <entry key="ws-security.callback-handler" value="demo.wssec.sts.STSCallbackHandler" />
+            <entry key="ws-security.signature.properties" value="stsKeystore.properties" />
+            <entry key="ws-security.signature.username" value="mystskey" />
+        </jaxws:properties>
+    </jaxws:endpoint>
+
+</beans>
+