Author: coheigea
Date: Wed Apr 11 14:52:25 2012
New Revision: 1324797

URL: http://svn.apache.org/viewvc?rev=1324797&view=rev
Log:
[CXF-4158] - Added a system test to the STS for renewing an expired token.

Added:
    
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLRenewTest.java
    
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLTokenValidator.java
    
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/DoubleIt.wsdl
      - copied, changed from r1324794, 
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/transport/DoubleIt.wsdl
    
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/cxf-client.xml
    
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/cxf-service.xml
Removed:
    
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/ws-trust-1.4-service.wsdl
Modified:
    
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
    
cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
    
cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
    
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/transport/DoubleIt.wsdl

Modified: 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java?rev=1324797&r1=1324796&r2=1324797&view=diff
==============================================================================
--- 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
 (original)
+++ 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
 Wed Apr 11 14:52:25 2012
@@ -118,6 +118,7 @@ public class CachingTest extends Abstrac
         Client client = ClientProxy.getClient(transportSaml1Port);
         Endpoint ep = client.getEndpoint();
         ep.remove(SecurityConstants.TOKEN_ID);
+        ep.remove(SecurityConstants.TOKEN);
 
         try {
             doubleIt(transportSaml1Port, 35);

Added: 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLRenewTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLRenewTest.java?rev=1324797&view=auto
==============================================================================
--- 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLRenewTest.java
 (added)
+++ 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLRenewTest.java
 Wed Apr 11 14:52:25 2012
@@ -0,0 +1,108 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.sts.renew;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.systest.sts.common.SecurityTestUtil;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.ws.security.SecurityConstants;
+import org.apache.cxf.ws.security.trust.STSClient;
+
+import org.example.contract.doubleit.DoubleItPortType;
+import org.junit.BeforeClass;
+
+/**
+ * This is a set of system tests to renew SAML tokens. The client obtains a 
(soon to be expired token)
+ * from the STS, and sends it to the service provider, which should succeed. 
The client then sleeps to
+ * expire the token, and the IssuedTokenInterceptorProvider should realise 
that the token is expired,
+ * and renew it with the STS, before making another service invocation.
+ */
+public class SAMLRenewTest extends AbstractBusClientServerTestBase {
+    
+    static final String STSPORT = allocatePort(STSServer.class);
+    
+    private static final String NAMESPACE = 
"http://www.example.org/contract/DoubleIt";;
+    private static final QName SERVICE_QNAME = new QName(NAMESPACE, 
"DoubleItService");
+
+    private static final String PORT = allocatePort(Server.class);
+    
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(Server.class, true)
+        );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(STSServer.class, true)
+        );
+    }
+    
+    @org.junit.AfterClass
+    public static void cleanup() {
+        SecurityTestUtil.cleanup();
+    }
+
+    @org.junit.Test
+    public void testRenewSAML1Token() throws Exception {
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = SAMLRenewTest.class.getResource("cxf-client.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL wsdl = SAMLRenewTest.class.getResource("DoubleIt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItTransportSaml1Port");
+        DoubleItPortType transportPort = 
+            service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(transportPort, PORT);
+        
+        // Make initial successful invocation
+        doubleIt(transportPort, 25);
+        
+        // Now sleep to expire the token
+        Thread.sleep(8 * 1000);
+        
+        BindingProvider p = (BindingProvider)transportPort;
+        STSClient stsClient = 
(STSClient)p.getRequestContext().get(SecurityConstants.STS_CLIENT);
+        stsClient.setTtl(300);
+        
+        // The IssuedTokenInterceptorProvider should renew the token 
+        doubleIt(transportPort, 30);
+    }
+    
+    private static void doubleIt(DoubleItPortType port, int numToDouble) {
+        int resp = port.doubleIt(numToDouble);
+        assertEquals(numToDouble * 2 , resp);
+    }
+}

Added: 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLTokenValidator.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLTokenValidator.java?rev=1324797&view=auto
==============================================================================
--- 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLTokenValidator.java
 (added)
+++ 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLTokenValidator.java
 Wed Apr 11 14:52:25 2012
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.sts.renew;
+
+import org.apache.cxf.ws.security.trust.STSTokenValidator;
+import org.apache.ws.security.WSSecurityException;
+import org.apache.ws.security.handler.RequestData;
+import org.apache.ws.security.validate.Credential;
+
+/**
+ * This class validates a SAML Token by dispatching it to an STS. It pauses 
first to make sure
+ * that the SAML Token expires (one of the tokens it receives should be close 
to expiration).
+ */
+public class SAMLTokenValidator extends STSTokenValidator {
+    
+    public SAMLTokenValidator() {
+        super(true);
+    }
+    
+    public Credential validate(Credential credential, RequestData data) throws 
WSSecurityException {
+        // Sleep to make sure token gets replicated
+        try {
+            Thread.sleep(5 * 1000);
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+        return super.validate(credential, data);
+    }
+
+}

Copied: 
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/DoubleIt.wsdl
 (from r1324794, 
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/transport/DoubleIt.wsdl)
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/DoubleIt.wsdl?p2=cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/DoubleIt.wsdl&p1=cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/transport/DoubleIt.wsdl&r1=1324794&r2=1324797&rev=1324797&view=diff
==============================================================================
--- 
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/transport/DoubleIt.wsdl
 (original)
+++ 
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/DoubleIt.wsdl
 Wed Apr 11 14:52:25 2012
@@ -28,40 +28,8 @@
     <wsdl:import location="src/test/resources/DoubleItLogical.wsdl" 
                  namespace="http://www.example.org/contract/DoubleIt"/>
 
-       <wsdl:binding name="DoubleItTransportSAML1Binding" 
type="tns:DoubleItPortType">
-               <wsp:PolicyReference URI="#DoubleItBindingTransportSAML1Policy" 
/>
-               <soap:binding style="document"
-                       transport="http://schemas.xmlsoap.org/soap/http"; />
-               <wsdl:operation name="DoubleIt">
-                       <soap:operation soapAction="" />
-                       <wsdl:input>
-                               <soap:body use="literal" />
-                               <wsp:PolicyReference 
URI="#DoubleItBinding_DoubleIt_Input_Policy" />
-                       </wsdl:input>
-                       <wsdl:output>
-                               <soap:body use="literal" />
-                               <wsp:PolicyReference 
URI="#DoubleItBinding_DoubleIt_Output_Policy" />
-                       </wsdl:output>
-               </wsdl:operation>
-       </wsdl:binding>
-       <wsdl:binding name="DoubleItTransportSAML2Binding" 
type="tns:DoubleItPortType">
-               <wsp:PolicyReference URI="#DoubleItBindingTransportSAML2Policy" 
/>
-               <soap:binding style="document"
-                       transport="http://schemas.xmlsoap.org/soap/http"; />
-               <wsdl:operation name="DoubleIt">
-                       <soap:operation soapAction="" />
-                       <wsdl:input>
-                               <soap:body use="literal" />
-                               <wsp:PolicyReference 
URI="#DoubleItBinding_DoubleIt_Input_Policy" />
-                       </wsdl:input>
-                       <wsdl:output>
-                               <soap:body use="literal" />
-                               <wsp:PolicyReference 
URI="#DoubleItBinding_DoubleIt_Output_Policy" />
-                       </wsdl:output>
-               </wsdl:operation>
-       </wsdl:binding>
-       <wsdl:binding name="DoubleItTransportSAML1EndorsingBinding" 
type="tns:DoubleItPortType">
-               <wsp:PolicyReference 
URI="#DoubleItBindingTransportSAML1EndorsingPolicy" />
+       <wsdl:binding name="DoubleItTransportSaml1Binding" 
type="tns:DoubleItPortType">
+               <wsp:PolicyReference URI="#DoubleItBindingTransportSaml1Policy" 
/>
                <soap:binding style="document"
                        transport="http://schemas.xmlsoap.org/soap/http"; />
                <wsdl:operation name="DoubleIt">
@@ -78,162 +46,13 @@
        </wsdl:binding>
 
        <wsdl:service name="DoubleItService">
-               <wsdl:port name="DoubleItTransportSAML1Port" 
binding="tns:DoubleItTransportSAML1Binding">
+               <wsdl:port name="DoubleItTransportSaml1Port" 
binding="tns:DoubleItTransportSaml1Binding">
                        <soap:address
                                
location="https://localhost:8081/doubleit/services/doubleittransportsaml1"; />
                </wsdl:port>
-               <wsdl:port name="DoubleItTransportSAML2Port" 
binding="tns:DoubleItTransportSAML2Binding">
-                       <soap:address
-                               
location="https://localhost:8081/doubleit/services/doubleittransportsaml2"; />
-               </wsdl:port>
-               <wsdl:port name="DoubleItTransportSAML1EndorsingPort" 
-                          binding="tns:DoubleItTransportSAML1EndorsingBinding">
-                       <soap:address
-                               
location="https://localhost:8081/doubleit/services/doubleittransportsaml1endorsing";
 />
-               </wsdl:port>
        </wsdl:service>
        
-       <wsp:Policy wsu:Id="DoubleItBindingTransportSAML1Policy">
-               <wsp:ExactlyOne>
-                       <wsp:All>
-                               <wsam:Addressing wsp:Optional="false">
-                                       <wsp:Policy />
-                               </wsam:Addressing>
-                               <sp:TransportBinding
-                                       
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";>
-                                       <wsp:Policy>
-                                               <sp:TransportToken>
-                                                       <wsp:Policy>
-                                                               <sp:IssuedToken
-                                                                       
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient";>
-                                                                       
<sp:RequestSecurityTokenTemplate>
-                                                                               
<t:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</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>
-                                                                               
<wsaw:Address>http://localhost:8080/STS/STSUT
-                                                                               
</wsaw:Address>
-                                                                               
<wsaw:Metadata>
-                                                                               
        <wsx:Metadata>
-                                                                               
                <wsx:MetadataSection>
-                                                                               
                        <wsx:MetadataReference>
-                                                                               
                                
<wsaw:Address>http://localhost:8080/SecurityTokenService/UT/mex
-                                                                               
                                </wsaw:Address>
-                                                                               
                        </wsx:MetadataReference>
-                                                                               
                </wsx:MetadataSection>
-                                                                               
        </wsx:Metadata>
-                                                                               
</wsaw:Metadata>
-                                                                       
</sp:Issuer>
-                                                               
</sp:IssuedToken>
-                                                               <sp:HttpsToken>
-                                                                    
<wsp:Policy/>
-                                                                
</sp:HttpsToken>
-                                                       </wsp:Policy>
-                                               </sp:TransportToken>
-                                               <sp:AlgorithmSuite>
-                                                       <wsp:Policy>
-                                                               
<sp:TripleDesRsa15 />
-                                                       </wsp:Policy>
-                                               </sp:AlgorithmSuite>
-                                               <sp:Layout>
-                                                       <wsp:Policy>
-                                                               <sp:Lax />
-                                                       </wsp:Policy>
-                                               </sp:Layout>
-                                               <sp:IncludeTimestamp />
-                                       </wsp:Policy>
-                               </sp:TransportBinding>
-                               <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="DoubleItBindingTransportSAML2Policy">
-               <wsp:ExactlyOne>
-                       <wsp:All>
-                               <wsam:Addressing wsp:Optional="false">
-                                       <wsp:Policy />
-                               </wsam:Addressing>
-                               <sp:TransportBinding
-                                       
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";>
-                                       <wsp:Policy>
-                                               <sp:TransportToken>
-                                                       <wsp:Policy>
-                                                               <sp:IssuedToken
-                                                                       
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient";>
-                                                                       
<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>
-                                                                               
<wsaw:Address>http://localhost:8080/SecurityTokenService/UT
-                                                                               
</wsaw:Address>
-                                                                               
<wsaw:Metadata>
-                                                                               
        <wsx:Metadata>
-                                                                               
                <wsx:MetadataSection>
-                                                                               
                        <wsx:MetadataReference>
-                                                                               
                                
<wsaw:Address>http://localhost:8080/SecurityTokenService/UT/mex
-                                                                               
                                </wsaw:Address>
-                                                                               
                        </wsx:MetadataReference>
-                                                                               
                </wsx:MetadataSection>
-                                                                               
        </wsx:Metadata>
-                                                                               
</wsaw:Metadata>
-                                                                       
</sp:Issuer>
-                                                               
</sp:IssuedToken>
-                                                               <sp:HttpsToken>
-                                                                    
<wsp:Policy/>
-                                                                
</sp:HttpsToken>
-                                                       </wsp:Policy>
-                                               </sp:TransportToken>
-                                               <sp:AlgorithmSuite>
-                                                       <wsp:Policy>
-                                                               
<sp:TripleDesRsa15 />
-                                                       </wsp:Policy>
-                                               </sp:AlgorithmSuite>
-                                               <sp:Layout>
-                                                       <wsp:Policy>
-                                                               <sp:Lax />
-                                                       </wsp:Policy>
-                                               </sp:Layout>
-                                               <sp:IncludeTimestamp />
-                                       </wsp:Policy>
-                               </sp:TransportBinding>
-                               <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="DoubleItBindingTransportSAML1EndorsingPolicy">
+       <wsp:Policy wsu:Id="DoubleItBindingTransportSaml1Policy">
                <wsp:ExactlyOne>
                        <wsp:All>
                                <wsam:Addressing wsp:Optional="false">
@@ -245,8 +64,8 @@
                                                <sp:TransportToken>
                                                        <wsp:Policy>
                                                                <sp:HttpsToken>
-                                                                    
<wsp:Policy/>
-                                                                
</sp:HttpsToken>
+                                   <wsp:Policy/>
+                                </sp:HttpsToken>
                                                        </wsp:Policy>
                                                </sp:TransportToken>
                                                <sp:AlgorithmSuite>
@@ -262,14 +81,14 @@
                                                <sp:IncludeTimestamp />
                                        </wsp:Policy>
                                </sp:TransportBinding>
-                               <sp:EndorsingSupportingTokens
+                               <sp:SupportingTokens
                                        
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";>
                                        <wsp:Policy>
                                                <sp:IssuedToken
                                                    
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient";>
                                                        
<sp:RequestSecurityTokenTemplate>
                                                                
<t:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</t:TokenType>
-                                                               
<t:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey</t:KeyType>
+                                                               
<t:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</t:KeyType>
                                                        
</sp:RequestSecurityTokenTemplate>
                                                        <wsp:Policy>
                                                                
<sp:RequireInternalReference />
@@ -290,7 +109,7 @@
                                                        </sp:Issuer>
                                                </sp:IssuedToken>
                                        </wsp:Policy>
-                               </sp:EndorsingSupportingTokens>
+                               </sp:SupportingTokens>
                                <sp:Wss11>
                                        <wsp:Policy>
                                                <sp:MustSupportRefIssuerSerial 
/>

Added: 
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/cxf-client.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/cxf-client.xml?rev=1324797&view=auto
==============================================================================
--- 
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/cxf-client.xml
 (added)
+++ 
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/cxf-client.xml
 Wed Apr 11 14:52:25 2012
@@ -0,0 +1,80 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+   xmlns:jaxws="http://cxf.apache.org/jaxws";
+   xmlns:cxf="http://cxf.apache.org/core";
+   xmlns:http="http://cxf.apache.org/transports/http/configuration";
+   xmlns:sec="http://cxf.apache.org/configuration/security";
+   xsi:schemaLocation="
+http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.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
+http://cxf.apache.org/transports/http/configuration 
http://cxf.apache.org/schemas/configuration/http-conf.xsd
+http://cxf.apache.org/configuration/security 
http://cxf.apache.org/schemas/configuration/security.xsd";>
+
+    <bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+    
+    <cxf:bus>
+        <cxf:features>
+            <cxf:logging/>
+        </cxf:features>
+    </cxf:bus>
+   
+   <jaxws:client 
name="{http://www.example.org/contract/DoubleIt}DoubleItTransportSaml1Port"; 
createdFromAPI="true">
+       <jaxws:properties>
+           <entry key="ws-security.username" value="alice"/>
+           <entry key="ws-security.callback-handler" 
+                  
value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
+           <entry key="ws-security.sts.client">
+               <bean class="org.apache.cxf.ws.security.trust.STSClient">
+                   <constructor-arg ref="cxf"/>
+                   <property name="wsdlLocation" 
+                             
value="https://localhost:${testutil.ports.STSServer}/SecurityTokenService/Transport?wsdl"/>
+                   <property name="serviceName" 
+                             
value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService"/>
+                   <property name="endpointName" 
+                             
value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_Port"/>
+                   <property name="ttl" value="8"/>
+                   <property name="enableLifetime" value="true"/>
+                   <property name="properties">
+                       <map>
+                           <entry key="ws-security.sts.token.username" 
value="myclientkey"/>
+                           <entry key="ws-security.sts.token.properties" 
value="clientKeystore.properties"/> 
+                           <entry key="ws-security.sts.token.usecert" 
value="true"/> 
+                       </map>
+                   </property>
+               </bean>            
+           </entry> 
+       </jaxws:properties>
+   </jaxws:client>
+   
+   <http:conduit name="https://localhost:.*";>
+      <http:tlsClientParameters disableCNCheck="true">
+        <sec:trustManagers>
+          <sec:keyStore type="jks" password="cspass" 
resource="clientstore.jks"/>
+        </sec:trustManagers>
+        <sec:keyManagers keyPassword="ckpass">
+           <sec:keyStore type="jks" password="cspass" 
resource="clientstore.jks"/>
+        </sec:keyManagers>
+      </http:tlsClientParameters>
+   </http:conduit>
+   
+</beans>
+

Added: 
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/cxf-service.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/cxf-service.xml?rev=1324797&view=auto
==============================================================================
--- 
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/cxf-service.xml
 (added)
+++ 
cxf/trunk/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/renew/cxf-service.xml
 Wed Apr 11 14:52:25 2012
@@ -0,0 +1,84 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+  xmlns:cxf="http://cxf.apache.org/core";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xmlns:sec="http://cxf.apache.org/configuration/security";
+  xmlns:http="http://cxf.apache.org/transports/http/configuration";
+  xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration";
+  xmlns:jaxws="http://cxf.apache.org/jaxws";
+  xsi:schemaLocation="
+            http://cxf.apache.org/core
+            http://cxf.apache.org/schemas/core.xsd
+            http://cxf.apache.org/configuration/security
+            http://cxf.apache.org/schemas/configuration/security.xsd
+            http://cxf.apache.org/jaxws
+            http://cxf.apache.org/schemas/jaxws.xsd
+            http://cxf.apache.org/transports/http/configuration
+            http://cxf.apache.org/schemas/configuration/http-conf.xsd
+            http://cxf.apache.org/transports/http-jetty/configuration
+            http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+            http://www.springframework.org/schema/beans
+            http://www.springframework.org/schema/beans/spring-beans.xsd";>
+    
+    <bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+           
+    <cxf:bus>
+        <cxf:features>
+            <cxf:logging/>
+        </cxf:features>
+    </cxf:bus>
+   
+   <jaxws:endpoint id="doubleittransportsaml1"
+      implementor="org.apache.cxf.systest.sts.common.DoubleItPortTypeImpl"
+      endpointName="s:DoubleItTransportSaml1Port"
+      serviceName="s:DoubleItService"
+      depends-on="ClientAuthHttpsSettings"
+      
address="https://localhost:${testutil.ports.Server}/doubleit/services/doubleittransportsaml1";
+      wsdlLocation="org/apache/cxf/systest/sts/renew/DoubleIt.wsdl"
+      xmlns:s="http://www.example.org/contract/DoubleIt";>
+        
+      <jaxws:properties>
+           <entry key="ws-security.callback-handler" 
+                  
value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
+           <entry key="ws-security.signature.properties" 
value="serviceKeystore.properties"/>
+      </jaxws:properties> 
+   </jaxws:endpoint>
+   
+   <httpj:engine-factory id="ClientAuthHttpsSettings" bus="cxf">
+   <httpj:engine port="${testutil.ports.Server}">
+    <httpj:tlsServerParameters>
+      <sec:keyManagers keyPassword="skpass">
+           <sec:keyStore type="jks" password="sspass" 
resource="servicestore.jks"/>
+      </sec:keyManagers>
+      <sec:cipherSuitesFilter>
+        <sec:include>.*_EXPORT_.*</sec:include>
+        <sec:include>.*_EXPORT1024_.*</sec:include>
+        <sec:include>.*_WITH_DES_.*</sec:include>
+        <sec:include>.*_WITH_AES_.*</sec:include>
+        <sec:include>.*_WITH_NULL_.*</sec:include>
+        <sec:exclude>.*_DH_anon_.*</sec:exclude>
+        </sec:cipherSuitesFilter>
+      <sec:clientAuthentication want="false" required="false"/>
+    </httpj:tlsServerParameters>
+   </httpj:engine>
+  </httpj:engine-factory>
+  
+</beans>
+

Modified: 
cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java?rev=1324797&r1=1324796&r2=1324797&view=diff
==============================================================================
--- 
cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
 (original)
+++ 
cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
 Wed Apr 11 14:52:25 2012
@@ -32,6 +32,7 @@ import org.apache.cxf.systest.sts.deploy
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.tokenstore.MemoryTokenStore;
+import org.apache.cxf.ws.security.tokenstore.SecurityToken;
 import org.apache.cxf.ws.security.tokenstore.TokenStore;
 import org.apache.cxf.ws.security.trust.STSClient;
 import org.apache.cxf.ws.security.trust.delegation.WSSUsernameCallbackHandler;
@@ -207,6 +208,7 @@ public class UsernameActAsTest extends A
         
         // Reset the cache - this invocation should fail
         p.getRequestContext().put(TokenStore.class.getName(), new 
MemoryTokenStore());
+        p.getRequestContext().put(SecurityConstants.TOKEN, new 
SecurityToken());
         try {
             doubleIt(bearerPort2, 40);
             fail("Failure expected as the cache is reset");

Modified: 
cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java?rev=1324797&r1=1324796&r2=1324797&view=diff
==============================================================================
--- 
cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
 (original)
+++ 
cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
 Wed Apr 11 14:52:25 2012
@@ -32,6 +32,7 @@ import org.apache.cxf.systest.sts.deploy
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.tokenstore.MemoryTokenStore;
+import org.apache.cxf.ws.security.tokenstore.SecurityToken;
 import org.apache.cxf.ws.security.tokenstore.TokenStore;
 import org.apache.cxf.ws.security.trust.STSClient;
 import org.apache.cxf.ws.security.trust.delegation.WSSUsernameCallbackHandler;
@@ -205,6 +206,7 @@ public class UsernameOnBehalfOfTest exte
         
         // Reset the cache - this invocation should fail
         p.getRequestContext().put(TokenStore.class.getName(), new 
MemoryTokenStore());
+        p.getRequestContext().put(SecurityConstants.TOKEN, new 
SecurityToken());
         try {
             doubleIt(bearerPort2, 40);
             fail("Failure expected as the cache is reset");

Modified: 
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/transport/DoubleIt.wsdl
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/transport/DoubleIt.wsdl?rev=1324797&r1=1324796&r2=1324797&view=diff
==============================================================================
--- 
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/transport/DoubleIt.wsdl
 (original)
+++ 
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/transport/DoubleIt.wsdl
 Wed Apr 11 14:52:25 2012
@@ -129,8 +129,8 @@
                                                                        
</sp:Issuer>
                                                                
</sp:IssuedToken>
                                                                <sp:HttpsToken>
-                                                                    
<wsp:Policy/>
-                                                                
</sp:HttpsToken>
+                                   <wsp:Policy/>
+                                </sp:HttpsToken>
                                                        </wsp:Policy>
                                                </sp:TransportToken>
                                                <sp:AlgorithmSuite>
@@ -199,8 +199,8 @@
                                                                        
</sp:Issuer>
                                                                
</sp:IssuedToken>
                                                                <sp:HttpsToken>
-                                                                    
<wsp:Policy/>
-                                                                
</sp:HttpsToken>
+                                   <wsp:Policy/>
+                                </sp:HttpsToken>
                                                        </wsp:Policy>
                                                </sp:TransportToken>
                                                <sp:AlgorithmSuite>
@@ -245,8 +245,8 @@
                                                <sp:TransportToken>
                                                        <wsp:Policy>
                                                                <sp:HttpsToken>
-                                                                    
<wsp:Policy/>
-                                                                
</sp:HttpsToken>
+                                   <wsp:Policy/>
+                                </sp:HttpsToken>
                                                        </wsp:Policy>
                                                </sp:TransportToken>
                                                <sp:AlgorithmSuite>


Reply via email to