brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [14/18] incubator-brooklyn git commit: Adds GeoscalingDnsService.SSL_TRUST_ALL
Date Tue, 11 Aug 2015 20:42:52 GMT
Adds GeoscalingDnsService.SSL_TRUST_ALL


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/4549e281
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/4549e281
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/4549e281

Branch: refs/heads/master
Commit: 4549e281e8a00e0bf3da08421c115be77fb6b019
Parents: b9e81ed
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Aug 4 23:23:02 2015 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Tue Aug 11 20:04:31 2015 +0100

----------------------------------------------------------------------
 .../entity/dns/geoscaling/GeoscalingDnsService.java       |  6 ++++++
 .../entity/dns/geoscaling/GeoscalingDnsServiceImpl.java   | 10 +++++++++-
 .../entity/dns/geoscaling/GeoscalingWebClient.java        |  4 ++--
 3 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4549e281/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsService.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsService.java
b/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsService.java
index c07b4cc..896d757 100644
--- a/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsService.java
+++ b/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsService.java
@@ -22,6 +22,7 @@ import java.net.URI;
 
 import brooklyn.config.ConfigKey;
 import brooklyn.entity.basic.Attributes;
+import brooklyn.entity.basic.ConfigKeys;
 import brooklyn.entity.dns.AbstractGeoDnsService;
 import brooklyn.entity.proxying.ImplementedBy;
 import brooklyn.entity.webapp.WebAppServiceConstants;
@@ -33,6 +34,11 @@ import brooklyn.util.flags.SetFromFlag;
 @ImplementedBy(GeoscalingDnsServiceImpl.class)
 public interface GeoscalingDnsService extends AbstractGeoDnsService {
     
+    @SetFromFlag("sslTrustAll")
+    public static final ConfigKey<Boolean> SSL_TRUST_ALL = ConfigKeys.newBooleanConfigKey(
+            "ssl.trustAll",
+            "Whether to trust all certificates, or to fail with 'peer not authenticated'
if untrusted (default false)",
+            false);
     @SetFromFlag("randomizeSubdomainName")
     public static final ConfigKey<Boolean> RANDOMIZE_SUBDOMAIN_NAME = new BasicConfigKey<Boolean>(
             Boolean.class, "randomize.subdomain.name");

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4549e281/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java
b/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java
index 28d41b2..c172680 100644
--- a/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java
@@ -35,6 +35,7 @@ import brooklyn.entity.dns.geoscaling.GeoscalingWebClient.Domain;
 import brooklyn.entity.dns.geoscaling.GeoscalingWebClient.SmartSubdomain;
 import brooklyn.location.geo.HostGeoInfo;
 import brooklyn.util.collections.MutableSet;
+import brooklyn.util.http.HttpTool;
 import brooklyn.util.text.Identifiers;
 import brooklyn.util.text.Strings;
 
@@ -44,7 +45,7 @@ public class GeoscalingDnsServiceImpl extends AbstractGeoDnsServiceImpl
implemen
 
     // Must remember any desired redirection targets if they're specified before configure()
has been called.
     private Set<HostGeoInfo> rememberedTargetHosts;
-    private final GeoscalingWebClient webClient = new GeoscalingWebClient();
+    private GeoscalingWebClient webClient;
     
     // These are available only after the configure() method has been invoked.
     private boolean randomizeSmartSubdomainName;
@@ -62,6 +63,13 @@ public class GeoscalingDnsServiceImpl extends AbstractGeoDnsServiceImpl
implemen
         
         // defaulting to randomized subdomains makes deploying multiple applications easier
         if (getConfig(RANDOMIZE_SUBDOMAIN_NAME)==null) setConfig(RANDOMIZE_SUBDOMAIN_NAME,
true); 
+        
+        Boolean trustAll = getConfig(SSL_TRUST_ALL);
+        if (Boolean.TRUE.equals(trustAll)) {
+            webClient = new GeoscalingWebClient(HttpTool.httpClientBuilder().trustAll().build());
+        } else {
+            webClient = new GeoscalingWebClient();
+        }
     }
     
     // Ensure our configure() method gets called; may be able to remove this if/when the
framework detects this

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4549e281/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingWebClient.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingWebClient.java
b/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingWebClient.java
index 7ce10cc..c712b6a 100644
--- a/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingWebClient.java
+++ b/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingWebClient.java
@@ -38,7 +38,6 @@ import org.apache.http.client.entity.UrlEncodedFormEntity;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.util.EntityUtils;
 import org.slf4j.Logger;
@@ -49,6 +48,7 @@ import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.w3c.tidy.Tidy;
 
+import brooklyn.util.http.HttpTool;
 import brooklyn.util.text.Strings;
 
 /**
@@ -176,7 +176,7 @@ public class GeoscalingWebClient {
     
     
     public GeoscalingWebClient() {
-        this(new DefaultHttpClient());
+        this(HttpTool.httpClientBuilder().build());
     }
 
     public GeoscalingWebClient(HttpClient httpClient) {


Mime
View raw message