Examples of TrustSelfSignedStrategy


Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

            instream.close();
        }

        // Trust own CA and all self-signed certs
        SSLContext sslcontext = SSLContexts.custom()
                .loadTrustMaterial(trustStore, new TrustSelfSignedStrategy())
                .build();
        // Allow TLSv1 protocol only
        SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
                sslcontext,
                new String[] { "TLSv1" },
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

                final KeyStore keyStore = sslReq.getKeyStore() == null?
                        null:
                        sslReq.getKeyStore().getKeyStore();

                final TrustStrategy trustStrategy = sslReq.isTrustSelfSignedCert()
                        ? new TrustSelfSignedStrategy(): null;
               
                SSLContext ctx = new SSLContextBuilder()
                        .loadKeyMaterial(keyStore, sslReq.getKeyStore()!=null? sslReq.getKeyStore().getPassword(): null)
                        .loadTrustMaterial(trustStore, trustStrategy)
                        .setSecureRandom(null)
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

        final HttpHost proxy = new HttpHost("127.0.0.1", port, "http");
        httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
                proxy);
        if (supportSSL) {
            SSLSocketFactory sf = new SSLSocketFactory(
                    new TrustSelfSignedStrategy(),
                    new X509HostnameVerifier() {
                public boolean verify(String arg0, SSLSession arg1) {
                    return true;
                }
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    }

    private DefaultHttpClient buildHttpClient() throws Exception {
        DefaultHttpClient httpClient = new DefaultHttpClient();
        SSLSocketFactory sf = new SSLSocketFactory(
                new TrustSelfSignedStrategy(), new X509HostnameVerifier() {
                    public boolean verify(String arg0, SSLSession arg1) {
                        return true;
                    }

                    public void verify(String host, String[] cns,
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

        return builder.build();
  }

    private static SSLContext buildAllowAnythingSSLContext() {
        try {
            return new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();
        } catch (Exception e) {
            return throwUnchecked(e, SSLContext.class);
        }
    }
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

  @Before
  public void setUpRestTemplate() throws Exception {
    SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
        new SSLContextBuilder().loadTrustMaterial(null,
            new TrustSelfSignedStrategy()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();

    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    HttpComponentsClientHttpRequestFactory requestFactory =
        new HttpComponentsClientHttpRequestFactory(HttpClientBuilder.create()
            .setDefaultCredentialsProvider(credentialsProvider)
            .setSSLSocketFactory(new SSLConnectionSocketFactory(
                new SSLContextBuilder().loadTrustMaterial(null,
                    new TrustSelfSignedStrategy())
                    .build()))
            .build());
    SpringXDTemplate template = new SpringXDTemplate(requestFactory, new URI("https://localhost:" + adminPort));
    PagedResources<ModuleDefinitionResource> moduleDefinitions = template.moduleOperations().list(RESTModuleType.sink);
    assertThat(moduleDefinitions.getLinks().size(), greaterThan(0));
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

  @Test
  public void testHome() throws Exception {
    SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
        new SSLContextBuilder().loadTrustMaterial(null,
            new TrustSelfSignedStrategy()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();

    TestRestTemplate testRestTemplate = new TestRestTemplate();
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    this.container = factory.getEmbeddedServletContainer();
    this.container.start();

    SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
        new SSLContextBuilder().loadTrustMaterial(null,
            new TrustSelfSignedStrategy()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();

    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    keyStore.load(new FileInputStream(new File("src/test/resources/test.p12")),
        "secret".toCharArray());

    SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
        new SSLContextBuilder()
            .loadTrustMaterial(null, new TrustSelfSignedStrategy())
            .loadKeyMaterial(keyStore, "secret".toCharArray()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.