aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Ruelas2013-12-09 17:17:15 (EST)
committerGerrit Code Review @ Eclipse.org2013-12-12 09:24:11 (EST)
commit8c532bd6305cc2d92a57547d362d2748b00e7e73 (patch)
tree447307d0172a330c9be83a0c3dd3edb27847fe93
parentf1a3c32742c03fb17e466e4ea1789fab562547df (diff)
downloadorg.eclipse.lyo.client-8c532bd6305cc2d92a57547d362d2748b00e7e73.zip
org.eclipse.lyo.client-8c532bd6305cc2d92a57547d362d2748b00e7e73.tar.gz
org.eclipse.lyo.client-8c532bd6305cc2d92a57547d362d2748b00e7e73.tar.bz2
[Bug 422603] Some environment fails to connect using the predefinedrefs/changes/40/19540/2
secure socket protocol Change-Id: I7fe7f64e5c8cf3430fb7c34391e3cb5dd6b87638 Signed-off-by: Gabriel Ruelas <gra@mx1.ibm.com>
-rw-r--r--org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/OslcClient.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/OslcClient.java b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/OslcClient.java
index fb9ecdf..ed0a0de 100644
--- a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/OslcClient.java
+++ b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/OslcClient.java
@@ -75,7 +75,24 @@ public class OslcClient {
protected DefaultHttpClient httpClient;
private HttpClientPool clientPool;
private ClientConfig clientConfig;
+ private String configuredSecureSocketProtocol;
+ /**
+ * Sets the Secure Socket Protocol to be used, valid values "TLS","SSL","SSL_TLS".
+ */
+ public String getConfiguredSecureSocketProtocol() {
+ return configuredSecureSocketProtocol;
+ }
+
+ /**
+ * Returns theSecure Sockect Protocol associated with this OSLC Client
+ * @return the user configured Secure Socket Protocol
+ */
+ public void setConfiguredSecureSocketProtocol(
+ String configuredSecureSocketProtocol) {
+ this.configuredSecureSocketProtocol = configuredSecureSocketProtocol;
+ }
+
private static final String SECURE_SOCKET_PROTOCOL [] = new String[] {"TLS","SSL","SSL_TLS"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
/**
@@ -507,6 +524,19 @@ public class OslcClient {
*/
private SSLContext findInstalledSecurityContext() throws NoSuchAlgorithmException {
+ if ( configuredSecureSocketProtocol != null ) {
+ SSLContext sslContext = null;
+ try {
+ sslContext = SSLContext.getInstance(configuredSecureSocketProtocol);
+ }
+ catch (NoSuchAlgorithmException e) {
+ // Ignore Exception, we will try other default values below
+ }
+ if ( sslContext != null ){
+ return sslContext;
+ }
+ }
+
// walks through list of secure socked protocols and picks the first found
// the list is arranged in level of security order
for (String aSecuredProtocol : SECURE_SOCKET_PROTOCOL) {