Add some more STS caching tests
Conflicts:
services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/intermediary_transformation/cxf-client.xml
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/14c382b5
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/14c382b5
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/14c382b5
Branch: refs/heads/2.7.x-fixes
Commit: 14c382b58de6de72aa196be55b2753cba0f97125
Parents: dcf628b
Author: Colm O hEigeartaigh <[email protected]>
Authored: Thu May 22 16:04:32 2014 +0100
Committer: Colm O hEigeartaigh <[email protected]>
Committed: Thu May 22 16:08:22 2014 +0100
----------------------------------------------------------------------
.../IntermediaryCachingPortTypeImpl.java | 2 +-
.../IntermediaryTransformationCachingTest.java | 19 ++++++++++-
.../IntermediaryTransformationTest.java | 3 +-
.../intermediary_transformation/cxf-client.xml | 33 ++++++++++++++++++++
4 files changed, 54 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/14c382b5/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java
----------------------------------------------------------------------
diff --git
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java
index d9a2a43..a0e36ef 100644
---
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java
+++
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java
@@ -87,7 +87,7 @@ public class IntermediaryCachingPortTypeImpl extends
AbstractBusClientServerTest
Assert.assertNotNull("Principal must not be null", pr);
Assert.assertNotNull("Principal.getName() must not return null",
pr.getName());
- Assert.assertTrue("Principal must be alice",
pr.getName().contains("alice"));
+ // Assert.assertTrue("Principal must be alice",
pr.getName().contains("alice"));
// Disable the STSClient after the first invocation
if (i > 0) {
http://git-wip-us.apache.org/repos/asf/cxf/blob/14c382b5/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java
----------------------------------------------------------------------
diff --git
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java
index 75cc096..eda44b3 100644
---
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java
+++
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java
@@ -23,6 +23,7 @@ import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPFaultException;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBusFactory;
@@ -30,6 +31,7 @@ import org.apache.cxf.systest.sts.common.SecurityTestUtil;
import org.apache.cxf.systest.sts.common.TokenTestUtils;
import org.apache.cxf.systest.sts.deployment.STSServer;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.ws.security.SecurityConstants;
import org.example.contract.doubleit.DoubleItPortType;
import org.junit.BeforeClass;
@@ -107,13 +109,28 @@ public class IntermediaryTransformationCachingTest
extends AbstractBusClientServ
TokenTestUtils.updateSTSPort((BindingProvider)transportPort,
STSPORT);
}
- // Make initial successful invocation
+
((BindingProvider)transportPort).getRequestContext().put(SecurityConstants.USERNAME,
"alice");
+
+ // Make initial successful invocation (for "alice")
doubleIt(transportPort, 25);
// Make another invocation - this should work as the intermediary
caches the token
// even though its STSClient is disabled after the first invocation
doubleIt(transportPort, 30);
+ transportPort = service.getPort(portQName, DoubleItPortType.class);
+ updateAddressPort(transportPort, PORT);
+ TokenTestUtils.updateSTSPort((BindingProvider)transportPort, STSPORT);
+
+
((BindingProvider)transportPort).getRequestContext().put(SecurityConstants.USERNAME,
"bob");
+
+ // Make invocation for "bob"...this should fail as the intermediary's
STS client is disabled
+ try {
+ doubleIt(transportPort, 35);
+ } catch (SOAPFaultException ex) {
+ // expected
+ }
+
((java.io.Closeable)transportPort).close();
bus.shutdown(true);
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/14c382b5/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationTest.java
----------------------------------------------------------------------
diff --git
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationTest.java
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationTest.java
index 3f0224f..8c0ee52 100644
---
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationTest.java
+++
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationTest.java
@@ -30,7 +30,7 @@ import org.apache.cxf.systest.sts.common.SecurityTestUtil;
import org.apache.cxf.systest.sts.common.TokenTestUtils;
import org.apache.cxf.systest.sts.deployment.STSServer;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-
+import org.apache.cxf.ws.security.SecurityConstants;
import org.example.contract.doubleit.DoubleItPortType;
import org.junit.BeforeClass;
@@ -108,6 +108,7 @@ public class IntermediaryTransformationTest extends
AbstractBusClientServerTestB
TokenTestUtils.updateSTSPort((BindingProvider)transportPort,
STSPORT);
}
+
((BindingProvider)transportPort).getRequestContext().put(SecurityConstants.USERNAME,
"alice");
doubleIt(transportPort, 25);
((java.io.Closeable)transportPort).close();
http://git-wip-us.apache.org/repos/asf/cxf/blob/14c382b5/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/intermediary_transformation/cxf-client.xml
----------------------------------------------------------------------
diff --git
a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/intermediary_transformation/cxf-client.xml
b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/intermediary_transformation/cxf-client.xml
index 5554490..a058c35 100644
---
a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/intermediary_transformation/cxf-client.xml
+++
b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/intermediary_transformation/cxf-client.xml
@@ -34,6 +34,7 @@ http://cxf.apache.org/configuration/security
http://cxf.apache.org/schemas/confi
<cxf:logging/>
</cxf:features>
</cxf:bus>
+<<<<<<< HEAD
<jaxws:client
name="{http://www.example.org/contract/DoubleIt}DoubleItTransportSAML1EndorsingPort"
createdFromAPI="true">
@@ -74,5 +75,37 @@ http://cxf.apache.org/configuration/security
http://cxf.apache.org/schemas/confi
</http:tlsClientParameters>
</http:conduit>
+=======
+ <jaxws:client
name="{http://www.example.org/contract/DoubleIt}DoubleItTransportSAML1EndorsingPort"
createdFromAPI="true">
+ <jaxws:properties>
+ <entry key="ws-security.username" value="myclientkey"/>
+ <entry key="ws-security.signature.properties"
value="clientKeystore.properties"/>
+ <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:8443/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="properties">
+ <map>
+ <entry key="ws-security.callback-handler"
value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
+ <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>
+ </http:tlsClientParameters>
+ </http:conduit>
+>>>>>>> a8e21df... Add some more STS caching tests
</beans>