You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2013/06/14 16:15:26 UTC
svn commit: r1493081 -
/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
Author: coheigea
Date: Fri Jun 14 14:15:26 2013
New Revision: 1493081
URL: http://svn.apache.org/r1493081
Log:
Enabled SAML Symmetric streaming outbound test
Modified:
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java?rev=1493081&r1=1493080&r2=1493081&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java Fri Jun 14 14:15:26 2013
@@ -315,6 +315,64 @@ public class SamlTokenTest extends Abstr
bus.shutdown(true);
}
+ @org.junit.Test
+ public void testSaml2OverSymmetricStreaming() throws Exception {
+
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = SamlTokenTest.class.getResource("client/client.xml");
+
+ Bus bus = bf.createBus(busFile.toString());
+ SpringBusFactory.setDefaultBus(bus);
+ SpringBusFactory.setThreadDefaultBus(bus);
+
+ URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+ Service service = Service.create(wsdl, SERVICE_QNAME);
+ QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricPort");
+ DoubleItPortType saml2Port =
+ service.getPort(portQName, DoubleItPortType.class);
+ updateAddressPort(saml2Port, PORT);
+ SecurityTestUtil.enableStreaming(saml2Port);
+
+ try {
+ saml2Port.doubleIt(25);
+ fail("Expected failure on an invocation with no SAML Assertion");
+ } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+ // assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
+ }
+
+ ((BindingProvider)saml2Port).getRequestContext().put(
+ "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
+ );
+ try {
+ saml2Port.doubleIt(25);
+ fail("Expected failure on an invocation with a SAML1 Assertion");
+ } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+ // assertTrue(ex.getMessage().contains("Wrong SAML Version"));
+ }
+
+ ((BindingProvider)saml2Port).getRequestContext().put(
+ "ws-security.saml-callback-handler", new SamlCallbackHandler()
+ );
+ int result = saml2Port.doubleIt(25);
+ assertTrue(result == 50);
+
+ try {
+ SamlCallbackHandler callbackHandler =
+ new SamlCallbackHandler();
+ callbackHandler.setConfirmationMethod(SAML2Constants.CONF_BEARER);
+ ((BindingProvider)saml2Port).getRequestContext().put(
+ "ws-security.saml-callback-handler", callbackHandler
+ );
+ saml2Port.doubleIt(25);
+ fail("Expected failure on an invocation with a invalid SAML2 Assertion");
+ } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+ // expected
+ }
+
+ ((java.io.Closeable)saml2Port).close();
+ bus.shutdown(true);
+ }
+
// Some negative tests. Send a sender-vouches assertion as a SupportingToken...this will
// fail as the provider will demand that there is a signature covering both the assertion
// and the message body.