use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class BinarySecurityTokenTest method testBadBinarySecurityToken.
@org.junit.Test
public void testBadBinarySecurityToken() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = BinarySecurityTokenTest.class.getResource("cxf-bad-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = BinarySecurityTokenTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricBSTPort");
DoubleItPortType asymmetricBSTPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(asymmetricBSTPort, test.getPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(asymmetricBSTPort);
}
try {
doubleIt(asymmetricBSTPort, 30);
fail("Expected failure on a bad cert");
} catch (javax.xml.ws.soap.SOAPFaultException fault) {
// expected
}
((java.io.Closeable) asymmetricBSTPort).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class BinarySecurityTokenTest method testBinarySecurityToken.
@org.junit.Test
public void testBinarySecurityToken() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = BinarySecurityTokenTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = BinarySecurityTokenTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricBSTPort");
DoubleItPortType asymmetricBSTPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(asymmetricBSTPort, test.getPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(asymmetricBSTPort);
}
doubleIt(asymmetricBSTPort, 25);
((java.io.Closeable) asymmetricBSTPort).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class CachingTest method testImminentExpiry.
@org.junit.Test
public void testImminentExpiry() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = CachingTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = CachingTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1Port");
DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
((BindingProvider) port).getRequestContext().put("thread.local.request.context", "true");
updateAddressPort(port, PORT);
// Make a successful invocation
doubleIt(port, 25);
Client client = ClientProxy.getClient(port);
Endpoint ep = client.getEndpoint();
String id = (String) ep.get(SecurityConstants.TOKEN_ID);
TokenStore store = (TokenStore) ep.getEndpointInfo().getProperty(TokenStore.class.getName());
SecurityToken tok = store.getToken(id);
assertNotNull(tok);
// Make the token "about to expire"
tok.setExpires(Instant.now().plusSeconds(5L));
assertTrue(tok.isAboutToExpire(10L));
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 ClaimsTest method testSaml2Claims.
@org.junit.Test
public void testSaml2Claims() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = ClaimsTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = ClaimsTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2ClaimsPort");
DoubleItPortType transportClaimsPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportClaimsPort, test.getPort());
TokenTestUtils.updateSTSPort((BindingProvider) transportClaimsPort, test.getStsPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(transportClaimsPort);
}
doubleIt(transportClaimsPort, 25);
((java.io.Closeable) transportClaimsPort).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class ClaimsTest method testSaml2ClaimsCallbackHandler.
// In this test, the WSDL the client is using has no Claims Element (however the service
// is using a WSDL that requires Claims). A CallbackHandler is used to send the Claims
// Element to the STS.
@org.junit.Test
public void testSaml2ClaimsCallbackHandler() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = ClaimsTest.class.getResource("cxf-client-cbhandler.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = ClaimsTest.class.getResource("DoubleItNoClaims.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2ClaimsPort");
DoubleItPortType transportClaimsPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportClaimsPort, test.getPort());
TokenTestUtils.updateSTSPort((BindingProvider) transportClaimsPort, test.getStsPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(transportClaimsPort);
}
doubleIt(transportClaimsPort, 25);
((java.io.Closeable) transportClaimsPort).close();
bus.shutdown(true);
}
Aggregations