Example usage for io.vertx.core.http HttpClientOptions addEnabledCipherSuite

List of usage examples for io.vertx.core.http HttpClientOptions addEnabledCipherSuite

Introduction

In this page you can find the example usage for io.vertx.core.http HttpClientOptions addEnabledCipherSuite.

Prototype

@Override
    public HttpClientOptions addEnabledCipherSuite(String suite) 

Source Link

Usage

From source file:io.apiman.gateway.platforms.vertx3.http.HttpClientOptionsFactory.java

License:Apache License

private static HttpClientOptions doParse(TLSOptions tlsOptions, URI apiEndpoint) {
    HttpClientOptions clientOptions = new HttpClientOptions();

    if (apiEndpoint.getScheme().equals("http")) { //$NON-NLS-1$
        return clientOptions.setSsl(false);
    } else {//  ww w . ja v  a  2 s  . c o m
        clientOptions.setSsl(true);
    }

    clientOptions.setTrustAll(tlsOptions.isTrustSelfSigned() || tlsOptions.isDevMode())
            .setVerifyHost(!tlsOptions.isAllowAnyHost() || tlsOptions.isDevMode());

    if (tlsOptions.getTrustStore() != null) {
        clientOptions.setTrustStoreOptions(new JksOptions().setPath(tlsOptions.getTrustStore())
                .setPassword(tlsOptions.getTrustStorePassword()));
    }

    if (tlsOptions.getKeyStore() != null) {
        clientOptions.setKeyStoreOptions(new JksOptions().setPath(tlsOptions.getKeyStore())
                .setPassword(tlsOptions.getKeyStorePassword()));
    }

    if (tlsOptions.getAllowedCiphers() != null) {
        String[] ciphers = arrayDifference(tlsOptions.getAllowedCiphers(), tlsOptions.getDisallowedCiphers(),
                getDefaultCipherSuites());
        for (String cipher : ciphers) {
            clientOptions.addEnabledCipherSuite(cipher);
        }
    }

    if (tlsOptions.getAllowedProtocols() != null) {
        log.info("Can't set allowed protocols on Vert.x gateway"); //$NON-NLS-1$
    }

    return clientOptions;
}