Hi!
Andrew's link will provide you the context you need.
I don't know if there is a proper way of configuring this using the
default HTTP driver, but here is a specific example using the OkHttp
one:
First you will need to create an OkHttpClientSupplier that creates the
http client with the desired connection configuration:
public class TLSOkHttpClientSupplier implements OkHttpClientSupplier {
@Override public OkHttpClient get() {
OkHttpClient client = new OkHttpClient();
ConnectionSpec tlsSpec =
new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
.tlsVersions(TlsVersion.TLS_1_1, TlsVersion.TLS_1_2)
.build();
ConnectionSpec cleartextSpec =
new ConnectionSpec.Builder(ConnectionSpec.CLEARTEXT).build();
client.setConnectionSpecs(ImmutableList.of(tlsSpec, cleartextSpec));
return client;
}
}
Once you have the class that will create the OkHttpClient you just
have to inject it in the Guice context and configure the OkHttp driver
to be used to manage the HTTP connections. Both things are achieved by
providing additional modules when creating the context:
// Create a Guice module that will bind your supplier implementation
// to the injection context
Module tlsModule = new AbstractModule() {
@Override protected void configure() {
bind(OkHttpClientSupplier.class).to(TLSOkHttpClientSupplier.class);
}
};
// Create the context loading the OkHttpDriver and your custom module
ContextBuilder.newBuilder("provider")
.modules(ImmutableSet.of(tlsModule,
new OkHttpCommandExecutorServiceModule()))
.build()
Note than in order to use the OkHttp driver you'll have to add the
"org.apache.jclouds.driver/jclouds-okhttp" dependency to your pom.xml.
HTH!
I.
On 4 March 2016 at 22:23, Andrew Phillips wrote:
> Hi Stéphane
>
>> Any idea of code to configure my http client with TLSv1.1 or TLSv1.2
>> instead of TLSv1.0, please ?
>
>
> The following blog post doesn't provide a step-by-step solution, but should
> hopefully help:
>
> https://jclouds.apache.org/blog/2014/10/25/poodle-and-jclouds/
>
> Regards
>
> ap