Author: jim.ma
Date: 2011-07-10 10:57:59 -0400 (Sun, 10 Jul 2011)
New Revision: 14671
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Client_Encrypt.properties
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Client_Sign.properties
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/HelloWorld.java
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/HelloWorldImpl.java
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/JAXWSHandler.java
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server.java
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server_Decrypt.properties
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server_SignVerf.properties
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/UsernamePasswordCallback.java
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/WSSecTest.java
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/client-keystore.jks
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/client-truststore.jks
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/client.xml
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/server-keystore.jks
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/server-truststore.jks
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/server.xml
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
Log:
[JBPAPP-6822]:Remove the duplicate soap body element when wsse and handler chain are
enabled
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java 2011-07-08
13:20:24 UTC (rev 14670)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java 2011-07-10
14:57:59 UTC (rev 14671)
@@ -70,6 +70,7 @@
*/
public class SAAJInInterceptor extends AbstractSoapInterceptor {
private static final ResourceBundle BUNDLE =
BundleUtils.getBundle(SAAJInInterceptor.class);
+ private static final String BODY_FILLED_IN = SAAJInInterceptor.class.getName() +
".BODY_DONE";
private MessageFactory factory11;
private MessageFactory factory12;
@@ -96,6 +97,11 @@
}
public void handleMessage(SoapMessage message) throws Fault {
+ Boolean bodySet = (Boolean)message.get(BODY_FILLED_IN);
+ if (bodySet != null && bodySet == Boolean.TRUE) {
+ return;
+ }
+ message.put(BODY_FILLED_IN, Boolean.TRUE);
try {
MessageFactory factory = getFactory(message);
SOAPMessage soapMessage = factory.createMessage();
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Client_Encrypt.properties
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Client_Encrypt.properties
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Client_Encrypt.properties 2011-07-10
14:57:59 UTC (rev 14671)
@@ -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=storepassword
+org.apache.ws.security.crypto.merlin.keystore.alias=serverx509v1
+org.apache.ws.security.crypto.merlin.file=org/apache/cxf/systest/ws/security/handler/client-truststore.jks
\ No newline at end of file
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Client_Sign.properties
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Client_Sign.properties
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Client_Sign.properties 2011-07-10
14:57:59 UTC (rev 14671)
@@ -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=storepassword
+org.apache.ws.security.crypto.merlin.keystore.alias=clientx509v1
+org.apache.ws.security.crypto.merlin.file=org/apache/cxf/systest/ws/security/handler/client-keystore.jks
+
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/HelloWorld.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/HelloWorld.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/HelloWorld.java 2011-07-10
14:57:59 UTC (rev 14671)
@@ -0,0 +1,30 @@
+/**
+ * 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.cxf.systest.ws.security.handler;
+
+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);
+
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/HelloWorldImpl.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/HelloWorldImpl.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/HelloWorldImpl.java 2011-07-10
14:57:59 UTC (rev 14671)
@@ -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.cxf.systest.ws.security.handler;
+
+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.cxf.systest.ws.security.handler.HelloWorld")
+public class HelloWorldImpl implements HelloWorld {
+ @WebMethod
+ public String sayHello(@WebParam(name = "toWhom") String toWhom) {
+ return "Hello " + toWhom;
+
+ }
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/JAXWSHandler.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/JAXWSHandler.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/JAXWSHandler.java 2011-07-10
14:57:59 UTC (rev 14671)
@@ -0,0 +1,91 @@
+/**
+ * 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.cxf.systest.ws.security.handler;
+
+import java.io.PrintStream;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+public class JAXWSHandler implements SOAPHandler<SOAPMessageContext> {
+
+ private PrintStream out;
+
+ public JAXWSHandler() {
+ setLogStream(System.out);
+ }
+
+ protected final void setLogStream(PrintStream ps) {
+ out = ps;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void init(Map c) {
+ }
+
+ public Set<QName> getHeaders() {
+ return null;
+ }
+
+ public boolean handleMessage(SOAPMessageContext smc) {
+ logToSystemOut(smc);
+ return true;
+ }
+
+ public boolean handleFault(SOAPMessageContext smc) {
+ logToSystemOut(smc);
+ return true;
+ }
+
+ public void close(MessageContext messageContext) {
+
+ }
+
+ public void destroy() {
+
+ }
+
+ protected void logToSystemOut(SOAPMessageContext smc) {
+ Boolean outboundProperty =
(Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+
+ if (outboundProperty.booleanValue()) {
+ out.println("\nOutbound message:");
+ } else {
+ out.println("\nInbound message:");
+ }
+
+ SOAPMessage message = smc.getMessage();
+ try {
+ message.writeTo(out);
+ out.println();
+ } catch (Exception e) {
+ out.println("Exception in handler: " + e);
+ }
+
+ out.println("WSDL_SERVICE = " + smc.get(MessageContext.WSDL_SERVICE));
+ out.println("WSDL_INTERFACE = " +
smc.get(MessageContext.WSDL_INTERFACE));
+ out.println("WSDL_PORT = " + smc.get(MessageContext.WSDL_PORT));
+ out.println("WSDL_OPERATION = " +
smc.get(MessageContext.WSDL_OPERATION));
+ }
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server.java 2011-07-10
14:57:59 UTC (rev 14671)
@@ -0,0 +1,47 @@
+/**
+ * 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.cxf.systest.ws.security.handler;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class Server extends AbstractBusTestServerBase {
+ public static final String PORT = allocatePort(Server.class);
+
+ protected void run() {
+ SpringBusFactory factory = new SpringBusFactory();
+ Bus bus =
factory.createBus("org/apache/cxf/systest/ws/security/handler/server.xml");
+ BusFactory.setDefaultBus(bus);
+ setBus(bus);
+ }
+
+ public static void main(String[] args) {
+ try {
+ Server s = new Server();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server_Decrypt.properties
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server_Decrypt.properties
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server_Decrypt.properties 2011-07-10
14:57:59 UTC (rev 14671)
@@ -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=storepassword
+org.apache.ws.security.crypto.merlin.keystore.alias=serverx509v1
+org.apache.ws.security.crypto.merlin.file=org/apache/cxf/systest/ws/security/handler/server-keystore.jks
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server_SignVerf.properties
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server_SignVerf.properties
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/Server_SignVerf.properties 2011-07-10
14:57:59 UTC (rev 14671)
@@ -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=storepassword
+org.apache.ws.security.crypto.merlin.keystore.alias=clientx509v1
+org.apache.ws.security.crypto.merlin.file=org/apache/cxf/systest/ws/security/handler/server-truststore.jks
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/UsernamePasswordCallback.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/UsernamePasswordCallback.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/UsernamePasswordCallback.java 2011-07-10
14:57:59 UTC (rev 14671)
@@ -0,0 +1,62 @@
+/**
+ * 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.cxf.systest.ws.security.handler;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+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 UsernamePasswordCallback implements CallbackHandler {
+ private Map<String, String> passwords = new HashMap<String, String>();
+
+ public UsernamePasswordCallback() {
+ passwords.put("Alice", "ecilA");
+ passwords.put("abcd", "dcba");
+ passwords.put("clientx509v1", "storepassword");
+ passwords.put("serverx509v1", "storepassword");
+ }
+
+ /**
+ * Here, we attempt to get the password from the private alias/passwords map.
+ */
+ public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];
+ String pass = passwords.get(pc.getIdentifier());
+ if (pass != null) {
+ pc.setPassword(pass);
+ return;
+ }
+ }
+ throw new IOException();
+ }
+
+ /**
+ * Add an alias/password pair to the callback mechanism.
+ */
+ public void setAliasPassword(String alias, String password) {
+ passwords.put(alias, password);
+ }
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/WSSecTest.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/WSSecTest.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/WSSecTest.java 2011-07-10
14:57:59 UTC (rev 14671)
@@ -0,0 +1,58 @@
+/**
+ * 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.cxf.systest.ws.security.handler;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class WSSecTest extends AbstractBusClientServerTestBase {
+ public static final String PORT = allocatePort(Server.class);
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ assertTrue("Server failed to launch", launchServer(Server.class));
+ }
+
+ @Test
+ public void testClientServer() throws Exception {
+
+ Bus bus = new
SpringBusFactory().createBus("org/apache/cxf/systest/ws/security/handler/client.xml");
+
+ BusFactory.setDefaultBus(bus);
+ BusFactory.setThreadDefaultBus(bus);
+ Service service = Service.create(new URL("http://localhost:" + PORT +
"/wsse/HelloWorldWS?wsdl"),
+ new
QName("http://cxf.apache.org/wsse/handler/helloworld",
+ "HelloWorldImplService"));
+ QName portName = new
QName("http://cxf.apache.org/wsse/handler/helloworld",
"HelloWorldPort");
+
+ HelloWorld port = service.getPort(portName, HelloWorld.class);
+ updateAddressPort(port, PORT);
+ assertEquals("Hello CXF", port.sayHello("CXF"));
+ }
+
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/client-keystore.jks
===================================================================
(Binary files differ)
Property changes on:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/client-keystore.jks
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/client-truststore.jks
===================================================================
(Binary files differ)
Property changes on:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/client-truststore.jks
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/client.xml
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/client.xml
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/client.xml 2011-07-10
14:57:59 UTC (rev 14671)
@@ -0,0 +1,79 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xmlns:cxf="http://cxf.apache.org/core"
+
xmlns:wsa="http://cxf.apache.org/ws/addressing"
+
xmlns:http="http://cxf.apache.org/transports/http/configuration"
+
xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy&q...
+
xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"
+
xmlns:beans='http://www.springframework.org/schema/beans'
+
xmlns:jaxws='http://cxf.apache.org/jaxws'
+ xmlns:ns1='http://secure_invoke/helloworld'
+ xsi:schemaLocation="
+
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
+
http://schemas.xmlsoap.org/ws/2005/02/rm/policy
http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
+
http://cxf.apache.org/ws/rm/manager
http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd
+
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+
+ <bean id="UsernameTokenSign_Request"
class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"
+
name="http://cxf.apache.org/wsse/handler/helloworld}HelloWorldPort.R...
>
+ <constructor-arg>
+ <map>
+ <entry key="action" value="UsernameToken Timestamp
Signature"/>
+ <entry key="passwordType" value="PasswordDigest"/>
+ <entry key="user" value="clientx509v1"/>
+ <entry key="passwordCallbackClass"
value="org.apache.cxf.systest.ws.security.handler.UsernamePasswordCallback"/>
+ <entry key="signaturePropFile"
value="org/apache/cxf/systest/ws/security/handler/Client_Sign.properties"/>
+ <entry key="signatureKeyIdentifier"
value="DirectReference"/>
+ <entry key="signatureParts"
value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401...
+ </map>
+ </constructor-arg>
+ </bean>
+
+ <bean id="UsernameTokenSign_Response"
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"
+
name="{http://cxf.apache.org/wsse/handler/helloworld}HelloWorldPort....
>
+ <constructor-arg>
+ <map>
+ <entry key="action" value="UsernameToken Timestamp
Signature"/>
+ <entry key="passwordType" value="PasswordText"/>
+ <entry key="user" value="serverx509v1"/>
+ <entry key="passwordCallbackClass"
value="org.apache.cxf.systest.ws.security.handler.UsernamePasswordCallback"/>
+ <entry key="signaturePropFile"
value="org/apache/cxf/systest/ws/security/handler/Client_Encrypt.properties"/>
+ <entry key="signatureKeyIdentifier"
value="DirectReference"/>
+ </map>
+ </constructor-arg>
+ </bean>
+
+
+ <cxf:bus>
+ <cxf:outInterceptors>
+ <ref bean="UsernameTokenSign_Request"/>
+ <bean
class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>
+ </cxf:outInterceptors>
+ <cxf:inInterceptors>
+ <ref bean="UsernameTokenSign_Response"/>
+ <bean
class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
+ </cxf:inInterceptors>
+ </cxf:bus>
+
+</beans>
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/server-keystore.jks
===================================================================
(Binary files differ)
Property changes on:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/server-keystore.jks
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/server-truststore.jks
===================================================================
(Binary files differ)
Property changes on:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/server-truststore.jks
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/server.xml
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/server.xml
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/handler/server.xml 2011-07-10
14:57:59 UTC (rev 14671)
@@ -0,0 +1,82 @@
+<?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:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:beans='http://www.springframework.org/schema/beans'
+
xmlns:jaxws='http://cxf.apache.org/jaxws'
+
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'>
+ <bean
+ class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
/>
+
+ <bean id="UsernameTokenSign_Request"
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+ <constructor-arg>
+ <map>
+ <entry key="action" value="UsernameToken Timestamp Signature"
/>
+ <entry key="passwordType" value="PasswordDigest" />
+ <entry key="user" value="serverx509v1" />
+ <entry key="passwordCallbackClass"
+ value="org.apache.cxf.systest.ws.security.handler.UsernamePasswordCallback"
/>
+ <entry key="signaturePropFile"
+ value="org/apache/cxf/systest/ws/security/handler/Server_SignVerf.properties"
/>
+ <entry key="signatureKeyIdentifier" value="DirectReference"
/>
+ </map>
+ </constructor-arg>
+ </bean>
+
+ <bean id="UsernameTokenSign_Response"
class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+ <constructor-arg>
+ <map>
+ <entry key="action" value="UsernameToken Timestamp Signature"
/>
+ <entry key="passwordType" value="PasswordText" />
+ <entry key="user" value="serverx509v1" />
+ <entry key="passwordCallbackClass"
+ value="org.apache.cxf.systest.ws.security.handler.UsernamePasswordCallback"
/>
+ <entry key="signaturePropFile"
+ value="org/apache/cxf/systest/ws/security/handler/Server_Decrypt.properties"
/>
+ <entry key="signatureKeyIdentifier" value="DirectReference"
/>
+ <entry key="signatureParts"
+
value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401...
/>
+ </map>
+ </constructor-arg>
+ </bean>
+
+ <jaxws:endpoint id='HelloWorldWS'
+ address="http://localhost:${testutil.ports.Server}/wsse/HelloWorldWS"
+ wsdlLocation=""
+ implementor='org.apache.cxf.systest.ws.security.handler.HelloWorldImpl'>
+ <jaxws:inInterceptors>
+ <ref bean="UsernameTokenSign_Request" />
+ <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
+ </jaxws:inInterceptors>
+ <jaxws:outInterceptors>
+ <ref bean="UsernameTokenSign_Response" />
+ <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
+ </jaxws:outInterceptors>
+ <jaxws:handlers>
+ <bean class="org.apache.cxf.systest.ws.security.handler.JAXWSHandler"
/>
+ </jaxws:handlers>
+ </jaxws:endpoint>
+
+
+</beans>