Search in sources :

Example 6 with IPingService

use of wssec.wssec10.IPingService in project cxf by apache.

the class WSSecurity10UsernameAuthorizationLegacyTest method testClientServerComplexPolicyUnauthorized.

@Test
public void testClientServerComplexPolicyUnauthorized() {
    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());
    }
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) IPingService(wssec.wssec10.IPingService) MalformedURLException(java.net.MalformedURLException) Test(org.junit.Test)

Example 7 with IPingService

use of wssec.wssec10.IPingService in project cxf by apache.

the class WSSecurity10UsernameAuthorizationLegacyTest method getComplexPolicyPort.

private static IPingService getComplexPolicyPort(Bus bus) {
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    PingService svc = new PingService(getWsdlLocation("UserNameOverTransport"));
    return svc.getPort(new QName("http://WSSec/wssec10", "UserNameOverTransport" + "_IPingService"), IPingService.class);
}
Also used : QName(javax.xml.namespace.QName) IPingService(wssec.wssec10.IPingService) PingService(wssec.wssec10.PingService)

Example 8 with IPingService

use of wssec.wssec10.IPingService in project cxf by apache.

the class WSSecurity10UsernameAuthorizationTest method getUTOnlyPort.

private static IPingService getUTOnlyPort(Bus bus, boolean hashed) {
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    PingService svc = new PingService(getWsdlLocation(hashed));
    return svc.getPort(new QName("http://WSSec/wssec10", hashed ? "UserName_IPingService_hashed" : "UserName_IPingService"), IPingService.class);
}
Also used : QName(javax.xml.namespace.QName) IPingService(wssec.wssec10.IPingService) PingService(wssec.wssec10.PingService)

Example 9 with IPingService

use of wssec.wssec10.IPingService in project cxf by apache.

the class WSSecurity10UsernameAuthorizationTest method testClientServerComplexPolicyAuthorized.

@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);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) IPingService(wssec.wssec10.IPingService) Test(org.junit.Test)

Example 10 with IPingService

use of wssec.wssec10.IPingService in project cxf by apache.

the class WSSecurity10UsernameAuthorizationTest method testClientServerComplexPolicyUnauthorized.

@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);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) IPingService(wssec.wssec10.IPingService) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

IPingService (wssec.wssec10.IPingService)10 Bus (org.apache.cxf.Bus)7 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)7 Test (org.junit.Test)7 QName (javax.xml.namespace.QName)5 PingService (wssec.wssec10.PingService)4 MalformedURLException (java.net.MalformedURLException)3 IOException (java.io.IOException)2 URL (java.net.URL)2 Client (org.apache.cxf.endpoint.Client)1 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)1 HTTPClientPolicy (org.apache.cxf.transports.http.configuration.HTTPClientPolicy)1 IPingService (wssec.wssec11.IPingService)1 PingService11 (wssec.wssec11.PingService11)1