JBossWS SVN: r18313 - in stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests: src/test/java/org/jboss/test/ws/jaxws/cxf and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: psakar
Date: 2014-02-07 05:55:20 -0500 (Fri, 07 Feb 2014)
New Revision: 18313
Added:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/CustomJaxbValidationTestCase.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/CustomSchemaValidationEventHandler.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/HelloWS.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/HelloWSImpl.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/InputName.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/OutputName.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/jbossws-cxf-only-schema-validation.xml
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/jbossws-cxf.xml
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/web.xml
Modified:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
Log:
adding test of custom JAXB validation handlers for outgoing messages
Modified: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2014-02-07 09:16:05 UTC (rev 18312)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2014-02-07 10:55:20 UTC (rev 18313)
@@ -59,6 +59,18 @@
prefix="WEB-INF/wsdl"/>
</war>
+ <!-- jaxws-cxf-customJaxbValidation -->
+ <war destfile="${tests.output.dir}/test-libs/jaxws-cxf-customJaxbValidation.war">
+ <classes dir="${tests.output.dir}/test-classes">
+ <exclude name="org/jboss/test/ws/jaxws/cxf/customJaxbValidation/*TestCase.class"/>
+ <include name="org/jboss/test/ws/jaxws/cxf/customJaxbValidation/*.class"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/test-resources/jaxws/cxf/customJaxbValidation/WEB-INF">
+ <include name="jbossws-cxf.xml"/>
+ <include name="web.xml"/>
+ </webinf>
+ </war>
+
<!-- jaxws-cxf-descriptor -->
<war warfile="${tests.output.dir}/test-libs/jaxws-cxf-descriptor.war" webxml="${tests.output.dir}/test-resources/jaxws/cxf/descriptor/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
@@ -67,7 +79,7 @@
</classes>
<classes dir="${tests.output.dir}/test-resources/jaxws/cxf/descriptor/">
<include name="cxf.xml"/>
- </classes>
+ </classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/cxf/descriptor/WEB-INF">
<include name="jbossws-cxf.xml"/>
</webinf>
@@ -116,7 +128,7 @@
<include name="org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleService*.class" />
</classes>
</war>
-
+
<!-- saaj-soap-connection -->
<war
warfile="${tests.output.dir}/test-libs/saaj-soap-connection.war"
@@ -127,7 +139,7 @@
<include name="org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.class"/>
</classes>
<zipfileset
- dir="${tests.output.dir}/test-resources/saaj/jbws3084/WEB-INF/wsdl"
+ dir="${tests.output.dir}/test-resources/saaj/jbws3084/WEB-INF/wsdl"
prefix="WEB-INF/wsdl"/>
</war>
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/CustomJaxbValidationTestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/CustomJaxbValidationTestCase.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/CustomJaxbValidationTestCase.java 2014-02-07 10:55:20 UTC (rev 18313)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.customJaxbValidation;
+
+
+
+import static org.jboss.test.ws.jaxws.cxf.customJaxbValidation.HelloWSImpl.*;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * [JBWS-1178] Multiple virtual host and soap:address problem
+ * [JBWS-864] soap:address in wsdl ignores <url-pattern>
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 05-Oct-2006
+ */
+public class CustomJaxbValidationTestCase extends JBossWSTest
+{
+
+
+ private static final String name = "jaxws-cxf-customJaxbValidation";
+ private static final String NAMESPACE = createNamespaceFromPackageOfClass(HelloWS.class);
+ private static final QName SERVICE_QNAME = new QName(NAMESPACE, HelloWS.class.getSimpleName());
+ private static final String ENDPOINT_URL = "http://" + JBossWSTestHelper.getServerHost() + ":8080/" + name + "/hello";
+ private static final String WSDL_URL = ENDPOINT_URL + "?wsdl";
+ private HelloWS port;
+
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(CustomJaxbValidationTestCase.class, name + ".war");
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ URL wsdl = new URL(WSDL_URL);
+ Service service = Service.create(wsdl, SERVICE_QNAME);
+ QName portQName = new QName(NAMESPACE, "hello");
+ port = service.getPort(portQName, HelloWS.class);
+ }
+
+
+ public void testOutput() throws Exception
+ {
+ String inputName = "name";
+ OutputName result = port.hello(inputName);
+ assertEquals(inputName, result.getName());
+ }
+
+ public void testOutputValidationFailureIsHandledByCustomSchemaValidationHandler() throws Exception
+ {
+ String inputName = SET_OUPUT_NAME_TO_NULL;
+ OutputName result = port.hello(inputName);
+ assertEquals(null, result.getName());
+ }
+
+ public void testOuputForInputName() throws Exception
+ {
+ String inputName = "name";
+ OutputName result = port.helloValidateInput(new InputName(inputName));
+ assertEquals(inputName, result.getName());
+ }
+
+ public void testOutputForMissingInputName() throws Exception
+ {
+ OutputName result = port.helloValidateInput(null);
+ assertEquals(NULL_INPUT, result.getName());
+ }
+
+ public void testInputNameValidationFailureIsHandledByCustomSchemaValidationHandler() throws Exception
+ {
+ OutputName result = port.helloValidateInput(new InputName());
+ assertEquals(NULL_INPUT_NAME, result.getName());
+ }
+
+ public void testOutputValidationFailreIsHandledByCustomSchemaValidationHandlerForInputName() throws Exception
+ {
+ String inputName = HelloWSImpl.SET_OUPUT_NAME_TO_NULL;
+ OutputName result = port.helloValidateInput(new InputName(inputName));
+ assertEquals(null, result.getName());
+ }
+
+
+ static String createNamespaceFromPackageOfClass(Class<?> clazz) {
+ String packageName = clazz.getPackage().getName();
+ String names [] = packageName.split("\\.");
+ List<String> namesInReverseOrder = new ArrayList<String>();
+ namesInReverseOrder.addAll(Arrays.asList(names));
+ Collections.reverse(namesInReverseOrder);
+ StringBuilder name = new StringBuilder();
+ name.append("http://");
+ boolean first = true;
+ for (String part : namesInReverseOrder) {
+ if (!first)
+ name.append(".");
+ else
+ first = false;
+ name.append(part);
+ }
+ name.append("/");
+ return name.toString();
+ }
+
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/CustomSchemaValidationEventHandler.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/CustomSchemaValidationEventHandler.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/CustomSchemaValidationEventHandler.java 2014-02-07 10:55:20 UTC (rev 18313)
@@ -0,0 +1,21 @@
+package org.jboss.test.ws.jaxws.cxf.customJaxbValidation;
+
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+
+public class CustomSchemaValidationEventHandler implements ValidationEventHandler {
+
+ public CustomSchemaValidationEventHandler() {
+ info(getClass().getSimpleName() + " created");
+ }
+
+ private void info(String info) {
+ System.err.println(info);
+ }
+
+ @Override
+ public boolean handleEvent(ValidationEvent event) {
+ info(getClass().getSimpleName() + " handle successfully event " + event);
+ return true;
+ }
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/HelloWS.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/HelloWS.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/HelloWS.java 2014-02-07 10:55:20 UTC (rev 18313)
@@ -0,0 +1,14 @@
+/*
+ * To the extent possible under law, Red Hat, Inc. has dedicated all copyright
+ * to this software to the public domain worldwide, pursuant to the CC0 Public
+ * Domain Dedication. This software is distributed without any warranty. See
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+package org.jboss.test.ws.jaxws.cxf.customJaxbValidation;
+
+(a)javax.jws.WebService(portName = "hello")
+public interface HelloWS {
+ public OutputName hello(String name);
+ public OutputName helloValidateInput(InputName name);
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/HelloWSImpl.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/HelloWSImpl.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/HelloWSImpl.java 2014-02-07 10:55:20 UTC (rev 18313)
@@ -0,0 +1,40 @@
+/*
+ * To the extent possible under law, Red Hat, Inc. has dedicated all copyright
+ * to this software to the public domain worldwide, pursuant to the CC0 Public
+ * Domain Dedication. This software is distributed without any warranty. See
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+package org.jboss.test.ws.jaxws.cxf.customJaxbValidation;
+
+(a)javax.jws.WebService(serviceName="HelloWS", portName="hello")
+public class HelloWSImpl implements HelloWS {
+ public static final String SET_OUPUT_NAME_TO_NULL = "SET_OUPUT_NAME_TO_NULL";
+
+ public static final String NULL_INPUT = "NULL_INPUT";
+ public static final String NULL_INPUT_NAME = "NULL_INPUT_NAME";
+
+
+ @Override
+ public OutputName hello(String name) {
+ System.err.println("Hello, " + name);
+ if (name == null)
+ return new OutputName(NULL_INPUT);
+ if (SET_OUPUT_NAME_TO_NULL.equals(name))
+ return new OutputName();
+ return new OutputName(name) ;
+ }
+
+ @Override
+ public OutputName helloValidateInput(InputName input) {
+ System.err.println("Hello, " + (input == null ? NULL_INPUT_NAME : input.getName()));
+ if (input == null)
+ return new OutputName(NULL_INPUT);
+ if (input.getName() == null)
+ return new OutputName(NULL_INPUT_NAME);
+ if (SET_OUPUT_NAME_TO_NULL.equals(input.getName()))
+ return new OutputName();
+ return new OutputName(input.getName()) ;
+ }
+
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/InputName.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/InputName.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/InputName.java 2014-02-07 10:55:20 UTC (rev 18313)
@@ -0,0 +1,25 @@
+package org.jboss.test.ws.jaxws.cxf.customJaxbValidation;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "input")
+public class InputName {
+ private String name;
+
+ public InputName() {
+ }
+
+ public InputName(String name) {
+ this.name = name;
+ }
+
+ @XmlElement(nillable = false, required = true)
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/OutputName.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/OutputName.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/customJaxbValidation/OutputName.java 2014-02-07 10:55:20 UTC (rev 18313)
@@ -0,0 +1,25 @@
+package org.jboss.test.ws.jaxws.cxf.customJaxbValidation;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "output")
+public class OutputName {
+ private String name;
+
+ public OutputName() {
+ }
+
+ public OutputName(String name) {
+ this.name = name;
+ }
+
+ @XmlElement(nillable = false, required = true)
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/jbossws-cxf-only-schema-validation.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/jbossws-cxf-only-schema-validation.xml (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/jbossws-cxf-only-schema-validation.xml 2014-02-07 10:55:20 UTC (rev 18313)
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+ <jaxws:endpoint id="hello"
+ address="http://localhost:8080/jaxws-cxf-customJaxbValidation/hello"
+ implementor="org.jboss.test.ws.jaxws.cxf.customJaxbValidation.HelloWSImpl">
+ <jaxws:features>
+ <cxf:logging/>
+ </jaxws:features>
+ <jaxws:properties>
+ <entry key="schema-validation-enabled" value="true"/>
+ </jaxws:properties>
+ </jaxws:endpoint>
+</beans>
Property changes on: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/jbossws-cxf-only-schema-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/jbossws-cxf.xml (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/jbossws-cxf.xml 2014-02-07 10:55:20 UTC (rev 18313)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+ <jaxws:endpoint id="hello"
+ address="http://localhost:8080/jaxws-cxf-customJaxbValidation/hello"
+ implementor="org.jboss.test.ws.jaxws.cxf.customJaxbValidation.HelloWSImpl">
+ <jaxws:features>
+ <cxf:logging/>
+ </jaxws:features>
+ <jaxws:properties>
+ <entry key="jaxb-validation-event-handler">
+ <bean class="org.jboss.test.ws.jaxws.cxf.customJaxbValidation.CustomSchemaValidationEventHandler" />
+ </entry>
+ <entry key="jaxb-writer-validation-event-handler">
+ <bean class="org.jboss.test.ws.jaxws.cxf.customJaxbValidation.CustomSchemaValidationEventHandler" />
+ </entry>
+ <entry key="schema-validation-enabled" value="true"/>
+ </jaxws:properties>
+ </jaxws:endpoint>
+</beans>
Property changes on: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/jbossws-cxf.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/web.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/web.xml (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/web.xml 2014-02-07 10:55:20 UTC (rev 18313)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ To the extent possible under law, Red Hat, Inc. has dedicated all copyright
+ to this software to the public domain worldwide, pursuant to the CC0 Public
+ Domain Dedication. This software is distributed without any warranty. See
+ <http://creativecommons.org/publicdomain/zero/1.0/>.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
+ <servlet>
+ <servlet-name>HelloWS</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.cxf.customJaxbValidation.HelloWSImpl</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>HelloWS</servlet-name>
+ <url-pattern>/hello</url-pattern>
+ </servlet-mapping>
+</web-app>
Property changes on: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/customJaxbValidation/WEB-INF/web.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
10 years, 2 months
JBossWS SVN: r18312 - stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-02-07 04:16:05 -0500 (Fri, 07 Feb 2014)
New Revision: 18312
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/web.xml
Log:
[JBWS-3738] Fixing reference to STS class (moved in former commit)
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/web.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/web.xml 2014-02-06 21:28:28 UTC (rev 18311)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/web.xml 2014-02-07 09:16:05 UTC (rev 18312)
@@ -6,7 +6,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>TestSecurityTokenService</servlet-name>
- <servlet-class>org.jboss.test.ws.jaxws.samples.wsse.policy.trust.SampleSTS</servlet-class>
+ <servlet-class>org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.SampleSTS</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestSecurityTokenService</servlet-name>
10 years, 2 months
JBossWS SVN: r18311 - in stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust: actas and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2014-02-06 16:28:28 -0500 (Thu, 06 Feb 2014)
New Revision: 18311
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsOutInterceptor.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/UsernameTokenCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java
Log:
[JBWS-3738] added copyright text and other misc minor changes.
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java 2014-02-06 18:11:34 UTC (rev 18310)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java 2014-02-06 21:28:28 UTC (rev 18311)
@@ -24,6 +24,7 @@
import junit.framework.Test;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface;
import org.jboss.wsf.test.JBossWSTest;
import javax.xml.namespace.QName;
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsOutInterceptor.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsOutInterceptor.java 2014-02-06 18:11:34 UTC (rev 18310)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsOutInterceptor.java 2014-02-06 21:28:28 UTC (rev 18311)
@@ -58,14 +58,20 @@
dumpMsgInfo(key, (org.apache.cxf.service.model.MessageInfo)o);
} else if (o instanceof org.apache.cxf.service.model.BindingMessageInfo) {
- org.apache.cxf.service.model.BindingMessageInfo bMsgInfo = (org.apache.cxf.service.model.BindingMessageInfo)o;
+ org.apache.cxf.service.model.BindingMessageInfo bMsgInfo =
+ (org.apache.cxf.service.model.BindingMessageInfo)o;
org.apache.cxf.service.model.MessageInfo mInfo = bMsgInfo.getMessageInfo();
dumpMsgInfo(key, mInfo);
- } else {
- System.out.println("##ACTAS key: " + key + " value++: " + o.getClass().getCanonicalName());
-
+ } else if (o instanceof ArrayList) {
+ for (Object obj: (ArrayList)o){
+ System.out.println("##ACTAS arrayItem: " + obj.getClass().getCanonicalName());
+ }
}
+ else {
+ System.out.println("##ACTAS key: " + key + " value++: "
+ + o.getClass().getCanonicalName());
+ }
}
}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java 2014-02-06 18:11:34 UTC (rev 18310)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java 2014-02-06 21:28:28 UTC (rev 18311)
@@ -25,20 +25,18 @@
import org.apache.cxf.BusFactory;
import org.apache.cxf.annotations.EndpointProperties;
import org.apache.cxf.annotations.EndpointProperty;
-import org.apache.cxf.interceptor.OutInterceptors;
import org.apache.cxf.ws.security.SecurityConstants;
import org.apache.cxf.ws.security.trust.STSClient;
-import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsCallbackHandler;
-import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils;
import javax.jws.WebService;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import java.net.*;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Map;
-import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
/**
* User: rsearls(a)redhat.com
@@ -61,7 +59,7 @@
@EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsCallbackHandler")
})
-@OutInterceptors(interceptors = {"org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsOutInterceptor"})
+//TODO @OutInterceptors(interceptors = {"org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsOutInterceptor"})
public class ActAsServiceImpl implements ActAsServiceIface
{
public String sayHello() {
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfCallbackHandler.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfCallbackHandler.java 2014-02-06 18:11:34 UTC (rev 18310)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfCallbackHandler.java 2014-02-06 21:28:28 UTC (rev 18311)
@@ -21,6 +21,27 @@
import org.jboss.wsf.stack.cxf.extensions.security.PasswordCallbackHandler;
import java.util.HashMap;
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
import java.util.Map;
/**
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/UsernameTokenCallbackHandler.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/UsernameTokenCallbackHandler.java 2014-02-06 18:11:34 UTC (rev 18310)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/UsernameTokenCallbackHandler.java 2014-02-06 21:28:28 UTC (rev 18311)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared;
import org.apache.cxf.helpers.DOMUtils;
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java 2014-02-06 18:11:34 UTC (rev 18310)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java 2014-02-06 21:28:28 UTC (rev 18311)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared;
import java.net.Inet6Address;
10 years, 2 months
JBossWS SVN: r18310 - in projects/plugins/maven: archetypes and 14 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-02-06 13:11:34 -0500 (Thu, 06 Feb 2014)
New Revision: 18310
Added:
projects/plugins/maven/archetypes/
projects/plugins/maven/archetypes/jaxws-codefirst/
projects/plugins/maven/archetypes/jaxws-codefirst/branches/
projects/plugins/maven/archetypes/jaxws-codefirst/tags/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/pom.xml
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype.xml
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/README
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/pom.xml
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorld.java
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorldImpl.java
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/HelloWorldIntegrationTest.java
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/JAXWSProviderTest.java
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/resources/
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/resources/log4j.xml
Log:
[JBWS-3617] Adding a new maven archetype project for generating a simple WS project to develop a codefirst WS endpoint with JBossWS-CXF (proper dependencies set, logging properly configured, plugin for automatic deploy/undeploy to WildFly included)
Added: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/pom.xml
===================================================================
--- projects/plugins/maven/archetypes/jaxws-codefirst/trunk/pom.xml (rev 0)
+++ projects/plugins/maven/archetypes/jaxws-codefirst/trunk/pom.xml 2014-02-06 18:11:34 UTC (rev 18310)
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-parent</artifactId>
+ <version>1.1.0.GA</version>
+ </parent>
+ <groupId>org.jboss.ws.plugins.archetypes</groupId>
+ <artifactId>jaxws-codefirst</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>maven-archetype</packaging>
+
+ <name>JBossWS-CXF Archetype - Simple JAX-WS Code First</name>
+ <description>Creates a project for developing a Web Service starting from Java code and using JBossWS</description>
+
+ <!-- Source Control Management -->
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossws/projects/plugins/maven/arc...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossws/projects/plugins/maven/archet...</developerConnection>
+ <url>http://fisheye.jboss.com/viewrep/JBossWS/projects/plugins/maven/archetype...</url>
+ </scm>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-packaging</artifactId>
+ <version>2.1</version>
+ </extension>
+ </extensions>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <escapeString>\</escapeString>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
Property changes on: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml
===================================================================
--- projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml (rev 0)
+++ projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml 2014-02-06 18:11:34 UTC (rev 18310)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descript... http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="cxf-jaxrs-simple-sample"
+ xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descript..."
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <requiredProperties>
+ <requiredProperty key="jbosswscxf" >
+ <defaultValue>4.2.3.Final</defaultValue>
+ </requiredProperty>
+ </requiredProperties>
+ <fileSets>
+ <fileSet filtered="true" packaged="true" encoding="UTF-8">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="true" encoding="UTF-8">
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>src/test/resources</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet encoding="UTF-8">
+ <directory></directory>
+ <includes>
+ <include>README</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</archetype-descriptor>
Property changes on: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype.xml
===================================================================
--- projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype.xml (rev 0)
+++ projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype.xml 2014-02-06 18:11:34 UTC (rev 18310)
@@ -0,0 +1,7 @@
+<archetype>
+ <id>jaxws-codefirst</id>
+ <sources>
+ <source>src/main/java/HelloWorld.java</source>
+ <source>src/main/java/HelloWorldImpl.java</source>
+ </sources>
+</archetype>
Property changes on: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/README
===================================================================
--- projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/README (rev 0)
+++ projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/README 2014-02-06 18:11:34 UTC (rev 18310)
@@ -0,0 +1,17 @@
+This is a sample project for developing a Web Service starting from Java code and using JBossWS.
+
+The project has the usual Maven structure and is built with:
+
+> mvn clean package
+
+To deploy the generated WAR archive to a running WildFly instance use:
+
+> mvn wildfly:deploy
+
+Once the WAR is deployed, the integration testsuite is run with:
+
+> mvn integration-test
+
+Finally, you can undeploy the WAR with:
+
+> mvn wildfly:undeploy
Property changes on: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/README
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/pom.xml
===================================================================
--- projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/pom.xml (rev 0)
+++ projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/pom.xml 2014-02-06 18:11:34 UTC (rev 18310)
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>$groupId</groupId>
+ <artifactId>$artifactId</artifactId>
+ <version>$version</version>
+ <packaging>war</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-7.0</artifactId>
+ <version>1.0.0.Final</version>
+ <type>pom</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws.cxf</groupId>
+ <artifactId>jbossws-cxf-client</artifactId>
+ <version>$jbosswscxf</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>JBOSS_NEXUS</id>
+ <url>http://repository.jboss.org/nexus/content/groups/public</url>
+ </repository>
+ </repositories>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>log4j.xml</include>
+ </includes>
+ </testResource>
+ </testResources>
+ <finalName>jaxws-codefirst</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.wildfly.plugins</groupId>
+ <artifactId>wildfly-maven-plugin</artifactId>
+ <version>1.0.0.Beta1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.7.2</version>
+ <configuration>
+ <skip>true</skip>
+ <failIfNoTests>false</failIfNoTests>
+ <systemProperties>
+ <property>
+ <name>log4j.output.dir</name>
+ <value>\${project.build.directory}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <includes>
+ <include>**/*IntegrationTest.java</include>
+ <include>**/*IntegrationTestCase.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>tests</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <includes>
+ <include>**/*Test.java</include>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*IntegrationTest.java</exclude>
+ <exclude>**/*IntegrationTestCase.java</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Property changes on: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorld.java
===================================================================
--- projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorld.java (rev 0)
+++ projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorld.java 2014-02-06 18:11:34 UTC (rev 18310)
@@ -0,0 +1,9 @@
+package ${package};
+
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://hello.world.ns/")
+public interface HelloWorld {
+ String sayHi(String text);
+}
+
Property changes on: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorld.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorldImpl.java
===================================================================
--- projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorldImpl.java (rev 0)
+++ projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorldImpl.java 2014-02-06 18:11:34 UTC (rev 18310)
@@ -0,0 +1,16 @@
+package ${package};
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface = "${package}.HelloWorld",
+ targetNamespace = "http://hello.world.ns/",
+ name = "HelloWorld",
+ serviceName = "HelloWorldService",
+ portName = "HelloWorldPort")
+public class HelloWorldImpl implements HelloWorld {
+
+ public String sayHi(String text) {
+ return "Hello " + text;
+ }
+}
+
Property changes on: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorldImpl.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/HelloWorldIntegrationTest.java
===================================================================
--- projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/HelloWorldIntegrationTest.java (rev 0)
+++ projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/HelloWorldIntegrationTest.java 2014-02-06 18:11:34 UTC (rev 18310)
@@ -0,0 +1,20 @@
+package ${package};
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.junit.Assert;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class HelloWorldIntegrationTest {
+
+ @Test
+ public void testSayHi() throws Exception {
+ Service service = Service.create(new URL("http://localhost:8080/jaxws-codefirst/HelloWorldService?wsdl"), new QName("http://hello.world.ns/", "HelloWorldService"));
+ HelloWorld port = service.getPort(new QName("http://hello.world.ns/", "HelloWorldPort"), HelloWorld.class);
+ Assert.assertEquals("Hello John", port.sayHi("John"));
+ }
+}
Property changes on: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/HelloWorldIntegrationTest.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/JAXWSProviderTest.java
===================================================================
--- projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/JAXWSProviderTest.java (rev 0)
+++ projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/JAXWSProviderTest.java 2014-02-06 18:11:34 UTC (rev 18310)
@@ -0,0 +1,19 @@
+package ${package};
+
+import java.net.URL;
+
+import javax.xml.ws.spi.Provider;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class JAXWSProviderTest {
+
+ @Test
+ public void test() {
+ Provider p = Provider.provider();
+ Logger.getLogger(this.getClass()).warn("Current JAXWS Provider: " + p);
+ Assert.assertTrue(p.getClass().getName().startsWith("org.jboss."));
+ }
+}
Property changes on: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/JAXWSProviderTest.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/resources/log4j.xml
===================================================================
--- projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/resources/log4j.xml (rev 0)
+++ projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/resources/log4j.xml 2014-02-06 18:11:34 UTC (rev 18310)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!--
+| For more configuration infromation and examples see the Jakarta Log4j
+| owebsite: http://jakarta.apache.org/log4j
+-->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="${log4j.output.dir}/test.log"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="Append" value="true"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c:%L] %m%n"/>
+ </layout>
+
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Threshold" value="WARN"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss.ws">
+ <priority value="DEBUG"/>
+ </category>
+
+ <category name="org.jboss.wsf">
+ <priority value="DEBUG"/>
+ </category>
+
+ <category name="org.apache.cxf">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.springframework">
+ <priority value="WARN"/>
+ </category>
+
+ <category name="sun.rmi">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="com.sun.xml.bind">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="javax.activation">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.apache.commons">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Apache security is verbose -->
+ <category name="org.apache.ws.security">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <!--appender-ref ref="CONSOLE"/-->
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/resources/log4j.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
10 years, 2 months
JBossWS SVN: r18309 - in stack/cxf/trunk/modules/testsuite/cxf-tests: src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust and 7 other directories.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2014-02-06 12:29:54 -0500 (Thu, 06 Feb 2014)
New Revision: 18309
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustOnBehalfOfTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsOutInterceptor.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceIface.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceIface.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/picketlink/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/picketlink/PicketLinkSTService.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServerCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceIface.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/ClientCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/UsernameTokenCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/STSCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService.wsdl
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService_schema1.xsd
Removed:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsOutInterceptor.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceIface.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ClientCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/PicketLinkSTService.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/STSCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/SampleSTS.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServerCallbackHandler.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceIface.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceImpl.java
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java
Log:
[JBWS-3738] added OnBehalfOf test. Restructured trust directory.
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2014-02-06 17:29:54 UTC (rev 18309)
@@ -422,10 +422,10 @@
<war
warfile="${tests.output.dir}/test-libs/jaxws-samples-wsse-policy-trust.war" needxmlfile='false'>
<classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceIface.class"/>
- <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceImpl.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceIface.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceImpl.class"/>
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/jaxws/Say*.class"/>
- <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServerCallbackHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServerCallbackHandler.class"/>
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/WEB-INF">
<include name="wsdl/Security*"/>
@@ -444,8 +444,8 @@
warfile="${tests.output.dir}/test-libs/jaxws-samples-wsse-policy-trust-sts.war"
webxml="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/SampleSTS.class"/>
- <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/STSCallbackHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/STSCallbackHandler.class"/>
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/WEB-INF">
<include name="wsdl/ws-trust*"/>
@@ -475,11 +475,13 @@
needxmlfile='false'>
<classes dir="${tests.output.dir}/test-classes">
<include
- name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAs*.class"/>
+ name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAs*.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/wsse/policy/jaxws/Say*.class"/>
<include
- name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceIface.class"/>
+ name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceIface.class"/>
+ <include
+ name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.class"/>
</classes>
<webinf
dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/WEB-INF">
@@ -504,15 +506,51 @@
</manifest>
</war>
+ <!--jaxws-samples-wsse-policy-trust-onbehalfof -->
+ <war
+ warfile="${tests.output.dir}/test-libs/jaxws-samples-wsse-policy-trust-onbehalfof.war"
+ needxmlfile='false'>
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
+ name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOf*.class"/>
+ <include
+ name="org/jboss/test/ws/jaxws/samples/wsse/policy/jaxws/Say*.class"/>
+ <include
+ name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceIface.class"/>
+ <include
+ name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.class"/>
+ </classes>
+ <webinf
+ dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/WEB-INF">
+ <include name="wsdl/OnBehalfOf*"/>
+ </webinf>
+ <zipfileset
+ dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/WEB-INF"
+ prefix="WEB-INF/classes">
+ <include name="actasstore.jks"/>
+ <include name="actasKeystore.properties"/>
+ </zipfileset>
+ <zipfileset
+ dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/META-INF"
+ prefix="META-INF">
+ <include name="clientstore.jks"/>
+ <include name="clientKeystore.properties"/>
+ </zipfileset>
+ <manifest>
+ <attribute name="Dependencies"
+ value="org.jboss.ws.cxf.jbossws-cxf-client, org.apache.cxf.impl"/>
+ </manifest>
+ </war>
+
<!-- jaxws-samples-wsse-policy-trustPicketLink-sts -->
<war
warfile="${tests.output.dir}/test-libs/jaxws-samples-wsse-policy-trustPicketLink-sts.war"
needxmlfile='false'>
<classes dir="${tests.output.dir}/test-classes">
<include
- name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/PicketLinkSTService.class"/>
+ name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/picketlink/PicketLinkSTService.class"/>
<include
- name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/STSCallbackHandler.class"/>
+ name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/STSCallbackHandler.class"/>
</classes>
<webinf
dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/WEB-INF">
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsCallbackHandler.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsCallbackHandler.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsCallbackHandler.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,44 +0,0 @@
-/**
- * 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.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-import org.jboss.wsf.stack.cxf.extensions.security.PasswordCallbackHandler;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * User: rsearls(a)redhat.com
- * Date: 1/26/14
- */
-public class ActAsCallbackHandler extends PasswordCallbackHandler {
-
- public ActAsCallbackHandler()
- {
- super(getInitMap());
- }
-
- private static Map<String, String> getInitMap()
- {
- Map<String, String> passwords = new HashMap<String, String>();
- passwords.put("myactaskey", "aspass");
- passwords.put("alice", "clarinet");
- return passwords;
- }
-
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsOutInterceptor.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsOutInterceptor.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsOutInterceptor.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-import org.apache.cxf.phase.AbstractPhaseInterceptor;
-import org.apache.cxf.phase.Phase;
-import org.apache.cxf.ws.security.SecurityConstants;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.interceptor.Fault;
-
-import java.util.ArrayList;
-import java.util.Set;
-
-/**
- * User: rsearls(a)redhat.com
- * Date: 1/26/14
- */
-public class ActAsOutInterceptor extends AbstractPhaseInterceptor<Message> {
-
- public ActAsOutInterceptor () {
- super(Phase.SETUP);
- }
-
- @Override
- public void handleMessage(Message message) throws Fault {
-
- String tmpStr = "<wst:ActAs xmlns:wst=\"http://docs.oasis-open.org/ws-sx/ws-trust/200512\">myactaskey</wst:ActAs>";
- message.put(SecurityConstants.STS_TOKEN_ACT_AS, tmpStr);
- }
-
- @Override
- public void handleFault(Message message) {
- }
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceIface.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceIface.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceIface.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-
-/**
- * User: rsearls(a)redhat.com
- * Date: 1/26/14
- */
-@WebService
-(
- targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy"
-)
-public interface ActAsServiceIface
-{
- @WebMethod
- String sayHello();
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceImpl.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceImpl.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,156 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.annotations.EndpointProperties;
-import org.apache.cxf.annotations.EndpointProperty;
-import org.apache.cxf.interceptor.OutInterceptors;
-import org.apache.cxf.ws.security.SecurityConstants;
-import org.apache.cxf.ws.security.trust.STSClient;
-
-import javax.jws.WebService;
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.*;
-import java.util.Map;
-
-/**
- * User: rsearls(a)redhat.com
- * Date: 1/26/14
- */
-
-@WebService
-(
- portName = "ActAsServicePort",
- serviceName = "ActAsService",
- wsdlLocation = "WEB-INF/wsdl/ActAsService.wsdl",
- targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy",
- endpointInterface = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.ActAsServiceIface"
-)
-
-@EndpointProperties(value = {
- @EndpointProperty(key = "ws-security.signature.username", value = "myactaskey"),
- @EndpointProperty(key = "ws-security.signature.properties", value = "actasKeystore.properties"),
- @EndpointProperty(key = "ws-security.encryption.properties", value = "actasKeystore.properties"),
- @EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.ActAsCallbackHandler")
-})
-@OutInterceptors(interceptors = {"org.jboss.test.ws.jaxws.samples.wsse.policy.trust.ActAsOutInterceptor"})
-public class ActAsServiceImpl implements ActAsServiceIface
-{
- public String sayHello() {
- try {
- ServiceIface proxy = setupService();
- return "ActAs " + proxy.sayHello();
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private ServiceIface setupService()throws MalformedURLException {
- ServiceIface proxy = null;
- Bus bus = BusFactory.newInstance().createBus();
-
- try {
- BusFactory.setThreadDefaultBus(bus);
-
- final String serviceURL = "http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-trust/SecurityService";
- final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
- final URL wsdlURL = new URL(serviceURL + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- proxy = (ServiceIface) service.getPort(ServiceIface.class);
-
- Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
- ctx.put(SecurityConstants.CALLBACK_HANDLER, new ActAsCallbackHandler());
-
-
- ctx.put(SecurityConstants.SIGNATURE_PROPERTIES,
- Thread.currentThread().getContextClassLoader().getResource("actasKeystore.properties" ));
- ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myactaskey" );
- ctx.put(SecurityConstants.ENCRYPT_PROPERTIES,
- Thread.currentThread().getContextClassLoader().getResource("../../META-INF/clientKeystore.properties" ));
- ctx.put(SecurityConstants.ENCRYPT_USERNAME, "myservicekey");
-
-
- STSClient stsClient = new STSClient(bus);
- Map<String, Object> props = stsClient.getProperties();
- props.put(SecurityConstants.USERNAME, "alice");
- //- these are not needed. They are provided by the above (ctx) map.
- // props.put(SecurityConstants.CALLBACK_HANDLER, new ActAsCallbackHandler());
- // props.put(SecurityConstants.ENCRYPT_PROPERTIES,
- // Thread.currentThread().getContextClassLoader().getResource("../../META-INF/clientKeystore.properties" ));
- props.put(SecurityConstants.ENCRYPT_USERNAME, "mystskey");
- props.put(SecurityConstants.STS_TOKEN_USERNAME, "myactaskey" );
- props.put(SecurityConstants.STS_TOKEN_PROPERTIES,
- Thread.currentThread().getContextClassLoader().getResource("actasKeystore.properties" ));
- props.put(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO, "true");
-
- ctx.put(SecurityConstants.STS_CLIENT, stsClient);
-
- } finally {
- bus.shutdown(true);
- }
-
- return proxy;
- }
-
- private String getServerHost()
- {
- final String host = System.getProperty("jboss.bind.address", "localhost");
- return toIPv6URLFormat(host);
- }
-
- private String toIPv6URLFormat(final String host)
- {
- try
- {
- if (host.startsWith(":"))
- {
- throw new IllegalArgumentException("JBossWS test suite requires IPv6 addresses to be wrapped with [] brackets. Expected format is: [" + host + "]");
- }
- if (host.startsWith("["))
- {
- if (System.getProperty("java.net.preferIPv4Stack") == null)
- {
- throw new IllegalStateException("always provide java.net.preferIPv4Stack JVM property when using IPv6 address format");
- }
- if (System.getProperty("java.net.preferIPv6Addresses") == null)
- {
- throw new IllegalStateException("always provide java.net.preferIPv6Addresses JVM property when using IPv6 address format");
- }
- }
- final boolean isIPv6Address = InetAddress.getByName(host) instanceof Inet6Address;
- final boolean isIPv6Formatted = isIPv6Address && host.startsWith("[");
- return isIPv6Address && !isIPv6Formatted ? "[" + host + "]" : host;
- }
- catch (final UnknownHostException e)
- {
- throw new RuntimeException(e);
- }
- }
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ClientCallbackHandler.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ClientCallbackHandler.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ClientCallbackHandler.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,47 +0,0 @@
-/**
- * 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.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-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 ("myclientkey".equals(pc.getIdentifier())) {
- pc.setPassword("ckpass");
- break;
- } else if ("alice".equals(pc.getIdentifier())) {
- pc.setPassword("clarinet");
- break;
- } else if ("bob".equals(pc.getIdentifier())) {
- pc.setPassword("trombone");
- break;
- }
- }
- }
- }
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/PicketLinkSTService.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/PicketLinkSTService.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/PicketLinkSTService.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-import javax.annotation.Resource;
-import javax.xml.ws.Service;
-import javax.xml.ws.ServiceMode;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.WebServiceProvider;
-
-import org.apache.cxf.annotations.EndpointProperties;
-import org.apache.cxf.annotations.EndpointProperty;
-import org.apache.cxf.interceptor.InInterceptors;
-import org.picketlink.identity.federation.core.wstrust.PicketLinkSTS;
-
-/**
- * A Security Token Service implementation extending default PicketLink one
- *
- * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
- * @author <a href="mailto:pskopek@redhat.com">Peter Skopek</a>
- * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
- */
-@WebServiceProvider(serviceName = "PicketLinkSTS", portName = "PicketLinkSTSPort", targetNamespace = "urn:picketlink:identity-federation:sts", wsdlLocation = "WEB-INF/wsdl/PicketLinkSTS.wsdl")
-@ServiceMode(value = Service.Mode.MESSAGE)
-//be sure to have dependency on org.apache.cxf module when on AS7, otherwise Apache CXF annotations are ignored
-@EndpointProperties(value = {
- @EndpointProperty(key = "ws-security.signature.username", value = "mystskey"),
- @EndpointProperty(key = "ws-security.signature.properties", value = "stsKeystore.properties"),
- @EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.STSCallbackHandler"),
- @EndpointProperty(key = "ws-security.validate.token", value = "false") //to let the JAAS integration deal with validation through the interceptor below
-})
-@InInterceptors(interceptors = {"org.jboss.wsf.stack.cxf.security.authentication.SubjectCreatingPolicyInterceptor"})
-public class PicketLinkSTService extends PicketLinkSTS
-{
- @Resource
- public void setWSC(WebServiceContext wctx) {
- this.context = wctx;
- }
-
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/STSCallbackHandler.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/STSCallbackHandler.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/STSCallbackHandler.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,39 +0,0 @@
-/**
- * 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.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.wsf.stack.cxf.extensions.security.PasswordCallbackHandler;
-
-public class STSCallbackHandler extends PasswordCallbackHandler
-{
- public STSCallbackHandler()
- {
- super(getInitMap());
- }
-
- private static Map<String, String> getInitMap()
- {
- Map<String, String> passwords = new HashMap<String, String>();
- passwords.put("mystskey", "stskpass");
- return passwords;
- }
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/SampleSTS.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/SampleSTS.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/SampleSTS.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.xml.ws.WebServiceProvider;
-
-import org.apache.cxf.annotations.EndpointProperties;
-import org.apache.cxf.annotations.EndpointProperty;
-import org.apache.cxf.interceptor.InInterceptors;
-import org.apache.cxf.sts.StaticSTSProperties;
-import org.apache.cxf.sts.operation.TokenIssueOperation;
-import org.apache.cxf.sts.operation.TokenValidateOperation;
-import org.apache.cxf.sts.service.ServiceMBean;
-import org.apache.cxf.sts.service.StaticService;
-import org.apache.cxf.sts.token.provider.SAMLTokenProvider;
-import org.apache.cxf.sts.token.validator.SAMLTokenValidator;
-import org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider;
-
-@WebServiceProvider(serviceName = "SecurityTokenService",
- portName = "UT_Port",
- targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/",
- wsdlLocation = "WEB-INF/wsdl/ws-trust-1.4-service.wsdl")
-//be sure to have dependency on org.apache.cxf module when on AS7, otherwise Apache CXF annotations are ignored
-@EndpointProperties(value = {
- @EndpointProperty(key = "ws-security.signature.username", value = "mystskey"),
- @EndpointProperty(key = "ws-security.signature.properties", value = "stsKeystore.properties"),
- @EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.STSCallbackHandler"),
- @EndpointProperty(key = "ws-security.validate.token", value = "false") //to let the JAAS integration deal with validation through the interceptor below
-})
-@InInterceptors(interceptors = {"org.jboss.wsf.stack.cxf.security.authentication.SubjectCreatingPolicyInterceptor"})
-public class SampleSTS extends SecurityTokenServiceProvider
-{
- public SampleSTS() throws Exception
- {
- super();
-
- StaticSTSProperties props = new StaticSTSProperties();
- props.setSignatureCryptoProperties("stsKeystore.properties");
- props.setSignatureUsername("mystskey");
- props.setCallbackHandlerClass(STSCallbackHandler.class.getName());
- props.setIssuer("DoubleItSTSIssuer");
-
- List<ServiceMBean> services = new LinkedList<ServiceMBean>();
- StaticService service = new StaticService();
- service.setEndpoints(Arrays.asList(
- "http://localhost:(\\d)*/jaxws-samples-wsse-policy-trust/SecurityService",
- "http://\\[::1\\]:(\\d)*/jaxws-samples-wsse-policy-trust/SecurityService",
- "http://\\[0:0:0:0:0:0:0:1\\]:(\\d)*/jaxws-samples-wsse-policy-trust/SecurityService",
- "http://localhost:(\\d)*/jaxws-samples-wsse-policy-trust-actas/ActAsService",
- "http://\\[::1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-actas/ActAsService",
- "http://\\[0:0:0:0:0:0:0:1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-actas/ActAsService"
- ));
- services.add(service);
-
- TokenIssueOperation issueOperation = new TokenIssueOperation();
- issueOperation.setServices(services);
- issueOperation.getTokenProviders().add(new SAMLTokenProvider());
- issueOperation.setStsProperties(props);
-
- TokenValidateOperation validateOperation = new TokenValidateOperation();
- validateOperation.getTokenValidators().add(new SAMLTokenValidator());
- validateOperation.setStsProperties(props);
-
- this.setIssueOperation(issueOperation);
- this.setValidateOperation(validateOperation);
- }
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServerCallbackHandler.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServerCallbackHandler.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServerCallbackHandler.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,40 +0,0 @@
-/**
- * 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.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.wsf.stack.cxf.extensions.security.PasswordCallbackHandler;
-
-public class ServerCallbackHandler extends PasswordCallbackHandler
-{
-
- public ServerCallbackHandler()
- {
- super(getInitMap());
- }
-
- private static Map<String, String> getInitMap()
- {
- Map<String, String> passwords = new HashMap<String, String>();
- passwords.put("myservicekey", "skpass");
- return passwords;
- }
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceIface.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceIface.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceIface.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-
-@WebService
-(
- targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy"
-)
-public interface ServiceIface
-{
- @WebMethod
- String sayHello();
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceImpl.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceImpl.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-
-import javax.jws.WebService;
-
-import org.apache.cxf.annotations.EndpointProperties;
-import org.apache.cxf.annotations.EndpointProperty;
-import org.apache.cxf.interceptor.InInterceptors;
-
-@WebService
-(
- portName = "SecurityServicePort",
- serviceName = "SecurityService",
- wsdlLocation = "WEB-INF/wsdl/SecurityService.wsdl",
- targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
- endpointInterface = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.ServiceIface"
-)
-@EndpointProperties(value = {
- @EndpointProperty(key = "ws-security.signature.username", value = "myservicekey"),
- @EndpointProperty(key = "ws-security.signature.properties", value = "serviceKeystore.properties"),
- @EndpointProperty(key = "ws-security.encryption.properties", value = "serviceKeystore.properties"),
- @EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.ServerCallbackHandler")
-})
-public class ServiceImpl implements ServiceIface
-{
- public String sayHello()
- {
- return "WS-Trust Hello World!";
- }
-}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustOnBehalfOfTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustOnBehalfOfTestCase.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustOnBehalfOfTestCase.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
+
+import junit.framework.Test;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface;
+import org.jboss.wsf.test.JBossWSTest;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import java.net.URL;
+
+/**
+ * A demo of using WS-Trust ActAs extension.
+ *
+ * User: rsearls(a)redhat.com
+ * Date: 1/26/14
+ */
+public class WSTrustOnBehalfOfTestCase extends JBossWSTest
+{
+ private final String serviceURL = "http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-trust-onbehalfof/OnBehalfOfService";
+ private final String stsURL = "http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService";
+
+ public static Test suite()
+ {
+ //deploy client, STS and service; start a security domain to be used by the STS for authenticating client
+ return WSTrustTestUtils.getTestSetup(WSTrustOnBehalfOfTestCase.class,
+ "jaxws-samples-wsse-policy-trust-client.jar jaxws-samples-wsse-policy-trust-sts.war jaxws-samples-wsse-policy-trust.war jaxws-samples-wsse-policy-trust-onbehalfof.war");
+ }
+
+ /**
+ * Request a security token that allows it to act on behalf of somebody else.
+ *
+ * @throws Exception
+ */
+ public void testOnBehalfOf() throws Exception
+ {
+ Bus bus = BusFactory.newInstance().createBus();
+ try
+ {
+ BusFactory.setThreadDefaultBus(bus);
+
+ final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy", "OnBehalfOfService");
+ final URL wsdlURL = new URL(serviceURL + "?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ OnBehalfOfServiceIface proxy = (OnBehalfOfServiceIface) service.getPort(OnBehalfOfServiceIface.class);
+
+ /* TODO explain why this is not needed for setup and then remove
+ final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
+ final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
+ */
+ WSTrustTestUtils.setupWsseAndSTSClientOnBehalfOf((BindingProvider) proxy, bus);
+
+ assertEquals("OnBehalfOf WS-Trust Hello World!", proxy.sayHello());
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+ }
+
+}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -32,6 +32,7 @@
import org.apache.cxf.BusFactory;
import org.jboss.wsf.test.CryptoHelper;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
/**
* WS-Trust test case using PicketLink implementation of STS
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -32,6 +32,7 @@
import org.apache.cxf.BusFactory;
import org.jboss.wsf.test.CryptoHelper;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
/**
* WS-Trust test case
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java 2014-02-06 11:41:05 UTC (rev 18308)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -21,8 +21,6 @@
*/
package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
@@ -32,8 +30,11 @@
import org.apache.cxf.Bus;
import org.apache.cxf.ws.security.SecurityConstants;
import org.apache.cxf.ws.security.trust.STSClient;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.ClientCallbackHandler;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.UsernameTokenCallbackHandler;
import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
/**
* Some client util methods for WS-Trust testcases
@@ -145,9 +146,18 @@
ctx.put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myclientkey");
+
+ UsernameTokenCallbackHandler ch = new UsernameTokenCallbackHandler();
+ String str = ch.getUsernameTokenString("myactaskey", null);
+ //System.out.println("##ut: " + str);
+
+ //String tmpStr ="<wsse:UsernameToken xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext..." xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit..." wsu:Id=\"id-myactaskey\"> <wsse:Username>myactaskey</wsse:Username> </wsse:UsernameToken>";
+ ctx.put(SecurityConstants.STS_TOKEN_ACT_AS, /*tmpStr*/str);
+
+
STSClient stsClient = new STSClient(bus);
Map<String, Object> props = stsClient.getProperties();
- props.put(SecurityConstants.USERNAME, "bob" /*"alice"*/);
+ props.put(SecurityConstants.USERNAME, "bob");
props.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler());
props.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
props.put(SecurityConstants.ENCRYPT_USERNAME, "mystskey");
@@ -158,7 +168,41 @@
ctx.put(SecurityConstants.STS_CLIENT, stsClient);
}
+ //-
+ /**
+ * Request a security token that allows it to act on the behalf of somebody else.
+ *
+ * @param proxy
+ * @param bus
+ */
+ public static void setupWsseAndSTSClientOnBehalfOf(BindingProvider proxy, Bus bus) {
+
+ Map<String, Object> ctx = proxy.getRequestContext();
+
+ ctx.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler());
+ ctx.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
+ ctx.put(SecurityConstants.ENCRYPT_USERNAME, "myactaskey");
+ ctx.put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
+ ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myclientkey");
+ ctx.put(SecurityConstants.USERNAME,"alice");
+ ctx.put(SecurityConstants.PASSWORD, "clarinet");
+
+ STSClient stsClient = new STSClient(bus);
+ stsClient.setOnBehalfOf(new UsernameTokenCallbackHandler());
+
+ Map<String, Object> props = stsClient.getProperties();
+ props.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler());
+ props.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
+ props.put(SecurityConstants.ENCRYPT_USERNAME, "mystskey");
+ props.put(SecurityConstants.STS_TOKEN_USERNAME, "myclientkey");
+ props.put(SecurityConstants.STS_TOKEN_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
+ props.put(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO, "true");
+
+ ctx.put(SecurityConstants.STS_CLIENT, stsClient);
+ }
+
+
private static String appendIssuedTokenSuffix(String prop)
{
return prop + ".it";
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsCallbackHandler.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsCallbackHandler.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsCallbackHandler.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsCallbackHandler.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,44 @@
+/**
+ * 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.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas;
+
+import org.jboss.wsf.stack.cxf.extensions.security.PasswordCallbackHandler;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * User: rsearls(a)redhat.com
+ * Date: 1/26/14
+ */
+public class ActAsCallbackHandler extends PasswordCallbackHandler {
+
+ public ActAsCallbackHandler()
+ {
+ super(getInitMap());
+ }
+
+ private static Map<String, String> getInitMap()
+ {
+ Map<String, String> passwords = new HashMap<String, String>();
+ passwords.put("myactaskey", "aspass");
+ passwords.put("alice", "clarinet");
+ return passwords;
+ }
+
+}
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsOutInterceptor.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsOutInterceptor.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsOutInterceptor.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsOutInterceptor.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas;
+
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.ws.security.SecurityConstants;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.interceptor.Fault;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * User: rsearls(a)redhat.com
+ * Date: 1/26/14
+ */
+public class ActAsOutInterceptor extends AbstractPhaseInterceptor<Message> {
+
+ public ActAsOutInterceptor () {
+ super(Phase.SETUP);
+ }
+
+ @Override
+ public void handleMessage(Message message) throws Fault {
+ dump(message);
+ String tmpStr ="<wsse:UsernameToken xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext..." xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit..." wsu:Id=\"id-myactaskey\"> <wsse:Username>myactaskey</wsse:Username> </wsse:UsernameToken>";
+ message.put(SecurityConstants.STS_TOKEN_ACT_AS, tmpStr);
+ }
+
+ private void dump(Message message){
+ Set<String> keyList = message.keySet();
+ for(String key: keyList){
+ Object o = message.get(key);
+ if(o instanceof String){
+ System.out.println("##ACTAS key: " + key + " value: " + (String)o);
+ } else if (o instanceof org.apache.cxf.service.model.MessageInfo) {
+ dumpMsgInfo(key, (org.apache.cxf.service.model.MessageInfo)o);
+
+ } else if (o instanceof org.apache.cxf.service.model.BindingMessageInfo) {
+ org.apache.cxf.service.model.BindingMessageInfo bMsgInfo = (org.apache.cxf.service.model.BindingMessageInfo)o;
+ org.apache.cxf.service.model.MessageInfo mInfo = bMsgInfo.getMessageInfo();
+ dumpMsgInfo(key, mInfo);
+
+ } else {
+ System.out.println("##ACTAS key: " + key + " value++: " + o.getClass().getCanonicalName());
+
+ }
+ }
+
+ }
+
+
+ private void dumpMsgInfo(String key, org.apache.cxf.service.model.MessageInfo mInfo){
+ if (mInfo.getProperties() == null){
+ System.out.println("##ACTAS key: " + key + " value--: " + mInfo.getClass().getCanonicalName());
+ } else {
+ dumpMap(mInfo.getProperties());
+ }
+ if (mInfo.getDocumentation() == null){
+ System.out.println("##ACTAS msgInfo doc is NULL ");
+ } else {
+ System.out.println("##ACTAS msgInfo doc: " + mInfo.getDocumentation());
+ }
+ }
+
+ private void dumpMap(Map<String, Object> pMap){
+
+ Set<String> mList = pMap.keySet();
+ for(String key: mList){
+ Object o = pMap.get(key);
+ if(o instanceof String){
+ System.out.println("--##ACTAS map key: " + key + " value: " + (String)o);
+ } else {
+ System.out.println("--##ACTAS map key: " + key + " value: " + o.getClass().getCanonicalName());
+ }
+ }
+ }
+
+ @Override
+ public void handleFault(Message message) {
+ }
+}
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceIface.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceIface.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceIface.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceIface.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+/**
+ * User: rsearls(a)redhat.com
+ * Date: 1/26/14
+ */
+@WebService
+(
+ targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy"
+)
+public interface ActAsServiceIface
+{
+ @WebMethod
+ String sayHello();
+}
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceImpl.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
+import org.apache.cxf.interceptor.OutInterceptors;
+import org.apache.cxf.ws.security.SecurityConstants;
+import org.apache.cxf.ws.security.trust.STSClient;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsCallbackHandler;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import java.net.*;
+import java.util.Map;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
+
+/**
+ * User: rsearls(a)redhat.com
+ * Date: 1/26/14
+ */
+
+@WebService
+(
+ portName = "ActAsServicePort",
+ serviceName = "ActAsService",
+ wsdlLocation = "WEB-INF/wsdl/ActAsService.wsdl",
+ targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy",
+ endpointInterface = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface"
+)
+
+@EndpointProperties(value = {
+ @EndpointProperty(key = "ws-security.signature.username", value = "myactaskey"),
+ @EndpointProperty(key = "ws-security.signature.properties", value = "actasKeystore.properties"),
+ @EndpointProperty(key = "ws-security.encryption.properties", value = "actasKeystore.properties"),
+ @EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsCallbackHandler")
+})
+
+@OutInterceptors(interceptors = {"org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsOutInterceptor"})
+public class ActAsServiceImpl implements ActAsServiceIface
+{
+ public String sayHello() {
+ try {
+ ServiceIface proxy = setupService();
+ return "ActAs " + proxy.sayHello();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private ServiceIface setupService()throws MalformedURLException {
+ ServiceIface proxy = null;
+ Bus bus = BusFactory.newInstance().createBus();
+
+ try {
+ BusFactory.setThreadDefaultBus(bus);
+
+ final String serviceURL = "http://" + WSTrustAppUtils.getServerHost() + ":8080/jaxws-samples-wsse-policy-trust/SecurityService";
+ final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
+ final URL wsdlURL = new URL(serviceURL + "?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ proxy = (ServiceIface) service.getPort(ServiceIface.class);
+
+ Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
+ ctx.put(SecurityConstants.CALLBACK_HANDLER, new ActAsCallbackHandler());
+
+ ctx.put(SecurityConstants.SIGNATURE_PROPERTIES,
+ Thread.currentThread().getContextClassLoader().getResource("actasKeystore.properties" ));
+ ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myactaskey" );
+ ctx.put(SecurityConstants.ENCRYPT_PROPERTIES,
+ Thread.currentThread().getContextClassLoader().getResource("../../META-INF/clientKeystore.properties" ));
+ ctx.put(SecurityConstants.ENCRYPT_USERNAME, "myservicekey");
+
+ STSClient stsClient = new STSClient(bus);
+ Map<String, Object> props = stsClient.getProperties();
+ props.put(SecurityConstants.USERNAME, "alice");
+ props.put(SecurityConstants.ENCRYPT_USERNAME, "mystskey");
+ props.put(SecurityConstants.STS_TOKEN_USERNAME, "myactaskey" );
+ props.put(SecurityConstants.STS_TOKEN_PROPERTIES,
+ Thread.currentThread().getContextClassLoader().getResource("actasKeystore.properties" ));
+ props.put(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO, "true");
+
+ ctx.put(SecurityConstants.STS_CLIENT, stsClient);
+
+ } finally {
+ bus.shutdown(true);
+ }
+
+ return proxy;
+ }
+
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfCallbackHandler.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfCallbackHandler.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfCallbackHandler.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,46 @@
+/**
+ * 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.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof;
+
+import org.jboss.wsf.stack.cxf.extensions.security.PasswordCallbackHandler;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * User: rsearls(a)redhat.com
+ * Date: 1/26/14
+ */
+public class OnBehalfOfCallbackHandler extends PasswordCallbackHandler {
+
+ public OnBehalfOfCallbackHandler()
+ {
+ super(getInitMap());
+ }
+
+ private static Map<String, String> getInitMap()
+ {
+ Map<String, String> passwords = new HashMap<String, String>();
+ passwords.put("myactaskey", "aspass");
+ passwords.put("alice", "clarinet");
+ passwords.put("bob", "trombone");
+ return passwords;
+ }
+
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceIface.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceIface.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceIface.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+/**
+ * User: rsearls(a)redhat.com
+ * Date: 1/26/14
+ */
+@WebService
+(
+ targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy"
+)
+public interface OnBehalfOfServiceIface
+{
+ @WebMethod
+ String sayHello();
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceImpl.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceImpl.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
+import org.apache.cxf.ws.security.SecurityConstants;
+import org.apache.cxf.ws.security.trust.STSClient;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import java.net.*;
+import java.util.Map;
+
+/**
+ * User: rsearls(a)redhat.com
+ * Date: 1/26/14
+ */
+
+@WebService
+(
+ portName = "OnBehalfOfServicePort",
+ serviceName = "OnBehalfOfService",
+ wsdlLocation = "WEB-INF/wsdl/OnBehalfOfService.wsdl",
+ targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy",
+ endpointInterface = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface"
+)
+
+@EndpointProperties(value = {
+ @EndpointProperty(key = "ws-security.signature.username", value = "myactaskey"),
+ @EndpointProperty(key = "ws-security.signature.properties", value = "actasKeystore.properties"),
+ @EndpointProperty(key = "ws-security.encryption.properties", value = "actasKeystore.properties"),
+ @EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfCallbackHandler")
+})
+
+public class OnBehalfOfServiceImpl implements OnBehalfOfServiceIface
+{
+ public String sayHello() {
+ try {
+
+ ServiceIface proxy = setupService();
+ return "OnBehalfOf " + proxy.sayHello();
+
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ * @throws MalformedURLException
+ */
+ private ServiceIface setupService()throws MalformedURLException {
+ ServiceIface proxy = null;
+ Bus bus = BusFactory.newInstance().createBus();
+
+ try {
+ BusFactory.setThreadDefaultBus(bus);
+
+ final String serviceURL = "http://" + WSTrustAppUtils.getServerHost() + ":8080/jaxws-samples-wsse-policy-trust/SecurityService";
+ final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
+ final URL wsdlURL = new URL(serviceURL + "?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ proxy = (ServiceIface) service.getPort(ServiceIface.class);
+
+ Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
+ ctx.put(SecurityConstants.CALLBACK_HANDLER, new OnBehalfOfCallbackHandler());
+
+ ctx.put(SecurityConstants.SIGNATURE_PROPERTIES,
+ Thread.currentThread().getContextClassLoader().getResource("actasKeystore.properties" ));
+ ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myactaskey" );
+ ctx.put(SecurityConstants.ENCRYPT_PROPERTIES,
+ Thread.currentThread().getContextClassLoader().getResource("../../META-INF/clientKeystore.properties" ));
+ ctx.put(SecurityConstants.ENCRYPT_USERNAME, "myservicekey");
+
+ STSClient stsClient = new STSClient(bus);
+ Map<String, Object> props = stsClient.getProperties();
+ props.put(SecurityConstants.USERNAME, "bob"); //-rls test
+ props.put(SecurityConstants.ENCRYPT_USERNAME, "mystskey");
+ props.put(SecurityConstants.STS_TOKEN_USERNAME, "myactaskey" );
+ props.put(SecurityConstants.STS_TOKEN_PROPERTIES,
+ Thread.currentThread().getContextClassLoader().getResource("actasKeystore.properties" ));
+ props.put(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO, "true");
+
+ ctx.put(SecurityConstants.STS_CLIENT, stsClient);
+
+ } finally {
+ bus.shutdown(true);
+ }
+
+ return proxy;
+ }
+
+}
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/picketlink/PicketLinkSTService.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/PicketLinkSTService.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/picketlink/PicketLinkSTService.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/picketlink/PicketLinkSTService.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.picketlink;
+
+import javax.annotation.Resource;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceProvider;
+
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
+import org.apache.cxf.interceptor.InInterceptors;
+import org.picketlink.identity.federation.core.wstrust.PicketLinkSTS;
+
+/**
+ * A Security Token Service implementation extending default PicketLink one
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ * @author <a href="mailto:pskopek@redhat.com">Peter Skopek</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
+ */
+@WebServiceProvider(serviceName = "PicketLinkSTS", portName = "PicketLinkSTSPort", targetNamespace = "urn:picketlink:identity-federation:sts", wsdlLocation = "WEB-INF/wsdl/PicketLinkSTS.wsdl")
+@ServiceMode(value = Service.Mode.MESSAGE)
+//be sure to have dependency on org.apache.cxf module when on AS7, otherwise Apache CXF annotations are ignored
+@EndpointProperties(value = {
+ @EndpointProperty(key = "ws-security.signature.username", value = "mystskey"),
+ @EndpointProperty(key = "ws-security.signature.properties", value = "stsKeystore.properties"),
+ @EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.STSCallbackHandler"),
+ @EndpointProperty(key = "ws-security.validate.token", value = "false") //to let the JAAS integration deal with validation through the interceptor below
+})
+@InInterceptors(interceptors = {"org.jboss.wsf.stack.cxf.security.authentication.SubjectCreatingPolicyInterceptor"})
+public class PicketLinkSTService extends PicketLinkSTS
+{
+ @Resource
+ public void setWSC(WebServiceContext wctx) {
+ this.context = wctx;
+ }
+
+}
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServerCallbackHandler.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServerCallbackHandler.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServerCallbackHandler.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServerCallbackHandler.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,40 @@
+/**
+ * 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.jboss.test.ws.jaxws.samples.wsse.policy.trust.service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.wsf.stack.cxf.extensions.security.PasswordCallbackHandler;
+
+public class ServerCallbackHandler extends PasswordCallbackHandler
+{
+
+ public ServerCallbackHandler()
+ {
+ super(getInitMap());
+ }
+
+ private static Map<String, String> getInitMap()
+ {
+ Map<String, String> passwords = new HashMap<String, String>();
+ passwords.put("myservicekey", "skpass");
+ return passwords;
+ }
+}
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceIface.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceIface.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceIface.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceIface.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+(
+ targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy"
+)
+public interface ServiceIface
+{
+ @WebMethod
+ String sayHello();
+}
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceImpl.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ServiceImpl.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceImpl.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/service/ServiceImpl.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
+
+@WebService
+(
+ portName = "SecurityServicePort",
+ serviceName = "SecurityService",
+ wsdlLocation = "WEB-INF/wsdl/SecurityService.wsdl",
+ targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
+ endpointInterface = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface"
+)
+@EndpointProperties(value = {
+ @EndpointProperty(key = "ws-security.signature.username", value = "myservicekey"),
+ @EndpointProperty(key = "ws-security.signature.properties", value = "serviceKeystore.properties"),
+ @EndpointProperty(key = "ws-security.encryption.properties", value = "serviceKeystore.properties"),
+ @EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServerCallbackHandler")
+})
+public class ServiceImpl implements ServiceIface
+{
+ public String sayHello()
+ {
+ return "WS-Trust Hello World!";
+ }
+}
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/ClientCallbackHandler.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ClientCallbackHandler.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/ClientCallbackHandler.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/ClientCallbackHandler.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -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.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared;
+
+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 ("myclientkey".equals(pc.getIdentifier())) {
+ pc.setPassword("ckpass");
+ break;
+ } else if ("alice".equals(pc.getIdentifier())) {
+ pc.setPassword("clarinet");
+ break;
+ } else if ("bob".equals(pc.getIdentifier())) {
+ pc.setPassword("trombone");
+ break;
+ }
+ }
+ }
+ }
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/UsernameTokenCallbackHandler.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/UsernameTokenCallbackHandler.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/UsernameTokenCallbackHandler.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,162 @@
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared;
+
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.ws.security.SecurityConstants;
+import org.apache.cxf.ws.security.trust.delegation.DelegationCallback;
+import org.apache.ws.security.WSConstants;
+import org.apache.ws.security.message.token.UsernameToken;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Element;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSSerializer;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * A utility to provide the 3 different input parameter types for jaxws property
+ * "ws-security.sts.token.act-as" and "ws-security.sts.token.on-behalf-of".
+ * This implementation obtains a username and password via the jaxws property
+ * "ws-security.username" and "ws-security.password" respectively, as defined
+ * in SecurityConstants. It creates a wss UsernameToken to be used as the
+ * delegation token.
+ *
+ * User: rsearls
+ * Date: 2/3/14
+ */
+
+public class UsernameTokenCallbackHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks)
+ throws IOException, UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ if (callbacks[i] instanceof DelegationCallback) {
+ DelegationCallback callback = (DelegationCallback) callbacks[i];
+ Message message = callback.getCurrentMessage();
+
+ String username =
+ (String)message.getContextualProperty(SecurityConstants.USERNAME);
+ String password =
+ (String)message.getContextualProperty(SecurityConstants.PASSWORD);
+ if (username != null) {
+ Node contentNode = message.getContent(Node.class);
+ Document doc = null;
+ if (contentNode != null) {
+ doc = contentNode.getOwnerDocument();
+ } else {
+ doc = DOMUtils.createDocument();
+ }
+ UsernameToken usernameToken = createWSSEUsernameToken(username,password, doc);
+ callback.setToken(usernameToken.getElement());
+ }
+ } else {
+ throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
+ }
+ }
+ }
+
+ /**
+ * Provide UsernameToken as a string.
+ * @param ctx
+ * @return
+ */
+ public String getUsernameTokenString(Map<String, Object> ctx){
+ Document doc = DOMUtils.createDocument();
+ String result = null;
+ String username = (String)ctx.get(SecurityConstants.USERNAME);
+ String password = (String)ctx.get(SecurityConstants.PASSWORD);
+ if (username != null) {
+ UsernameToken usernameToken = createWSSEUsernameToken(username,password, doc);
+ result = toString(usernameToken.getElement().getFirstChild().getParentNode());
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param username
+ * @param password
+ * @return
+ */
+ public String getUsernameTokenString(String username, String password){
+ Document doc = DOMUtils.createDocument();
+ String result = null;
+ if (username != null) {
+ UsernameToken usernameToken = createWSSEUsernameToken(username,password, doc);
+ result = toString(usernameToken.getElement().getFirstChild().getParentNode());
+ }
+ return result;
+ }
+
+ /**
+ * Provide UsernameToken as a DOM Element.
+ * @param ctx
+ * @return
+ */
+ public Element getUsernameTokenElement(Map<String, Object> ctx){
+ Document doc = DOMUtils.createDocument();
+ Element result = null;
+ UsernameToken usernameToken = null;
+ String username = (String)ctx.get(SecurityConstants.USERNAME);
+ String password = (String)ctx.get(SecurityConstants.PASSWORD);
+ if (username != null) {
+ usernameToken = createWSSEUsernameToken(username,password, doc);
+ result = usernameToken.getElement();
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param username
+ * @param password
+ * @return
+ */
+ public Element getUsernameTokenElement(String username, String password){
+ Document doc = DOMUtils.createDocument();
+ Element result = null;
+ UsernameToken usernameToken = null;
+ if (username != null) {
+ usernameToken = createWSSEUsernameToken(username,password, doc);
+ result = usernameToken.getElement();
+ }
+ return result;
+ }
+
+ private UsernameToken createWSSEUsernameToken(String username, String password, Document doc) {
+
+ UsernameToken usernameToken = new UsernameToken(true, doc,
+ (password == null)? null: WSConstants.PASSWORD_TEXT);
+ usernameToken.setName(username);
+ usernameToken.addWSUNamespace();
+ usernameToken.addWSSENamespace();
+ usernameToken.setID("id-" + username);
+
+ if (password != null){
+ usernameToken.setPassword(password);
+ }
+
+ return usernameToken;
+ }
+
+
+ private String toString(Node node) {
+ String str = null;
+
+ if (node != null) {
+ DOMImplementationLS lsImpl = (DOMImplementationLS)
+ node.getOwnerDocument().getImplementation().getFeature("LS", "3.0");
+ LSSerializer serializer = lsImpl.createLSSerializer();
+ serializer.getDomConfig().setParameter("xml-declaration", false); //by default its true, so set it to false to get String without xml-declaration
+ str = serializer.writeToString(node);
+ //System.out.println("@@UT: " + str);
+ }
+ return str;
+ }
+
+}
\ No newline at end of file
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,47 @@
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared;
+
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ *
+ * User: rsearls
+ * Date: 2/5/14
+ */
+public class WSTrustAppUtils {
+
+ public static String getServerHost() {
+ final String host = System.getProperty("jboss.bind.address", "localhost");
+ return toIPv6URLFormat(host);
+ }
+
+ private static String toIPv6URLFormat(final String host)
+ {
+ try
+ {
+ if (host.startsWith(":"))
+ {
+ throw new IllegalArgumentException("JBossWS test suite requires IPv6 addresses to be wrapped with [] brackets. Expected format is: [" + host + "]");
+ }
+ if (host.startsWith("["))
+ {
+ if (System.getProperty("java.net.preferIPv4Stack") == null)
+ {
+ throw new IllegalStateException("always provide java.net.preferIPv4Stack JVM property when using IPv6 address format");
+ }
+ if (System.getProperty("java.net.preferIPv6Addresses") == null)
+ {
+ throw new IllegalStateException("always provide java.net.preferIPv6Addresses JVM property when using IPv6 address format");
+ }
+ }
+ final boolean isIPv6Address = InetAddress.getByName(host) instanceof Inet6Address;
+ final boolean isIPv6Formatted = isIPv6Address && host.startsWith("[");
+ return isIPv6Address && !isIPv6Formatted ? "[" + host + "]" : host;
+ }
+ catch (final UnknownHostException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/STSCallbackHandler.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/STSCallbackHandler.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/STSCallbackHandler.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/STSCallbackHandler.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,40 @@
+/**
+ * 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.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.wsf.stack.cxf.extensions.security.PasswordCallbackHandler;
+
+public class STSCallbackHandler extends PasswordCallbackHandler
+{
+ public STSCallbackHandler()
+ {
+ super(getInitMap());
+ }
+
+ private static Map<String, String> getInitMap()
+ {
+ Map<String, String> passwords = new HashMap<String, String>();
+ passwords.put("mystskey", "stskpass");
+ passwords.put("alice", "clarinet"); //rls JUST-A-TEST
+ return passwords;
+ }
+}
Copied: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java (from rev 18306, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/SampleSTS.java)
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.ws.WebServiceProvider;
+
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
+import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.cxf.sts.StaticSTSProperties;
+import org.apache.cxf.sts.operation.TokenIssueOperation;
+import org.apache.cxf.sts.operation.TokenValidateOperation;
+import org.apache.cxf.sts.service.ServiceMBean;
+import org.apache.cxf.sts.service.StaticService;
+import org.apache.cxf.sts.token.delegation.UsernameTokenDelegationHandler;
+import org.apache.cxf.sts.token.provider.SAMLTokenProvider;
+import org.apache.cxf.sts.token.validator.SAMLTokenValidator;
+import org.apache.cxf.sts.token.validator.UsernameTokenValidator;
+import org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider;
+
+@WebServiceProvider(serviceName = "SecurityTokenService",
+ portName = "UT_Port",
+ targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/",
+ wsdlLocation = "WEB-INF/wsdl/ws-trust-1.4-service.wsdl")
+//be sure to have dependency on org.apache.cxf module when on AS7, otherwise Apache CXF annotations are ignored
+@EndpointProperties(value = {
+ @EndpointProperty(key = "ws-security.signature.username", value = "mystskey"),
+ @EndpointProperty(key = "ws-security.signature.properties", value = "stsKeystore.properties"),
+ @EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.STSCallbackHandler"),
+ @EndpointProperty(key = "ws-security.validate.token", value = "false") //to let the JAAS integration deal with validation through the interceptor below
+})
+@InInterceptors(interceptors = {"org.jboss.wsf.stack.cxf.security.authentication.SubjectCreatingPolicyInterceptor"})
+public class SampleSTS extends SecurityTokenServiceProvider
+{
+ public SampleSTS() throws Exception
+ {
+ super();
+
+ StaticSTSProperties props = new StaticSTSProperties();
+ props.setSignatureCryptoProperties("stsKeystore.properties");
+ props.setSignatureUsername("mystskey");
+ props.setCallbackHandlerClass(STSCallbackHandler.class.getName());
+ props.setIssuer("DoubleItSTSIssuer");
+
+ List<ServiceMBean> services = new LinkedList<ServiceMBean>();
+ StaticService service = new StaticService();
+ service.setEndpoints(Arrays.asList(
+ "http://localhost:(\\d)*/jaxws-samples-wsse-policy-trust/SecurityService",
+ "http://\\[::1\\]:(\\d)*/jaxws-samples-wsse-policy-trust/SecurityService",
+ "http://\\[0:0:0:0:0:0:0:1\\]:(\\d)*/jaxws-samples-wsse-policy-trust/SecurityService",
+
+ "http://localhost:(\\d)*/jaxws-samples-wsse-policy-trust-actas/ActAsService",
+ "http://\\[::1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-actas/ActAsService",
+ "http://\\[0:0:0:0:0:0:0:1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-actas/ActAsService",
+
+ "http://localhost:(\\d)*/jaxws-samples-wsse-policy-trust-onbehalfof/OnBeha...",
+ "http://\\[::1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-onbehalfof/OnBehalfOfService",
+ "http://\\[0:0:0:0:0:0:0:1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-onbehalfof/OnBehalfOfService"
+ ));
+ services.add(service);
+
+ TokenIssueOperation issueOperation = new TokenIssueOperation();
+ issueOperation.setServices(services);
+ issueOperation.getTokenProviders().add(new SAMLTokenProvider());
+ // required for OnBehalfOf
+ issueOperation.getTokenValidators().add(new UsernameTokenValidator());
+ // added for OnBehalfOf and ActAs
+ issueOperation.getDelegationHandlers().add(new UsernameTokenDelegationHandler());
+ issueOperation.setStsProperties(props);
+
+ TokenValidateOperation validateOperation = new TokenValidateOperation();
+ validateOperation.getTokenValidators().add(new SAMLTokenValidator());
+ validateOperation.setStsProperties(props);
+
+ this.setIssueOperation(issueOperation);
+ this.setValidateOperation(validateOperation);
+ }
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService.wsdl
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService.wsdl (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService.wsdl 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<definitions targetNamespace="http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy" name="OnBehalfOfService"
+ xmlns:tns="http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit..."
+ xmlns:wsaws="http://www.w3.org/2005/08/addressing"
+ xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
+ xmlns:t="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
+ <types>
+ <xsd:schema>
+ <xsd:import namespace="http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy"
+ schemaLocation="OnBehalfOfService_schema1.xsd"/>
+ </xsd:schema>
+ </types>
+ <message name="sayHello">
+ <part name="parameters" element="tns:sayHello"/>
+ </message>
+ <message name="sayHelloResponse">
+ <part name="parameters" element="tns:sayHelloResponse"/>
+ </message>
+ <portType name="OnBehalfOfServiceIface">
+ <operation name="sayHello">
+ <input message="tns:sayHello"/>
+ <output message="tns:sayHelloResponse"/>
+ </operation>
+ </portType>
+ <binding name="OnBehalfOfServicePortBinding" type="tns:OnBehalfOfServiceIface">
+ <wsp:PolicyReference URI="#AsymmetricSAML2Policy" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <operation name="sayHello">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/>
+ <wsp:PolicyReference URI="#Input_Policy" />
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ <wsp:PolicyReference URI="#Output_Policy" />
+ </output>
+ </operation>
+ </binding>
+ <service name="OnBehalfOfService">
+ <port name="OnBehalfOfServicePort" binding="tns:OnBehalfOfServicePortBinding">
+ <soap:address location="http://@jboss.bind.address@:8080/jaxws-samples-wsse-policy-trust-onbehalfof/OnBehalfOfService"/>
+ </port>
+ </service>
+
+ <wsp:Policy wsu:Id="AsymmetricSAML2Policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <wsam:Addressing wsp:Optional="false">
+ <wsp:Policy />
+ </wsam:Addressing>
+ <sp:AsymmetricBinding>
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:IssuedToken
+ sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Al...">
+ <sp:RequestSecurityTokenTemplate>
+ <t:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</t:TokenType>
+ <t:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey</t:KeyType>
+ </sp:RequestSecurityTokenTemplate>
+ <wsp:Policy>
+ <sp:RequireInternalReference />
+ </wsp:Policy>
+ <sp:Issuer>
+ <wsaws:Address>http://@jboss.bind.address@:8080/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService</wsaws:Address>
+ <wsaws:Metadata xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ wsdli:wsdlLocation="http://@jboss.bind.address@:8080/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl">
+ <wsaw:ServiceName xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:stsns="http://docs.oasis-open.org/ws-sx/ws-trust/200512/"
+ EndpointName="UT_Port">stsns:SecurityTokenService</wsaw:ServiceName>
+ </wsaws:Metadata>
+ </sp:Issuer>
+ </sp:IssuedToken>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10 />
+ <sp:RequireIssuerSerialReference />
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ <sp:OnlySignEntireHeadersAndBody />
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss11>
+ <wsp:Policy>
+ <sp:MustSupportRefIssuerSerial />
+ <sp:MustSupportRefThumbprint />
+ <sp:MustSupportRefEncryptedKey />
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust13>
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens />
+ <sp:RequireClientEntropy />
+ <sp:RequireServerEntropy />
+ </wsp:Policy>
+ </sp:Trust13>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+ <wsp:Policy wsu:Id="Input_Policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:SignedParts>
+ <sp:Body />
+ <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+ </sp:SignedParts>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+ <wsp:Policy wsu:Id="Output_Policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:SignedParts>
+ <sp:Body />
+ <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+ </sp:SignedParts>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+</definitions>
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService_schema1.xsd
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService_schema1.xsd (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService_schema1.xsd 2014-02-06 17:29:54 UTC (rev 18309)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema version="1.0" targetNamespace="http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy"
+ xmlns:tns="http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="sayHello" type="tns:sayHello"/>
+
+ <xs:element name="sayHelloResponse" type="tns:sayHelloResponse"/>
+
+ <xs:complexType name="sayHello">
+ <xs:sequence/>
+ </xs:complexType>
+
+ <xs:complexType name="sayHelloResponse">
+ <xs:sequence>
+ <xs:element name="return" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
+
10 years, 3 months
JBossWS SVN: r18308 - in stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core: soap and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: ehugonnet
Date: 2014-02-06 06:41:05 -0500 (Thu, 06 Feb 2014)
New Revision: 18308
Added:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/OneWayUnMarshallerHTTP.java
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java
Log:
[JBPAPP-10655] Xerces tries to parse HTTP response from oneway invocation: "Premature end of file"
Fixing this bug by adding oneway support when obtaining the unmarshaller.
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java 2014-02-06 11:37:49 UTC (rev 18307)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java 2014-02-06 11:41:05 UTC (rev 18308)
@@ -31,7 +31,7 @@
*/
public class HTTPProtocolConnection extends HTTPRemotingConnection
{
- public UnMarshaller getUnmarshaller()
+ public UnMarshaller getUnmarshaller(boolean oneway)
{
return new HTTPMessageUnMarshaller();
}
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2014-02-06 11:37:49 UTC (rev 18307)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2014-02-06 11:41:05 UTC (rev 18308)
@@ -188,7 +188,7 @@
// setup remoting client
Map<String, Object> metadata = createRemotingMetaData(reqMessage, callProps);
Marshaller marshaller = getMarshaller();
- UnMarshaller unmarshaller = getUnmarshaller();
+ UnMarshaller unmarshaller = getUnmarshaller(oneway);
InvokerLocator locator = null;
try
{
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java 2014-02-06 11:37:49 UTC (rev 18307)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java 2014-02-06 11:41:05 UTC (rev 18308)
@@ -41,7 +41,7 @@
*/
public class JsonConnectionHTTP extends HTTPRemotingConnection
{
- public UnMarshaller getUnmarshaller()
+ public UnMarshaller getUnmarshaller(boolean oneway)
{
return new JsonMessageUnMarshaller();
}
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java 2014-02-06 11:37:49 UTC (rev 18307)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java 2014-02-06 11:41:05 UTC (rev 18308)
@@ -38,7 +38,7 @@
{
Marshaller getMarshaller();
- UnMarshaller getUnmarshaller();
+ UnMarshaller getUnmarshaller(boolean oneway);
MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException;
}
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java 2014-02-06 11:37:49 UTC (rev 18307)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java 2014-02-06 11:41:05 UTC (rev 18308)
@@ -34,6 +34,7 @@
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.soap.SOAPMessageMarshaller;
import org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP;
+import org.jboss.ws.core.soap.OneWayUnMarshallerHTTP;
import org.jboss.ws.extensions.xop.XOPContext;
/**
@@ -45,9 +46,12 @@
*/
public class SOAPProtocolConnectionHTTP extends HTTPRemotingConnection
{
- public UnMarshaller getUnmarshaller()
+ public UnMarshaller getUnmarshaller(boolean oneway)
{
- return new SOAPMessageUnMarshallerHTTP();
+ if(oneway)
+ return new OneWayUnMarshallerHTTP();
+ else
+ return new SOAPMessageUnMarshallerHTTP();
}
public Marshaller getMarshaller()
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java 2014-02-06 11:37:49 UTC (rev 18307)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java 2014-02-06 11:41:05 UTC (rev 18308)
@@ -44,6 +44,7 @@
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.soap.OneWayUnMarshallerHTTP;
import org.jboss.ws.core.soap.SOAPMessageMarshaller;
import org.jboss.ws.core.soap.SOAPMessageUnMarshaller;
@@ -57,9 +58,12 @@
{
private boolean waitForResponse;
- public UnMarshaller getUnmarshaller()
+ public UnMarshaller getUnmarshaller(boolean oneway)
{
- return new SOAPMessageUnMarshaller();
+ if(oneway)
+ return new OneWayUnMarshallerHTTP();
+ else
+ return new SOAPMessageUnMarshaller();
}
public Marshaller getMarshaller()
@@ -143,7 +147,7 @@
}
ByteArrayInputStream bais = new ByteArrayInputStream(responseListener.resMessage.getBytes());
- resMessage = (MessageAbstraction)getUnmarshaller().read(bais, null);
+ resMessage = (MessageAbstraction)getUnmarshaller(oneway).read(bais, null);
}
con.stop();
Added: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/OneWayUnMarshallerHTTP.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/OneWayUnMarshallerHTTP.java (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/OneWayUnMarshallerHTTP.java 2014-02-06 11:41:05 UTC (rev 18308)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.ws.WSException;
+
+public class OneWayUnMarshallerHTTP implements UnMarshaller
+{
+ private static Logger log = Logger.getLogger(OneWayUnMarshallerHTTP.class);
+
+ public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException
+ {
+ Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
+ if(!resCode.equals(200))
+ {
+ throw new WSException("One-way operation returned invalid HTTP response: " + resCode);
+ }
+ return null;
+ }
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ return new OneWayUnMarshallerHTTP();
+ }
+
+ public void setClassLoader(ClassLoader cl)
+ {
+ //noop
+ }
+
+ private MimeHeaders getMimeHeaders(Map metadata)
+ {
+ log.debug("getMimeHeaders from: " + metadata);
+
+ MimeHeaders headers = new MimeHeaders();
+ Iterator i = metadata.keySet().iterator();
+ while (i.hasNext())
+ {
+ String key = (String)i.next();
+ Object value = metadata.get(key);
+ if (key != null && value instanceof List)
+ {
+ for (Object listValue : (List)value)
+ {
+ headers.addHeader(key, listValue.toString());
+ }
+ }
+ }
+ return headers;
+ }
+}
10 years, 3 months
JBossWS SVN: r18306 - in stack/cxf/trunk/modules/testsuite/cxf-tests: src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-02-04 11:13:25 -0500 (Tue, 04 Feb 2014)
New Revision: 18306
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/META-INF/permissions.xml
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java
Log:
[JBWS-3738] Solving permissions related failures when running with security manager enabled
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2014-02-03 17:40:34 UTC (rev 18305)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2014-02-04 16:13:25 UTC (rev 18306)
@@ -496,6 +496,7 @@
prefix="META-INF">
<include name="clientstore.jks"/>
<include name="clientKeystore.properties"/>
+ <include name="permissions.xml"/>
</zipfileset>
<manifest>
<attribute name="Dependencies"
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java 2014-02-03 17:40:34 UTC (rev 18305)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java 2014-02-04 16:13:25 UTC (rev 18306)
@@ -24,7 +24,6 @@
import junit.framework.Test;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
-import org.jboss.wsf.test.CryptoHelper;
import org.jboss.wsf.test.JBossWSTest;
import javax.xml.namespace.QName;
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/META-INF/permissions.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/META-INF/permissions.xml (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/META-INF/permissions.xml 2014-02-04 16:13:25 UTC (rev 18306)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<permissions xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/permissions_7.xsd"
+ version="7">
+ <permission>
+ <class-name>java.lang.RuntimePermission</class-name>
+ <name>getClassLoader</name>
+ </permission>
+ <permission>
+ <class-name>java.lang.RuntimePermission</class-name>
+ <name>createClassLoader</name>
+ </permission>
+ <permission>
+ <class-name>java.lang.RuntimePermission</class-name>
+ <name>accessDeclaredMembers</name>
+ </permission>
+ <permission>
+ <class-name>java.util.PropertyPermission</class-name>
+ <name>jboss.bind.address</name>
+ <actions>read</actions>
+ </permission>
+ <permission>
+ <class-name>java.net.SocketPermission</class-name>
+ <name>*</name>
+ <actions>connect,resolve</actions>
+ </permission>
+</permissions>
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/META-INF/permissions.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
10 years, 3 months
JBossWS SVN: r18305 - stack/cxf/trunk/modules/testsuite/shared-tests/src/test/ant-import.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-02-03 12:40:34 -0500 (Mon, 03 Feb 2014)
New Revision: 18305
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/ant-import/build-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/ant-import/build-samples-jaxws.xml
Log:
Fixing binary distro testsuite regressions: move the endpoint publish build to build-jars-jaxws.xml where it really belongs to (not being meant to be part of the bindist)
Modified: stack/cxf/trunk/modules/testsuite/shared-tests/src/test/ant-import/build-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/shared-tests/src/test/ant-import/build-jars-jaxws.xml 2014-02-03 17:02:53 UTC (rev 18304)
+++ stack/cxf/trunk/modules/testsuite/shared-tests/src/test/ant-import/build-jars-jaxws.xml 2014-02-03 17:40:34 UTC (rev 18305)
@@ -32,6 +32,28 @@
<target name="build-jars-jaxws" description="Build the deployments.">
+ <!-- endpoint-publish.war -->
+ <war warfile="${tests.output.dir}/test-libs/endpoint-publish.war" needxmlfile='false'>
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/publish/**/*.class"/>
+ <include name="org/jboss/test/ws/publish/EndpointImpl5.xml"/>
+ <include name="org/jboss/test/ws/publish/TestService.xml"/>
+ <exclude name="org/jboss/test/ws/publish/*TestCase.class"/>
+ </classes>
+ <classes dir="${tests.output.dir}/test-classes/org/jboss/test/ws/publish">
+ <include name="WEB-INF/wsdl/**" />
+ </classes>
+ <webinf dir="${tests.output.dir}/test-resources/publish/WEB-INF">
+ <include name="wsdl/**"/>
+ </webinf>
+ <zipfileset dir="${tests.output.dir}/test-resources/publish/META-INF" prefix="META-INF">
+ <include name="permissions.xml"/>
+ </zipfileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.common" />
+ </manifest>
+ </war>
+
<!-- jaxws-anonymous -->
<war warfile="${tests.output.dir}/test-libs/jaxws-anonymous.war" webxml="${tests.output.dir}/test-resources/jaxws/anonymous/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Modified: stack/cxf/trunk/modules/testsuite/shared-tests/src/test/ant-import/build-samples-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/shared-tests/src/test/ant-import/build-samples-jaxws.xml 2014-02-03 17:02:53 UTC (rev 18304)
+++ stack/cxf/trunk/modules/testsuite/shared-tests/src/test/ant-import/build-samples-jaxws.xml 2014-02-03 17:40:34 UTC (rev 18305)
@@ -553,28 +553,6 @@
</classes>
</war>
- <!-- endpoint-publish.war -->
- <war warfile="${tests.output.dir}/test-libs/endpoint-publish.war" needxmlfile='false'>
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/publish/**/*.class"/>
- <include name="org/jboss/test/ws/publish/EndpointImpl5.xml"/>
- <include name="org/jboss/test/ws/publish/TestService.xml"/>
- <exclude name="org/jboss/test/ws/publish/*TestCase.class"/>
- </classes>
- <classes dir="${tests.output.dir}/test-classes/org/jboss/test/ws/publish" erroronmissingdir="false">
- <include name="WEB-INF/wsdl/**" />
- </classes>
- <webinf dir="${tests.output.dir}/test-resources/publish/WEB-INF" erroronmissingdir="false">
- <include name="wsdl/**"/>
- </webinf>
- <zipfileset dir="${tests.output.dir}/test-resources/publish/META-INF" prefix="META-INF">
- <include name="permissions.xml"/>
- </zipfileset>
- <manifest>
- <attribute name="Dependencies" value="org.jboss.ws.common" />
- </manifest>
- </war>
-
<!-- management-recording-as7.jar -->
<jar destfile="${tests.output.dir}/test-libs/management-recording-as7.jar">
<fileset dir="${tests.output.dir}/test-classes">
10 years, 3 months
JBossWS SVN: r18304 - in stack/cxf/trunk/modules: server/src/main/java/org/jboss/wsf/stack/cxf and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-02-03 12:02:53 -0500 (Mon, 03 Feb 2014)
New Revision: 18304
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
Log:
[JBWS-3756] Add permission checks to sensitive public static methods
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2014-02-03 17:00:22 UTC (rev 18303)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2014-02-03 17:02:53 UTC (rev 18304)
@@ -576,7 +576,7 @@
Client client = obj instanceof DispatchImpl<?> ? ((DispatchImpl<?>)obj).getClient() : ClientProxy.getClient(obj);
client.getOutInterceptors().add(new HandlerChainSortInterceptor(binding));
if (ClassLoaderProvider.isSet()) { //optimization for avoiding checking for a server config when we know for sure we're out-of-container
- ServerConfig sc = AbstractServerConfig.getServerIntegrationServerConfig();
+ ServerConfig sc = getServerConfig();
if (sc != null) {
ClientConfig config = sc.getClientConfig(ClientConfig.STANDARD_CLIENT_CONFIG);
if (config != null) {
@@ -594,6 +594,13 @@
}
}
}
+
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
}
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java 2014-02-03 17:00:22 UTC (rev 18303)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java 2014-02-03 17:02:53 UTC (rev 18304)
@@ -27,6 +27,7 @@
import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
+import java.security.AccessController;
import java.util.Collection;
import java.util.regex.Pattern;
@@ -54,6 +55,7 @@
import org.jboss.wsf.spi.invocation.InvocationContext;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointMetrics;
+import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
import org.jboss.wsf.stack.cxf.configuration.BusHolder;
@@ -201,8 +203,7 @@
final String ctxUri = req.getRequestURI();
final String baseUri = req.getRequestURL().toString() + "?" + queryString;
final EndpointInfo endpointInfo = dest.getEndpointInfo();
- final boolean autoRewrite = SoapAddressRewriteHelper.isAutoRewriteOn(
- AbstractServerConfig.getServerIntegrationServerConfig());
+ final boolean autoRewrite = SoapAddressRewriteHelper.isAutoRewriteOn(getServerConfig());
endpointInfo.setProperty(WSDLGetUtils.AUTO_REWRITE_ADDRESS, autoRewrite);
endpointInfo.setProperty(WSDLGetUtils.AUTO_REWRITE_ADDRESS_ALL, autoRewrite);
@@ -239,6 +240,13 @@
return false;
}
+
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
private long initRequestMetrics(Endpoint endpoint)
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2014-02-03 17:00:22 UTC (rev 18303)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2014-02-03 17:02:53 UTC (rev 18304)
@@ -22,6 +22,7 @@
package org.jboss.wsf.stack.cxf.configuration;
import java.io.IOException;
+import java.security.AccessController;
import java.util.List;
import org.apache.cxf.frontend.ServerFactoryBean;
@@ -134,7 +135,7 @@
if (configFile == null)
{
//use endpoint configs from AS domain
- ServerConfig sc = AbstractServerConfig.getServerIntegrationServerConfig();
+ ServerConfig sc = getServerConfig();
org.jboss.wsf.spi.metadata.config.EndpointConfig config = sc.getEndpointConfig(configName);
if (config != null) {
endpoint.setEndpointConfig(config);
@@ -159,6 +160,13 @@
}
}
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
+
public void setDeploymentRoot(UnifiedVirtualFile deploymentRoot)
{
this.deploymentRoot = deploymentRoot;
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-02-03 17:00:22 UTC (rev 18303)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-02-03 17:02:53 UTC (rev 18304)
@@ -25,6 +25,7 @@
import static org.jboss.wsf.stack.cxf.Messages.MESSAGES;
import java.net.URL;
+import java.security.AccessController;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -282,7 +283,7 @@
if (wsdlLocation == null) {
wsdlLocation = ddep.getAnnotationWsdlLocation();
}
- final ServerConfig sc = AbstractServerConfig.getServerIntegrationServerConfig();
+ final ServerConfig sc = getServerConfig();
if (wsdlLocation != null) {
URL wsdlUrl = dep.getResourceResolver().resolveFailSafe(wsdlLocation);
if (wsdlUrl != null) {
@@ -320,6 +321,13 @@
}
}
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
+
/**
* Extracts the typeNS given the package name
* Algorithm is based on the one specified in JAXWS v2.0 spec
10 years, 3 months
JBossWS SVN: r18303 - in common/trunk/src/main/java/org/jboss/ws/common: management and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-02-03 12:00:22 -0500 (Mon, 03 Feb 2014)
New Revision: 18303
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
Log:
[JBWS-3756] Add permission checks to sensitive public static methods
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java 2014-02-03 16:59:47 UTC (rev 18302)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java 2014-02-03 17:00:22 UTC (rev 18303)
@@ -25,6 +25,7 @@
import static org.jboss.ws.common.integration.WSHelper.isJaxwsEjbEndpoint;
import static org.jboss.ws.common.integration.WSHelper.isJaxwsJseEndpoint;
+import java.security.AccessController;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -64,7 +65,7 @@
throw Messages.MESSAGES.cannotObtainContextRoot(dep.getSimpleName());
PortValue port = new PortValue((Integer)service.getProperty("port"), null);
- ServerConfig serverConfig = AbstractServerConfig.getServerIntegrationServerConfig();
+ ServerConfig serverConfig = getServerConfig();
port.setServerConfig(serverConfig);
String host = serverConfig.getWebServiceHost();
Map<String, Endpoint> endpointsMap = new HashMap<String, Endpoint>();
@@ -108,6 +109,12 @@
}
}
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
protected boolean isConfidentialTransportGuarantee(final Deployment dep, final Endpoint ep)
{
Modified: common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2014-02-03 16:59:47 UTC (rev 18302)
+++ common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2014-02-03 17:00:22 UTC (rev 18303)
@@ -26,6 +26,9 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PrivilegedAction;
import javax.management.MBeanServer;
@@ -51,13 +54,15 @@
* permanentely disabled. The isModifiable() method can be overwridden to enable / disable
* the attribute update.
*
+ * @author alessio.soldano(a)jboss.com
* @author Thomas.Diesler(a)jboss.org
* @author darran.lofthouse(a)jboss.com
- * @author alessio.soldano(a)jboss.com
* @since 08-May-2006
*/
public abstract class AbstractServerConfig implements AbstractServerConfigMBean, ServerConfig
{
+ private static final RuntimePermission LOOKUP_SERVER_INTEGRATION_SERVER_CONFIG = new RuntimePermission("org.jboss.ws.LOOKUP_SERVER_INTEGRATION_SERVER_CONFIG");
+
// The MBeanServer
private volatile MBeanServer mbeanServer;
@@ -290,9 +295,19 @@
if (!ClassLoaderProvider.isSet()) {
return null;
}
+ checkPermission(LOOKUP_SERVER_INTEGRATION_SERVER_CONFIG);
return serverConfig;
}
+ public static final PrivilegedAction<ServerConfig> GET_SERVER_INTEGRATION_SERVER_CONFIG = new PrivilegedAction<ServerConfig>()
+ {
+ @Override
+ public ServerConfig run()
+ {
+ return getServerIntegrationServerConfig();
+ }
+ };
+
public String getImplementationTitle()
{
return stackConfig.getImplementationTitle();
@@ -342,7 +357,16 @@
{
return endpointConfigStore.getConfig(name);
}
-
+
+ private static void checkPermission(final Permission permission)
+ {
+ SecurityManager securityManager = System.getSecurityManager();
+ if (securityManager != null)
+ {
+ AccessController.checkPermission(permission);
+ }
+ }
+
public interface UpdateCallbackHandler {
public void onBeforeUpdate();
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2014-02-03 16:59:47 UTC (rev 18302)
+++ common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2014-02-03 17:00:22 UTC (rev 18303)
@@ -32,6 +32,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.security.AccessController;
import java.util.Iterator;
import java.util.List;
@@ -77,7 +78,7 @@
serverConfig = dep.getAttachment(ServerConfig.class);
if (serverConfig == null)
{
- serverConfig = AbstractServerConfig.getServerIntegrationServerConfig();
+ serverConfig = getServerConfig();
}
if (isJseDeployment(dep) || isWarArchive(dep))
@@ -90,6 +91,13 @@
}
}
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
+
private static synchronized DocumentBuilder getDocumentBuilder()
{
if (builder == null)
@@ -130,6 +138,7 @@
@SuppressWarnings("unchecked")
protected void publishWsdlImports(URL parentURL, Definition parentDefinition, List<String> published, String expLocation) throws Exception
{
+ @SuppressWarnings("rawtypes")
Iterator it = parentDefinition.getImports().values().iterator();
while (it.hasNext())
{
10 years, 3 months