Search in sources :

Example 96 with DoubleItPortType

use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.

the class SamlTokenTest method testAsymmetricInitiator.

/**
 * 2.3.1.5 (WSS1.0) SAML1.1 Holder of Key, Sign, Optional Encrypt
 */
@org.junit.Test
public void testAsymmetricInitiator() 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, "DoubleItAsymmetricInitiatorPort");
    DoubleItPortType samlPort = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(samlPort, test.getPort());
    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(samlPort);
    }
    samlPort.doubleIt(25);
    ((java.io.Closeable) samlPort).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) URL(java.net.URL)

Example 97 with DoubleItPortType

use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.

the class SamlTokenTest method testBearer.

/**
 * 2.3.1.1 (WSS1.0) SAML1.1 Assertion (Bearer)
 */
@org.junit.Test
public void testBearer() 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, "DoubleItBearerPort");
    DoubleItPortType samlPort = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(samlPort, test.getPort());
    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(samlPort);
    }
    samlPort.doubleIt(25);
    ((java.io.Closeable) samlPort).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) URL(java.net.URL)

Example 98 with DoubleItPortType

use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.

the class SamlTokenTest method testTLSHOKSignedEndorsing.

/**
 * 2.3.1.3 (WSS1.0) SAML1.1 Assertion (HK) over SSL
 */
@org.junit.Test
public void testTLSHOKSignedEndorsing() 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, "DoubleItTLSHOKSignedEndorsingPort");
    DoubleItPortType samlPort = service.getPort(portQName, DoubleItPortType.class);
    String portNumber = PORT2;
    if (STAX_PORT.equals(test.getPort())) {
        portNumber = STAX_PORT2;
    }
    updateAddressPort(samlPort, portNumber);
    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(samlPort);
    }
    samlPort.doubleIt(25);
    ((java.io.Closeable) samlPort).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) URL(java.net.URL)

Example 99 with DoubleItPortType

use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.

the class SamlTokenTest method testAsymmetricSigned.

/**
 * 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);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) URL(java.net.URL)

Example 100 with DoubleItPortType

use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.

the class SamlTokenTest method testTLSSenderVouchesSaml2.

/**
 * 2.3.2.2 (WSS1.1) SAML2.0 Sender Vouches over SSL
 */
@org.junit.Test
public void testTLSSenderVouchesSaml2() 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, "DoubleItTLSSenderVouchesSaml2Port");
    DoubleItPortType samlPort = service.getPort(portQName, DoubleItPortType.class);
    String portNumber = PORT2;
    if (STAX_PORT.equals(test.getPort())) {
        portNumber = STAX_PORT2;
    }
    updateAddressPort(samlPort, portNumber);
    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(samlPort);
    }
    samlPort.doubleIt(25);
    ((java.io.Closeable) samlPort).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) URL(java.net.URL)

Aggregations

URL (java.net.URL)360 QName (javax.xml.namespace.QName)360 Service (javax.xml.ws.Service)360 DoubleItPortType (org.example.contract.doubleit.DoubleItPortType)360 Bus (org.apache.cxf.Bus)354 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)352 SamlCallbackHandler (org.apache.cxf.systest.ws.saml.client.SamlCallbackHandler)31 Client (org.apache.cxf.endpoint.Client)22 STSClient (org.apache.cxf.ws.security.trust.STSClient)21 HashMap (java.util.HashMap)20 BindingProvider (javax.xml.ws.BindingProvider)17 WSS4JOutInterceptor (org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor)15 WSS4JStaxOutInterceptor (org.apache.cxf.ws.security.wss4j.WSS4JStaxOutInterceptor)13 KeystorePasswordCallback (org.apache.cxf.systest.ws.common.KeystorePasswordCallback)9 Test (org.junit.Test)9 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)8 BusException (org.apache.cxf.BusException)8 EndpointException (org.apache.cxf.endpoint.EndpointException)8 TokenStore (org.apache.cxf.ws.security.tokenstore.TokenStore)8 WebService (javax.jws.WebService)5