cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r725824 - /cxf/sandbox/interopfest/wstrust10/src/main/java/interop/client/Client.java
Date Thu, 11 Dec 2008 21:39:32 GMT
Author: dkulp
Date: Thu Dec 11 13:39:32 2008
New Revision: 725824

URL: http://svn.apache.org/viewvc?rev=725824&view=rev
Log:
More work to get a token

Modified:
    cxf/sandbox/interopfest/wstrust10/src/main/java/interop/client/Client.java

Modified: cxf/sandbox/interopfest/wstrust10/src/main/java/interop/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wstrust10/src/main/java/interop/client/Client.java?rev=725824&r1=725823&r2=725824&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wstrust10/src/main/java/interop/client/Client.java (original)
+++ cxf/sandbox/interopfest/wstrust10/src/main/java/interop/client/Client.java Thu Dec 11
13:39:32 2008
@@ -35,11 +35,15 @@
 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.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;
 
 import interopbaseaddress.interop.IPingService;
 
@@ -80,15 +84,22 @@
                 IPingService.class
             );
         
-        PolicyBuilder pb = b.getExtension(PolicyBuilder.class);
         STSClient stsClient = new STSClient(b);
+        PolicyBuilder pb = b.getExtension(PolicyBuilder.class);
         stsClient.setPolicy(pb.getPolicy(Client.class.getResourceAsStream(argv[1])));
         stsClient.setLocation("https://131.107.72.15/Security_Federation_SecurityTokenService_Indigo/Symmetric.svc/Scenario_1_IssuedTokenOverTransport_UsernameOverTransport");
         
-        
-        //TODO: get the Trust10 token out of the port 
-        //Trust10 trust = ......
-        //stsClient.setTrust(trust);
+        //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);
+            }
+        }
         
         SecurityToken responseToken = stsClient.requestSecurityToken();
 



Mime
View raw message