@org.junit.Test public void test3DESEncryptionGivenKey() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = ActionTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleIt3DESEncryptionPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@Test public void testClientServerComplexPolicyAuthorized() throws IOException { String configName = "org/apache/cxf/systest/ws/wssec10/client.xml"; Bus bus = new SpringBusFactory().createBus(configName); IPingService port = getComplexPolicyPort(bus); final String output = port.echo(INPUT); assertEquals(INPUT, output); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testSignedSAML() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = ActionTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSignedSAMLPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@Test public void testClientServerUTOnlyAuthorized() throws IOException { String configName = "org/apache/cxf/systest/ws/wssec10/client.xml"; Bus bus = new SpringBusFactory().createBus(configName); IPingService port = getUTOnlyPort(bus, false); final String output = port.echo(INPUT); assertEquals(INPUT, output); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testBasicAuth() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = BasicAuthTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = BasicAuthTest.class.getResource("DoubleItBasicAuth.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItBasicAuthPort"); DoubleItPortType utPort = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(utPort, PORT); assertEquals(50, utPort.doubleIt(25)); ((java.io.Closeable)utPort).close(); bus.shutdown(true); }
@Test public void testClientServerUTOnlyUnauthorized() throws IOException { String configName = "org/apache/cxf/systest/ws/wssec10/client_unauthorized.xml"; Bus bus = new SpringBusFactory().createBus(configName); IPingService port = getUTOnlyPort(bus, true); try { port.echo(INPUT); fail("Frank is unauthorized"); } catch (Exception ex) { assertEquals("Unauthorized", ex.getMessage()); } ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testTransformFeature() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = StaxTransformFeatureTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = StaxTransformFeatureTest.class.getResource("DoubleItTransform.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItPlaintextPort2"); DoubleItPortType2 port = service.getPort(portQName, DoubleItPortType2.class); updateAddressPort(port, PORT); assertEquals(50, port.doubleIt2(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@Test public void testClientServerComplexPolicyUnauthorized() throws IOException { String configName = "org/apache/cxf/systest/ws/wssec10/client_unauthorized.xml"; Bus bus = new SpringBusFactory().createBus(configName); IPingService port = getComplexPolicyPort(bus); try { port.echo(INPUT); fail("Frank is unauthorized"); } catch (Exception ex) { assertEquals("Unauthorized", ex.getMessage()); } ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testAsymmetricEncryptBeforeSigningActionToPolicy() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = ActionTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricEncryptBeforeSigningPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); // Successful call assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testAsymmetricActionToPolicy() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = ActionTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); // Successful call assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testNormalInvocation() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = XSLTFeatureTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = XSLTFeatureTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItPlaintextPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); // The XSLT Feature adds a "1" to the doubled response assertEquals(150, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testKerberosViaCustomTokenAction() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = KerberosTokenTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = KerberosTokenTest.class.getResource("DoubleItKerberos.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItKerberosTransportActionPort"); DoubleItPortType kerberosPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(kerberosPort, PORT2); Assert.assertEquals(50, kerberosPort.doubleIt(25)); ((java.io.Closeable)kerberosPort).close(); bus.shutdown(true); } }
@org.junit.Test public void testSymmetricBytesInAttachment() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = MTOMSecurityTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSymmetricPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); int result = port.doubleIt(25); assertEquals(result, 50); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testEncryption() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = ActionTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItEncryptionPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); // Successful call assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testAsymmetricBytesInAttachment() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = MTOMSecurityTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); int result = port.doubleIt(25); assertEquals(result, 50); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testActionBytesInAttachment() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = MTOMSecurityTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItActionPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); int result = port.doubleIt(25); assertEquals(result, 50); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testNormalSignedSOAPBody() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = SignatureWhitespaceTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = SignatureWhitespaceTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSignaturePort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, test.getPort()); assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@org.junit.Test public void testEncryptedPassword() throws Exception { if (!unrestrictedPoliciesInstalled) { return; } SpringBusFactory bf = new SpringBusFactory(); URL busFile = ActionTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItEncryptedPasswordPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
/** * 2.3.1.4 (WSS1.0) SAML1.1 Sender Vouches with X.509 Certificates, Sign, Optional Encrypt */ @org.junit.Test public void testAsymmetricSigned() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = SamlTokenTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSignedPort"); DoubleItPortType samlPort = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(samlPort, test.getPort()); samlPort.doubleIt(25); ((java.io.Closeable)samlPort).close(); bus.shutdown(true); }
/** * Here the key derived from a UsernameToken is used as a protection token for the * symmetric binding, and used to sign the SOAP Body. */ @org.junit.Test public void testSymmetricProtectionSignatureToken() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = UsernameTokenDerivedTest.class.getResource("client-derived.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = UsernameTokenDerivedTest.class.getResource("DoubleItUtDerived.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSymmetricProtectionSigPort"); DoubleItPortType utPort = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(utPort, PORT); assertEquals(50, utPort.doubleIt(25)); ((java.io.Closeable)utPort).close(); bus.shutdown(true); }