use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class TemplateTest method testSAML1PublicKey.
@org.junit.Test
public void testSAML1PublicKey() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = TemplateTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = TemplateTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1PublicKeyPort");
DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(port, test.getPort());
// Setup STSClient
STSClient stsClient = createSTSClient(bus);
String wsdlLocation = "https://localhost:" + test.getStsPort() + "/SecurityTokenService/Transport?wsdl";
stsClient.setWsdlLocation(wsdlLocation);
((BindingProvider) port).getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(port);
}
doubleIt(port, 25);
((java.io.Closeable) port).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class TemplateTest method testSendBearerToSAML1PublicKey.
@org.junit.Test
public void testSendBearerToSAML1PublicKey() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = TemplateTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = TemplateTest.class.getResource("DoubleItNoTemplate2.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1PublicKeyPort");
DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(port, test.getPort());
// Setup STSClient
STSClient stsClient = createSTSClient(bus);
stsClient.setKeyType("http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer");
stsClient.setTokenType("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1");
String wsdlLocation = "https://localhost:" + test.getStsPort() + "/SecurityTokenService/Transport?wsdl";
stsClient.setWsdlLocation(wsdlLocation);
((BindingProvider) port).getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
((BindingProvider) port).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "myclientkey");
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(port);
}
try {
doubleIt(port, 25);
fail("Failure expected on sending a SAML 1.1 Bearer token");
} catch (Exception ex) {
// expected
}
((java.io.Closeable) port).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class TemplateTest method testSendSAML1ToSAML2PublicKey.
@org.junit.Test
public void testSendSAML1ToSAML2PublicKey() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = TemplateTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = TemplateTest.class.getResource("DoubleItNoTemplate.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2PublicKeyPort");
DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(port, test.getPort());
// Setup STSClient
STSClient stsClient = createSTSClient(bus);
stsClient.setKeyType("http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey");
stsClient.setTokenType("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1");
String wsdlLocation = "https://localhost:" + test.getStsPort() + "/SecurityTokenService/Transport?wsdl";
stsClient.setWsdlLocation(wsdlLocation);
((BindingProvider) port).getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(port);
}
try {
doubleIt(port, 25);
fail("Failure expected on sending a SAML 1.1 token");
} catch (Exception ex) {
// expected
}
((java.io.Closeable) port).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class TransportBindingTest method testSAML1.
@org.junit.Test
public void testSAML1() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = TransportBindingTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = TransportBindingTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1Port");
DoubleItPortType transportSaml1Port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportSaml1Port, test.getPort());
TokenTestUtils.updateSTSPort((BindingProvider) transportSaml1Port, test.getStsPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(transportSaml1Port);
}
doubleIt(transportSaml1Port, 25);
((java.io.Closeable) transportSaml1Port).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class TransportBindingTest method testSAML2X509Endorsing.
@org.junit.Test
public void testSAML2X509Endorsing() throws Exception {
// Only works for DOM (clients)
if (test.isStreaming()) {
return;
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = TransportBindingTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = TransportBindingTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2X509EndorsingPort");
DoubleItPortType transportSaml1Port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportSaml1Port, test.getPort());
TokenTestUtils.updateSTSPort((BindingProvider) transportSaml1Port, test.getStsPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(transportSaml1Port);
}
doubleIt(transportSaml1Port, 25);
((java.io.Closeable) transportSaml1Port).close();
bus.shutdown(true);
}
Aggregations