use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class X509AsymmetricBindingTest method testX509SAML2.
@org.junit.Test
public void testX509SAML2() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = X509AsymmetricBindingTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = X509AsymmetricBindingTest.class.getResource("DoubleItAsymmetric.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2Port");
DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(port, PORT);
TokenTestUtils.updateSTSPort((BindingProvider) port, STSPORT2);
doubleIt(port, 30);
((java.io.Closeable) port).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class X509SymmetricBindingTest method testX509SAML1.
@org.junit.Test
public void testX509SAML1() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = X509SymmetricBindingTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = X509SymmetricBindingTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML1Port");
DoubleItPortType symmetricSaml1Port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(symmetricSaml1Port, test.getPort());
TokenTestUtils.updateSTSPort((BindingProvider) symmetricSaml1Port, test.getStsPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(symmetricSaml1Port);
}
doubleIt(symmetricSaml1Port, 25);
((java.io.Closeable) symmetricSaml1Port).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class X509SymmetricBindingTest method testX509SAML2.
@org.junit.Test
public void testX509SAML2() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = X509SymmetricBindingTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = X509SymmetricBindingTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML2Port");
DoubleItPortType symmetricSaml2Port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(symmetricSaml2Port, test.getPort());
TokenTestUtils.updateSTSPort((BindingProvider) symmetricSaml2Port, test.getStsPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(symmetricSaml2Port);
}
doubleIt(symmetricSaml2Port, 30);
TokenTestUtils.verifyToken(symmetricSaml2Port);
((java.io.Closeable) symmetricSaml2Port).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class X509SymmetricBindingTest method testX509SAML2Endorsing.
@org.junit.Test
public void testX509SAML2Endorsing() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = X509SymmetricBindingTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = X509SymmetricBindingTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML2EndorsingPort");
DoubleItPortType symmetricSaml2Port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(symmetricSaml2Port, test.getPort());
TokenTestUtils.updateSTSPort((BindingProvider) symmetricSaml2Port, test.getStsPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(symmetricSaml2Port);
}
// TODO Streaming client is not including a separate main Signature
if (!test.isStreaming()) {
doubleIt(symmetricSaml2Port, 30);
}
((java.io.Closeable) symmetricSaml2Port).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class DoubleItPortTypeImpl method doubleIt.
public int doubleIt(int numberToDouble) {
// Delegate request to a provider
URL wsdl = DoubleItPortTypeImpl.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2SupportingPort");
DoubleItPortType transportSAML2SupportingPort = service.getPort(portQName, DoubleItPortType.class);
try {
updateAddressPort(transportSAML2SupportingPort, getPort());
} catch (Exception ex) {
ex.printStackTrace();
}
//
// Get the principal from the request context and construct a SAML Assertion
//
Saml2CallbackHandler callbackHandler = new Saml2CallbackHandler(wsc.getUserPrincipal());
((BindingProvider) transportSAML2SupportingPort).getRequestContext().put(SecurityConstants.SAML_CALLBACK_HANDLER, callbackHandler);
return transportSAML2SupportingPort.doubleIt(numberToDouble);
}
Aggregations