You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/10/02 00:18:34 UTC
[1/2] jclouds-labs git commit: [JCLOUDS-1006] Fix
DockerUntrustedSSLContextSupplier to allow tests runs against endpoints
without TLS configured
Repository: jclouds-labs
Updated Branches:
refs/heads/master 3440a0b5e -> 8c340d1af
[JCLOUDS-1006] Fix DockerUntrustedSSLContextSupplier to allow tests runs against endpoints without TLS configured
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/d8e58a0f
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/d8e58a0f
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/d8e58a0f
Branch: refs/heads/master
Commit: d8e58a0fe2f982508ff113aa408f1049aae18a2c
Parents: 3440a0b
Author: Josef Cacek <jo...@gmail.com>
Authored: Mon Sep 28 11:08:59 2015 +0200
Committer: Josef Cacek <jo...@gmail.com>
Committed: Mon Sep 28 11:19:02 2015 +0200
----------------------------------------------------------------------
.../suppliers/DockerUntrustedSSLContextSupplier.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/d8e58a0f/docker/src/main/java/org/jclouds/docker/suppliers/DockerUntrustedSSLContextSupplier.java
----------------------------------------------------------------------
diff --git a/docker/src/main/java/org/jclouds/docker/suppliers/DockerUntrustedSSLContextSupplier.java b/docker/src/main/java/org/jclouds/docker/suppliers/DockerUntrustedSSLContextSupplier.java
index d0c9077..42efa13 100644
--- a/docker/src/main/java/org/jclouds/docker/suppliers/DockerUntrustedSSLContextSupplier.java
+++ b/docker/src/main/java/org/jclouds/docker/suppliers/DockerUntrustedSSLContextSupplier.java
@@ -24,10 +24,11 @@ import org.jclouds.location.Provider;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.net.ssl.SSLContext;
+
+import java.io.File;
import java.io.IOException;
import java.security.GeneralSecurityException;
-import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
@Singleton
@@ -44,10 +45,13 @@ public class DockerUntrustedSSLContextSupplier implements Supplier<SSLContext> {
@Override
public SSLContext get() {
- Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");
+ Credentials currentCreds = creds.get();
try {
SSLContextBuilder builder = new SSLContextBuilder();
- builder.clientKeyAndCertificate(currentCreds.credential, currentCreds.identity);
+ // check if identity and credential are files, to set up sslContext
+ if (currentCreds!=null && new File(currentCreds.identity).isFile() && new File(currentCreds.credential).isFile()) {
+ builder.clientKeyAndCertificate(currentCreds.credential, currentCreds.identity);
+ }
builder.trustManager(insecureTrustManager);
return builder.build();
} catch (GeneralSecurityException e) {
[2/2] jclouds-labs git commit: Format code of
DockerUntrustedSSLContextSupplier to fit jclouds code conventions and
checkstyle settings
Posted by na...@apache.org.
Format code of DockerUntrustedSSLContextSupplier to fit jclouds code conventions and checkstyle settings
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/8c340d1a
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/8c340d1a
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/8c340d1a
Branch: refs/heads/master
Commit: 8c340d1afac33882b04c9af9ee975a5c7bc713d7
Parents: d8e58a0
Author: Josef Cacek <jo...@gmail.com>
Authored: Mon Sep 28 11:20:30 2015 +0200
Committer: Josef Cacek <jo...@gmail.com>
Committed: Mon Sep 28 11:20:30 2015 +0200
----------------------------------------------------------------------
.../DockerUntrustedSSLContextSupplier.java | 51 ++++++++++----------
1 file changed, 26 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/8c340d1a/docker/src/main/java/org/jclouds/docker/suppliers/DockerUntrustedSSLContextSupplier.java
----------------------------------------------------------------------
diff --git a/docker/src/main/java/org/jclouds/docker/suppliers/DockerUntrustedSSLContextSupplier.java b/docker/src/main/java/org/jclouds/docker/suppliers/DockerUntrustedSSLContextSupplier.java
index 42efa13..880a48a 100644
--- a/docker/src/main/java/org/jclouds/docker/suppliers/DockerUntrustedSSLContextSupplier.java
+++ b/docker/src/main/java/org/jclouds/docker/suppliers/DockerUntrustedSSLContextSupplier.java
@@ -33,32 +33,33 @@ import static com.google.common.base.Throwables.propagate;
@Singleton
public class DockerUntrustedSSLContextSupplier implements Supplier<SSLContext> {
- private final Supplier<Credentials> creds;
- private final SSLModule.TrustAllCerts insecureTrustManager;
+ private final Supplier<Credentials> creds;
+ private final SSLModule.TrustAllCerts insecureTrustManager;
+ @Inject
+ DockerUntrustedSSLContextSupplier(@Provider Supplier<Credentials> creds,
+ SSLModule.TrustAllCerts insecureTrustManager) {
+ this.creds = creds;
+ this.insecureTrustManager = insecureTrustManager;
+ }
- @Inject
- DockerUntrustedSSLContextSupplier(@Provider Supplier<Credentials> creds, SSLModule.TrustAllCerts insecureTrustManager) {
- this.creds = creds;
- this.insecureTrustManager = insecureTrustManager;
- }
-
- @Override
- public SSLContext get() {
- Credentials currentCreds = creds.get();
- try {
- SSLContextBuilder builder = new SSLContextBuilder();
- // check if identity and credential are files, to set up sslContext
- if (currentCreds!=null && new File(currentCreds.identity).isFile() && new File(currentCreds.credential).isFile()) {
- builder.clientKeyAndCertificate(currentCreds.credential, currentCreds.identity);
- }
- builder.trustManager(insecureTrustManager);
- return builder.build();
- } catch (GeneralSecurityException e) {
- throw propagate(e);
- } catch (IOException e) {
- throw propagate(e);
- }
- }
+ @Override
+ public SSLContext get() {
+ Credentials currentCreds = creds.get();
+ try {
+ SSLContextBuilder builder = new SSLContextBuilder();
+ // check if identity and credential are files, to set up sslContext
+ if (currentCreds != null && new File(currentCreds.identity).isFile()
+ && new File(currentCreds.credential).isFile()) {
+ builder.clientKeyAndCertificate(currentCreds.credential, currentCreds.identity);
+ }
+ builder.trustManager(insecureTrustManager);
+ return builder.build();
+ } catch (GeneralSecurityException e) {
+ throw propagate(e);
+ } catch (IOException e) {
+ throw propagate(e);
+ }
+ }
}