Author: coheigea
Date: Thu Jun 27 14:10:48 2013
New Revision: 1497361
URL: http://svn.apache.org/r1497361
Log:
Fixing some streaming SAML system tests
Modified:
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/StaxSamlTokenTest.java
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenDerivedTest.java
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/server/stax-server.xml
Modified:
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/StaxSamlTokenTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/StaxSamlTokenTest.java?rev=1497361&r1=1497360&r2=1497361&view=diff
==============================================================================
---
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/StaxSamlTokenTest.java
(original)
+++
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/StaxSamlTokenTest.java
Thu Jun 27 14:10:48 2013
@@ -976,9 +976,7 @@ public class StaxSamlTokenTest extends A
// In this test-case, the WSP is configured with a XACML PEP interceptor,
which in this
// case just mocks the call to the PDP + enforces the decision
- // TODO
@org.junit.Test
- @org.junit.Ignore
public void testSaml2PEP() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
@@ -1025,4 +1023,54 @@ public class StaxSamlTokenTest extends A
bus.shutdown(true);
}
+ // In this test-case, the WSP is configured with a XACML PEP interceptor,
which in this
+ // case just mocks the call to the PDP + enforces the decision
+ @org.junit.Test
+ public void testSaml2PEPStreaming() throws Exception {
+
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = StaxSamlTokenTest.class.getResource("client/client.xml");
+
+ Bus bus = bf.createBus(busFile.toString());
+ SpringBusFactory.setDefaultBus(bus);
+ SpringBusFactory.setThreadDefaultBus(bus);
+
+ URL wsdl = StaxSamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+ Service service = Service.create(wsdl, SERVICE_QNAME);
+ QName portQName = new QName(NAMESPACE, "DoubleItSaml2PEPPort");
+ DoubleItPortType saml2Port =
+ service.getPort(portQName, DoubleItPortType.class);
+ updateAddressPort(saml2Port, PORT);
+ SecurityTestUtil.enableStreaming(saml2Port);
+
+ try {
+ saml2Port.doubleIt(25);
+ fail("Failure expected as Assertion doesn't contain Role
information");
+ } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+ // expected
+ }
+
+ SamlRoleCallbackHandler roleCallbackHandler =
+ new SamlRoleCallbackHandler();
+ roleCallbackHandler.setRoleName("manager");
+ ((BindingProvider)saml2Port).getRequestContext().put(
+ "ws-security.saml-callback-handler", roleCallbackHandler
+ );
+
+ int result = saml2Port.doubleIt(25);
+ assertTrue(result == 50);
+
+ // Expected failure on incorrect role
+ roleCallbackHandler.setRoleName("boss");
+ try {
+ saml2Port.doubleIt(25);
+ fail("Failure expected as Assertion doesn't contain correct role");
+ } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+ // expected
+ }
+
+ ((java.io.Closeable)saml2Port).close();
+ bus.shutdown(true);
+ }
+
}
Modified:
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenDerivedTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenDerivedTest.java?rev=1497361&r1=1497360&r2=1497361&view=diff
==============================================================================
---
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenDerivedTest.java
(original)
+++
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenDerivedTest.java
Thu Jun 27 14:10:48 2013
@@ -35,7 +35,8 @@ import org.example.contract.doubleit.Dou
import org.junit.BeforeClass;
/**
- * A set of tests for keys derived from Username Tokens.
+ * A set of tests for keys derived from Username Tokens. Endorsing
UsernameTokens are not
+ * supported in the streaming code, only in the DOM code.
*/
public class UsernameTokenDerivedTest extends AbstractBusClientServerTestBase {
static final String PORT = allocatePort(ServerDerived.class);
Modified:
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/server/stax-server.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/server/stax-server.xml?rev=1497361&r1=1497360&r2=1497361&view=diff
==============================================================================
---
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/server/stax-server.xml
(original)
+++
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/server/stax-server.xml
Thu Jun 27 14:10:48 2013
@@ -467,8 +467,8 @@
value="org.apache.cxf.systest.ws.wssec10.client.KeystorePasswordCallback"/>
<entry key="ws-security.signature.properties"
value="org/apache/cxf/systest/ws/wssec10/client/bob.properties"/>
- <entry key="ws-security.saml2.validator"
-
value="org.apache.cxf.systest.ws.saml.server.CustomSaml2Validator"/>
+ <!--<entry key="ws-security.saml2.validator"
+
value="org.apache.cxf.systest.ws.saml.server.CustomSaml2Validator"/>-->
<entry key="ws-security.enable.streaming" value="true"/>
</jaxws:properties>
<jaxws:inInterceptors>