Author: rsearls
Date: 2014-01-28 16:25:10 -0500 (Tue, 28 Jan 2014)
New Revision: 18286
Modified:
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/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/SampleSTS.java
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/WSTrustTestUtils.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/META-INF/clientstore.jks
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/actasKeystore.properties
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/actasstore.jks
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ActAsService.wsdl
Log:
[JBWS-3738] incremental update; base components working.
Modified:
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-01-28
20:05:05 UTC (rev 18285)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsCallbackHandler.java 2014-01-28
21:25:10 UTC (rev 18286)
@@ -18,38 +18,27 @@
*/
package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
-import org.apache.ws.security.WSPasswordCallback;
+import org.jboss.wsf.stack.cxf.extensions.security.PasswordCallbackHandler;
+import java.util.HashMap;
+import java.util.Map;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import java.io.IOException;
-
/**
* User: rsearls(a)redhat.com
* Date: 1/26/14
*/
-public class ActAsCallbackHandler implements CallbackHandler {
+public class ActAsCallbackHandler extends PasswordCallbackHandler {
- 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;
- } else if ("eve".equals(pc.getIdentifier())) {
- pc.setPassword("evekpass");
- break;
- }
- }
- }
- }
+ 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", "aspass");
+ return passwords;
+ }
+
}
Modified:
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-01-28
20:05:05 UTC (rev 18285)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ActAsServiceImpl.java 2014-01-28
21:25:10 UTC (rev 18286)
@@ -40,14 +40,14 @@
targetNamespace =
"http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy",
endpointInterface =
"org.jboss.test.ws.jaxws.samples.wsse.policy.trust.ActAsServiceIface"
)
-//TODO: fix endpointProperties
+
@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.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")
})
-@InInterceptors(interceptors =
{"org.jboss.test.ws.jaxws.samples.wsse.policy.trust.ActAsOutInterceptor"})
+//---@InInterceptors(interceptors =
{"org.jboss.test.ws.jaxws.samples.wsse.policy.trust.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/ClientCallbackHandler.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ClientCallbackHandler.java 2014-01-28
20:05:05 UTC (rev 18285)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/ClientCallbackHandler.java 2014-01-28
21:25:10 UTC (rev 18286)
@@ -40,9 +40,6 @@
} else if ("bob".equals(pc.getIdentifier())) {
pc.setPassword("trombone");
break;
- } else if ("eve".equals(pc.getIdentifier())) {
- pc.setPassword("evekpass");
- break;
}
}
}
Modified:
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-01-28
20:05:05 UTC (rev 18285)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/SampleSTS.java 2014-01-28
21:25:10 UTC (rev 18286)
@@ -65,9 +65,14 @@
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"));
+ 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();
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-01-28
20:05:05 UTC (rev 18285)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java 2014-01-28
21:25:10 UTC (rev 18286)
@@ -24,9 +24,11 @@
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;
+import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
import java.net.URL;
@@ -38,7 +40,7 @@
*/
public class WSTrustActAsTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-trust/SecurityService";
+ private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-trust-actas/ActAsService";
private final String stsURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService";
public static Test suite()
@@ -60,16 +62,19 @@
{
BusFactory.setThreadDefaultBus(bus);
- final QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
+ final QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypol...;,
"ActAsService");
final URL wsdlURL = new URL(serviceURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
- ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
+ ActAsServiceIface proxy = (ActAsServiceIface)
service.getPort(ActAsServiceIface.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.setupWsseAndSTSClientActAs(proxy, bus, stsURL +
"?wsdl", stsServiceName, stsPortName);
+ */
+ WSTrustTestUtils.setupWsseAndSTSClientActAs((BindingProvider) proxy, bus);
- assertEquals("WS-Trust Hello World!", proxy.sayHello());
+ assertEquals("ActAs WS-Trust Hello World!", proxy.sayHello());
+
}
finally
{
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-01-28
20:05:05 UTC (rev 18285)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java 2014-01-28
21:25:10 UTC (rev 18286)
@@ -132,17 +132,14 @@
*
* @param proxy
* @param bus
- * @param stsWsdlLocation
- * @param stsService
- * @param stsPort
*/
- public static void setupWsseAndSTSClientActAs(ServiceIface proxy, Bus bus, String
stsWsdlLocation, QName stsService, QName stsPort) {
- Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
+ public static void setupWsseAndSTSClientActAs(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, "myservicekey");
- // the 2 following are required here.
+ 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");
@@ -150,10 +147,8 @@
Map<String, Object> props = stsClient.getProperties();
props.put(SecurityConstants.USERNAME, "alice");
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");
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/META-INF/clientstore.jks
===================================================================
(Binary files differ)
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/actasKeystore.properties
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/actasKeystore.properties 2014-01-28
20:05:05 UTC (rev 18285)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/actasKeystore.properties 2014-01-28
21:25:10 UTC (rev 18286)
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#
http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=aapass
+org.apache.ws.security.crypto.merlin.keystore.alias=myactaskey
+org.apache.ws.security.crypto.merlin.keystore.file=actasstore.jks
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/actasstore.jks
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/actasstore.jks 2014-01-28
20:05:05 UTC (rev 18285)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/actasstore.jks 2014-01-28
21:25:10 UTC (rev 18286)
@@ -0,0 +1,49 @@
+����
+myactaskey
++*
+Y�*���Lɧ^طf��$�}r��?�/��DE�ʒ�3C��@f�C�;����]<'B2g9Q'X:�8v.LbT{o�9
+.Sample ActAs Web Service -- NOT FOR PRODUCTION10U
+IT Department10U
+www.actas.com0
+140127183414Z
+231206183414Z0��10 UUS1
+0UOhio10
+UDayton1705U
+.Sample ActAs Web Service -- NOT FOR PRODUCTION10U
+IT Department10U
+www.actas.com0�"0
+ *�H��
+
+�
+�̑�����G/�R�������v;+7���9��3-�7
+¦
+��M��i�&��#���I�iꝟ��}�\����;��~MO��R��k{�@[��r6��m�}�kd
+\����:�>���a�f3a\��ہ[�?Ab�� ��8����e��9����_
+ Sample STS -- NOT FOR PRODUCTION10U
+IT Department10U
www.sts.com10 *�H��
+ sts(a)sts.com0
+110209183813Z
+210206183813Z0��10 UUS10UMaryland10U Baltimore1)0'U
+ Sample STS -- NOT FOR PRODUCTION10U
+IT Department10U
www.sts.com10 *�H��
+ sts@sts.com0��0
+ *�H��
+
+ Sample STS -- NOT FOR PRODUCTION10U
+IT Department10U
www.sts.com10 *�H��
+ sts@sts.com�
+���k�㕱:��z�}Rd�g�k�q���o�X�m���m�Avls�\Y��3
\ No newline at end of file
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ActAsService.wsdl
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ActAsService.wsdl 2014-01-28
20:05:05 UTC (rev 18285)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ActAsService.wsdl 2014-01-28
21:25:10 UTC (rev 18286)
@@ -12,7 +12,8 @@
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/actaswssecurit...
schemaLocation="ActAsService_schema1.xsd"/>
+ <xsd:import
namespace="http://www.jboss.org/jbossws/ws-extensions/actaswssecurit...
+ schemaLocation="ActAsService_schema1.xsd"/>
</xsd:schema>
</types>
<message name="sayHello">
@@ -44,7 +45,7 @@
</binding>
<service name="ActAsService">
<port name="ActAsServicePort"
binding="tns:ActAsServicePortBinding">
- <soap:address
location="http://@jboss.bind.address@:8080/jaxws-samples-wsse-policy-trust/ActAsService"/>
+ <soap:address
location="http://@jboss.bind.address@:8080/jaxws-samples-wsse-policy-trust-actas/ActAsService"/>
</port>
</service>