use of org.apache.cxf.bus.spring.SpringBusFactory in project cxf by apache.
the class BookServerOIDCFilters method run.
protected void run() {
SpringBusFactory bf = new SpringBusFactory();
Bus springBus = bf.createBus(SERVER_CONFIG_FILE);
BusFactory.setDefaultBus(springBus);
setBus(springBus);
try {
new BookServerOIDCFilters();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project cxf by apache.
the class BookServerOIDCService method run.
protected void run() {
SpringBusFactory bf = new SpringBusFactory();
Bus springBus = bf.createBus(SERVER_CONFIG_FILE);
BusFactory.setDefaultBus(springBus);
setBus(springBus);
try {
new BookServerOIDCService();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project cxf by apache.
the class SSLv3Server method run.
protected void run() {
URL busFile = SSLv3Server.class.getResource("sslv3-server.xml");
Bus busLocal = new SpringBusFactory().createBus(busFile);
BusFactory.setDefaultBus(busLocal);
setBus(busLocal);
try {
new SSLv3Server();
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project cxf by apache.
the class SSLv3Test method testSSLv3ServerNotAllowedByDefault.
@org.junit.Test
public void testSSLv3ServerNotAllowedByDefault() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = SSLv3Test.class.getResource("sslv3-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
System.setProperty("https.protocols", "SSLv3");
URL service = new URL("https://localhost:" + PORT);
HttpsURLConnection connection = (HttpsURLConnection) service.openConnection();
connection.setHostnameVerifier(new DisableCNCheckVerifier());
SSLContext sslContext = SSLContext.getInstance("SSL");
KeyStore trustedCertStore = KeyStore.getInstance("jks");
try (InputStream keystore = ClassLoaderUtils.getResourceAsStream("keys/Truststore.jks", SSLv3Test.class)) {
trustedCertStore.load(keystore, null);
}
TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
tmf.init(trustedCertStore);
TrustManager[] trustManagers = tmf.getTrustManagers();
sslContext.init(null, trustManagers, new java.security.SecureRandom());
connection.setSSLSocketFactory(sslContext.getSocketFactory());
try {
connection.connect();
fail("Failure expected on an SSLv3 connection attempt");
} catch (IOException ex) {
// expected
}
System.clearProperty("https.protocols");
bus.shutdown(true);
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project cxf by apache.
the class SSLv3Test method testTLSClientToEndpointWithSSL3Allowed.
@org.junit.Test
public void testTLSClientToEndpointWithSSL3Allowed() throws Exception {
// Doesn't work with IBM JDK
if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
return;
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = SSLv3Test.class.getResource("sslv3-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL url = SOAPService.WSDL_LOCATION;
SOAPService service = new SOAPService(url, SOAPService.SERVICE);
assertNotNull("Service is null", service);
final Greeter port = service.getHttpsPort();
assertNotNull("Port is null", port);
updateAddressPort(port, PORT4);
port.greetMe("Kitty");
((java.io.Closeable) port).close();
bus.shutdown(true);
}
Aggregations