cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r740883 - in /cxf/sandbox/interopfest: wssec11/src/main/java/interop/client/ wstrust13/src/main/java/interop/client/ wstrust13/src/main/java/interop/server/ wstrust13/src/main/resources/etc/
Date Wed, 04 Feb 2009 21:04:00 GMT
Author: dkulp
Date: Wed Feb  4 21:04:00 2009
New Revision: 740883

URL: http://svn.apache.org/viewvc?rev=740883&view=rev
Log:
Move all trust stuff into config. 
Checkstyle cleanups

Modified:
    cxf/sandbox/interopfest/wssec11/src/main/java/interop/client/Client.java
    cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/Client.java
    cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/KeystorePasswordCallback.java
    cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/UTPasswordCallback.java
    cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/KeystorePasswordCallback.java
    cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/PingServiceImpl.java
    cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/Server.java
    cxf/sandbox/interopfest/wstrust13/src/main/resources/etc/client.xml

Modified: cxf/sandbox/interopfest/wssec11/src/main/java/interop/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wssec11/src/main/java/interop/client/Client.java?rev=740883&r1=740882&r2=740883&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wssec11/src/main/java/interop/client/Client.java (original)
+++ cxf/sandbox/interopfest/wssec11/src/main/java/interop/client/Client.java Wed Feb  4 21:04:00
2009
@@ -70,10 +70,10 @@
                                  "XD",
                                  "XD-ES",
                                  "XD-SEES",
-                                 //"K",   //NOT YET WORKING
-                                 //"K-NoTimestamp",     //NOT YET WORKING
-                                 //"KD",   //NOT YET WORKING
-                                 //"KD-ES"   //NOT YET WORKING
+                                 //"K",   //NOT YET WORKING [1]
+                                 //"K-NoTimestamp",     //NOT YET WORKING  [1]
+                                 //"KD",   //NOT YET WORKING  [1]
+                                 //"KD-ES"   //NOT YET WORKING  [1]
             };
         }
         //argv = new String[] {argv[10]};
@@ -119,3 +119,9 @@
     }
 
 }
+
+
+/*
+[1] These tests require a Kerberos token, but the MS endpoints don't document where that
token is supposed to come from.
+    The "online" tester for these also does't work.
+*/

Modified: cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/Client.java?rev=740883&r1=740882&r2=740883&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/Client.java (original)
+++ cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/Client.java Wed Feb  4
21:04:00 2009
@@ -1,8 +1,4 @@
 /**
- * Copyright (c) 1993-2007 IONA Technologies PLC.
- *            All Rights Reserved.
- */
-/**
  * 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
@@ -27,31 +23,11 @@
 import java.util.List;
 
 import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
 
+import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.tempuri.IPingServiceContract;
 import org.tempuri.PingService;
 
-import org.apache.cxf.Bus;
-import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.frontend.ClientProxy;
-import org.apache.cxf.service.model.BindingOperationInfo;
-import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.ws.policy.EffectivePolicy;
-import org.apache.cxf.ws.policy.PolicyAssertion;
-import org.apache.cxf.ws.policy.PolicyBuilder;
-import org.apache.cxf.ws.policy.PolicyEngine;
-import org.apache.cxf.ws.security.SecurityConstants;
-import org.apache.cxf.ws.security.policy.model.IssuedToken;
-import org.apache.cxf.ws.security.policy.model.SupportingToken;
-import org.apache.cxf.ws.security.policy.model.Token;
-import org.apache.cxf.ws.security.policy.model.Trust10;
-import org.apache.cxf.ws.security.policy.model.Trust13;
-import org.apache.cxf.ws.security.tokenstore.SecurityToken;
-import org.apache.cxf.ws.security.trust.STSClient;
-import org.apache.neethi.Policy;
-
 public final class Client {
     
     private static final String INPUT = "foo";
@@ -72,23 +48,22 @@
         
         if (argv.length < 1) {
             argv = new String[] {
-                                 "CustomBinding_IPingServiceContract",
-                                 //"OasisScenario2Binding_IPingServiceContract",  //NOT_WORKING
-                                 "CustomBinding_IPingServiceContract1",
-                                 "OasisScenario4Binding_IPingServiceContract",
-                                 //"CustomBinding_IPingServiceContract2", //NOT WORKING 
[1]
-                                 //"CustomBinding_IPingServiceContract3", //NOT WORKING -
SecureConversation
-                                 //"CustomBinding_IPingServiceContract4", //NOT WORKING -[2]
-                                 //"CustomBinding_IPingServiceContract5", //NOT WORKING -[2]
-                                 //"CustomBinding_IPingServiceContract7", //NOT WORKING -
service not running on given port
-                                 "CustomBinding_IPingServiceContract8",
-                                 //"CustomBinding_IPingServiceContract9", //NOT WORKING -
SecureConversation
-                                 
-                                };
+                "CustomBinding_IPingServiceContract",
+                //"OasisScenario2Binding_IPingServiceContract",  //NOT_WORKING
+                "CustomBinding_IPingServiceContract1",
+                "OasisScenario4Binding_IPingServiceContract",
+                //"CustomBinding_IPingServiceContract2", //NOT WORKING  [1]
+                //"CustomBinding_IPingServiceContract3", //NOT WORKING - SecureConversation
+                //"CustomBinding_IPingServiceContract4", //NOT WORKING -[2]
+                //"CustomBinding_IPingServiceContract5", //NOT WORKING -[2]
+                //"CustomBinding_IPingServiceContract7", //NOT WORKING - service not running
on given port
+                "CustomBinding_IPingServiceContract8",
+                //"CustomBinding_IPingServiceContract9", //NOT WORKING - SecureConversation
+            };
         }
         //argv = new String[] {argv[0]};
 
-        Bus b = new SpringBusFactory().createBus("etc/client.xml");
+        new SpringBusFactory().createBus("etc/client.xml");
         List<String> results = new ArrayList<String>(argv.length);
         
         for (String portPrefix : argv) {
@@ -102,32 +77,7 @@
                         ),
                         IPingServiceContract.class
                     );
-                
-                STSClient stsClient = new STSClient(b);
-                stsClient.setBeanName(portPrefix);
-                
-                //TODO: get the Trust10 token out of the port
-                PolicyEngine pe = b.getExtension(PolicyEngine.class);
-                org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
-                for (PolicyAssertion as : pe.getClientEndpointPolicy(client.getEndpoint().getEndpointInfo(),

-                                                      client.getConduit()).getChosenAlternative())
{
-                    if (as instanceof Trust10) {
-                        stsClient.setTrust((Trust10)as);
-                    } else if (as instanceof Trust13) {
-                        stsClient.setTrust((Trust13)as);
-                    } else if (as instanceof SupportingToken) {
-                        Token t2 = ((SupportingToken)as).getToken();
-                        if (t2 instanceof IssuedToken) {
-                            IssuedToken token = (IssuedToken)t2;
-                            stsClient.setTemplate(token.getRstTemplate());
-                        }
-                    }
-                }
-                
-                SecurityToken responseToken = stsClient.requestSecurityToken();
-        
-                ((BindingProvider)port).getRequestContext().put(SecurityConstants.TRUST_TOKEN,
responseToken);
-            
+               
                 final String output = port.ping(INPUT);
                 if (!INPUT.equals(output)) {
                     System.err.println(
@@ -149,14 +99,12 @@
     }
 
 }
+//CHECKSTYLE:OFF
 /*
-
 [1] The policy in PingService.wsdl seems to be wrong.   The sp:RequestSecurityTokenTemplate
for it states:
      <trust:KeyType xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey</trust:KeyType>
      but the "sample" produced from their online tool sends SymetricKey
 
 [2] OasisScenario9/10 (CustomBinding_IPingServiceContract4/5) isn't working yet due to WSS4J
not supporting using 
 RSAKeyValue (KeyInfo, WS-SecurityPolicy/KeyValueToken) things for creating signatures
-
-
  */

Modified: cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/KeystorePasswordCallback.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/KeystorePasswordCallback.java?rev=740883&r1=740882&r2=740883&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/KeystorePasswordCallback.java
(original)
+++ cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/KeystorePasswordCallback.java
Wed Feb  4 21:04:00 2009
@@ -1,6 +1,20 @@
 /**
- *        Copyright (c) 1993-2006 IONA Technologies PLC.
- *                       All Rights Reserved.
+ * 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 interop.client;
 

Modified: cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/UTPasswordCallback.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/UTPasswordCallback.java?rev=740883&r1=740882&r2=740883&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/UTPasswordCallback.java
(original)
+++ cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/UTPasswordCallback.java
Wed Feb  4 21:04:00 2009
@@ -1,8 +1,21 @@
 /**
- *        Copyright (c) 1993-2007 IONA Technologies PLC.
- *                       All Rights Reserved.
+ * 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 interop.client;
 
 import java.io.IOException;

Modified: cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/KeystorePasswordCallback.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/KeystorePasswordCallback.java?rev=740883&r1=740882&r2=740883&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/KeystorePasswordCallback.java
(original)
+++ cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/KeystorePasswordCallback.java
Wed Feb  4 21:04:00 2009
@@ -1,6 +1,20 @@
 /**
- *        Copyright (c) 1993-2006 IONA Technologies PLC.
- *                       All Rights Reserved.
+ * 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 interop.server;
 

Modified: cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/PingServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/PingServiceImpl.java?rev=740883&r1=740882&r2=740883&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/PingServiceImpl.java (original)
+++ cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/PingServiceImpl.java Wed
Feb  4 21:04:00 2009
@@ -19,7 +19,6 @@
 
 package interop.server;
 
-import javax.xml.ws.Holder;
 
 import org.tempuri.IPingServiceContract;
 

Modified: cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/Server.java?rev=740883&r1=740882&r2=740883&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/Server.java (original)
+++ cxf/sandbox/interopfest/wstrust13/src/main/java/interop/server/Server.java Wed Feb  4
21:04:00 2009
@@ -1,8 +1,4 @@
 /**
- * Copyright (c) 1993-2007 IONA Technologies PLC.
- *            All Rights Reserved.
- */
-/**
  * 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
@@ -69,7 +65,7 @@
         argv = new String[] {"XD-SEES"};
         */
     }
-    private final void addProperties(Endpoint ep) {
+    private void addProperties(Endpoint ep) {
         ep.getProperties().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
         ep.getProperties().put(SecurityConstants.ENCRYPT_USERNAME, "Bob");
         ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES, "etc/bob.properties");

Modified: cxf/sandbox/interopfest/wstrust13/src/main/resources/etc/client.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wstrust13/src/main/resources/etc/client.xml?rev=740883&r1=740882&r2=740883&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wstrust13/src/main/resources/etc/client.xml (original)
+++ cxf/sandbox/interopfest/wstrust13/src/main/resources/etc/client.xml Wed Feb  4 21:04:00
2009
@@ -25,7 +25,9 @@
         </cxf:features>
     </cxf:bus>
     
-    <bean id="CustomBinding_IPingServiceContract" 
+
+    <!-- Configure based on the endpoint name -->    
+    <bean name="{http://tempuri.org/}CustomBinding_IPingServiceContract.sts-client" 
     	class="org.apache.cxf.ws.security.trust.STSClient" abstract="true">
     	<property name="wsdlLocation" value="target/wsdl2/trust.wsdl"/>
     	<property name="serviceName" value="{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}SecurityTokenService"/>
@@ -37,7 +39,25 @@
     		</map>
     	</property>
     </bean>
+    
+    <!-- Configure based on a reference to an actual defined STSClient bean -->
+    <bean id="OasisScenario4Binding_IPingServiceContract-sts" 
+    	class="org.apache.cxf.ws.security.trust.STSClient">
+    	<constructor-arg ref="cxf"/>
+    	<property name="wsdlLocation" value="target/wsdl2/trust.wsdl"/>
+    	<property name="serviceName" value="{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}SecurityTokenService"/>
+    	<property name="endpointName" value="{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}CustomBinding_IWSTrust13Sync3"/>
+    	<property name="properties">
+    		<map>
+            	<entry key="ws-security.callback-handler" value="interop.client.KeystorePasswordCallback"/>
+            	<entry key="ws-security.signature.properties" value="etc/alice.properties"/>

+            	<entry key="ws-security.encryption.properties" value="etc/wssip.properties"/>

+    		</map>
+    	</property>
+    </bean>
          
+        
+        <!-- 
     <bean id="OasisScenario2Binding_IPingServiceContract" 
     	class="org.apache.cxf.ws.security.trust.STSClient" abstract="true">
     	<property name="wsdlLocation" value="target/wsdl2/trust.wsdl"/>
@@ -76,6 +96,10 @@
     		</map>
     	</property>
     </bean>
+    <alias name="CustomBinding_IPingServiceContract" alias="CustomBinding_IPingServiceContract4"
/>
+    <alias name="CustomBinding_IPingServiceContract" alias="CustomBinding_IPingServiceContract7"
/>
+    -->
+    
     <bean id="CustomBinding_IPingServiceContract2" 
     	class="org.apache.cxf.ws.security.trust.STSClient" abstract="true">
     	<property name="wsdlLocation" value="target/wsdl2/trust.wsdl"/>
@@ -89,31 +113,51 @@
     		</map>
     	</property>
     </bean>    
-    <alias name="CustomBinding_IPingServiceContract" alias="CustomBinding_IPingServiceContract4"
/>
-    <alias name="CustomBinding_IPingServiceContract" alias="CustomBinding_IPingServiceContract7"
/>
-    <alias name="CustomBinding_IPingServiceContract2" alias="CustomBinding_IPingServiceContract8"
/>
-    
+    <alias name="CustomBinding_IPingServiceContract2" alias="{http://tempuri.org/}CustomBinding_IPingServiceContract8.sts-client"
/>
     
     <jaxws:client name="{http://tempuri.org/}CustomBinding_IPingServiceContract1" createdFromAPI="true">
         <jaxws:properties>
             <entry key="ws-security.callback-handler" value="interop.client.KeystorePasswordCallback"/>
             <entry key="ws-security.encryption.properties" value="etc/bob.properties"/>

+            <entry key="ws-security.sts.client">
+                <!-- direct STSClient config and creation -->
+			    <bean class="org.apache.cxf.ws.security.trust.STSClient">
+			    	<constructor-arg ref="cxf"/>
+			    	<property name="wsdlLocation" value="target/wsdl2/trust.wsdl"/>
+			    	<property name="serviceName" value="{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}SecurityTokenService"/>
+			    	<property name="endpointName" value="{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}CustomBinding_IWSTrust13Sync"/>
+			    	<property name="properties">
+			    		<map>
+			    			<entry key="ws-security.username" value="joe"/>
+			    			<entry key="ws-security.password" value="eoj"/>
+			    		</map>
+			    	</property>
+			    </bean>            
+            </entry> 
         </jaxws:properties>
     </jaxws:client>
+    
     <jaxws:client name="{http://tempuri.org/}OasisScenario4Binding_IPingServiceContract"
createdFromAPI="true">
         <jaxws:properties>
             <entry key="ws-security.callback-handler" value="interop.client.KeystorePasswordCallback"/>
+            <!-- STS config by reference -->
+            <entry key="ws-security.sts.client" value-ref="OasisScenario4Binding_IPingServiceContract-sts"/>
         </jaxws:properties>
     </jaxws:client>
+    
+    
     <jaxws:client name="{http://tempuri.org/}CustomBinding_IPingServiceContract2" createdFromAPI="true">
         <jaxws:properties>
             <entry key="ws-security.callback-handler" value="interop.client.KeystorePasswordCallback"/>
         </jaxws:properties>
     </jaxws:client>
+    
+    
     <jaxws:client name="{http://tempuri.org/}CustomBinding_IPingServiceContract8" createdFromAPI="true">
         <jaxws:properties>
             <entry key="ws-security.callback-handler" value="interop.client.KeystorePasswordCallback"/>
-            <entry key="ws-security.encryption.properties" value="etc/bob.properties"/>

+            <entry key="ws-security.encryption.properties" value="etc/bob.properties"/>
+             
         </jaxws:properties>
     </jaxws:client>    
     



Mime
View raw message