Search in sources :

Example 1 with URLConnectionHTTPConduit

use of org.apache.cxf.transport.http.URLConnectionHTTPConduit in project cxf by apache.

the class HttpConduitConfigApplierTest method testTrustVerificationEnabled.

@Test
public void testTrustVerificationEnabled() throws IOException {
    HttpConduitConfigApplier configApplier = new HttpConduitConfigApplier();
    Dictionary<String, String> configValues = new Hashtable<>();
    configValues.put("tlsClientParameters.disableCNCheck", "true");
    configValues.put("tlsClientParameters.trustManagers.disableTrustVerification", "false");
    String address = "https://localhost:12345";
    Bus bus = new ExtensionManagerBus();
    EndpointInfo ei = new EndpointInfo();
    ei.setAddress(address);
    HTTPConduit conduit = new URLConnectionHTTPConduit(bus, ei, null);
    configApplier.apply(configValues, conduit, address);
    assertNotNull(conduit.getTlsClientParameters().getTrustManagers());
    assertEquals(conduit.getTlsClientParameters().getTrustManagers().length, 1);
    assertFalse(conduit.getTlsClientParameters().getTrustManagers()[0].getClass().getName().startsWith(InsecureTrustManager.class.getName()));
    assertTrue(conduit.getTlsClientParameters().isDisableCNCheck());
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) URLConnectionHTTPConduit(org.apache.cxf.transport.http.URLConnectionHTTPConduit) Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Hashtable(java.util.Hashtable) URLConnectionHTTPConduit(org.apache.cxf.transport.http.URLConnectionHTTPConduit) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Example 2 with URLConnectionHTTPConduit

use of org.apache.cxf.transport.http.URLConnectionHTTPConduit in project cxf by apache.

the class HttpConduitConfigApplierTest method testNormalTrustLoading.

@Test
public void testNormalTrustLoading() throws IOException {
    HttpConduitConfigApplier configApplier = new HttpConduitConfigApplier();
    Dictionary<String, String> configValues = new Hashtable<>();
    configValues.put("tlsClientParameters.disableCNCheck", "false");
    String address = "https://localhost:12345";
    Bus bus = new ExtensionManagerBus();
    EndpointInfo ei = new EndpointInfo();
    ei.setAddress(address);
    HTTPConduit conduit = new URLConnectionHTTPConduit(bus, ei, null);
    configApplier.apply(configValues, conduit, address);
    assertNull(conduit.getTlsClientParameters().getTrustManagers());
    assertFalse(conduit.getTlsClientParameters().isDisableCNCheck());
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) URLConnectionHTTPConduit(org.apache.cxf.transport.http.URLConnectionHTTPConduit) Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Hashtable(java.util.Hashtable) URLConnectionHTTPConduit(org.apache.cxf.transport.http.URLConnectionHTTPConduit) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Example 3 with URLConnectionHTTPConduit

use of org.apache.cxf.transport.http.URLConnectionHTTPConduit in project cxf by apache.

the class HttpConduitConfigApplierTest method testDisableTrustVerification.

@Test
public void testDisableTrustVerification() throws IOException {
    HttpConduitConfigApplier configApplier = new HttpConduitConfigApplier();
    Dictionary<String, String> configValues = new Hashtable<>();
    configValues.put("tlsClientParameters.disableCNCheck", "true");
    configValues.put("tlsClientParameters.trustManagers.disableTrustVerification", "true");
    String address = "https://localhost:12345";
    Bus bus = new ExtensionManagerBus();
    EndpointInfo ei = new EndpointInfo();
    ei.setAddress(address);
    HTTPConduit conduit = new URLConnectionHTTPConduit(bus, ei, null);
    configApplier.apply(configValues, conduit, address);
    assertNotNull(conduit.getTlsClientParameters().getTrustManagers());
    assertEquals(conduit.getTlsClientParameters().getTrustManagers().length, 1);
    assertTrue(conduit.getTlsClientParameters().getTrustManagers()[0].getClass().getName().startsWith(InsecureTrustManager.class.getName()));
    assertTrue(conduit.getTlsClientParameters().isDisableCNCheck());
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) URLConnectionHTTPConduit(org.apache.cxf.transport.http.URLConnectionHTTPConduit) Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Hashtable(java.util.Hashtable) URLConnectionHTTPConduit(org.apache.cxf.transport.http.URLConnectionHTTPConduit) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Aggregations

Hashtable (java.util.Hashtable)3 Bus (org.apache.cxf.Bus)3 ExtensionManagerBus (org.apache.cxf.bus.extension.ExtensionManagerBus)3 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)3 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)3 URLConnectionHTTPConduit (org.apache.cxf.transport.http.URLConnectionHTTPConduit)3 Test (org.junit.Test)3