From 607be80b152c96736a39ee0a91be61d8ab303eda Mon Sep 17 00:00:00 2001 From: Iordan Iordanov Date: Sun, 5 Jul 2015 17:09:29 -0400 Subject: [PATCH] Added parameters requested by movirt team. --- .../com/iiordanov/bVNC/ConnectionBean.java | 21 +++++++++++++++++++ .../src/com/iiordanov/bVNC/Constants.java | 3 +++ 2 files changed, 24 insertions(+) diff --git a/eclipse_projects/bVNC/src/com/iiordanov/bVNC/ConnectionBean.java b/eclipse_projects/bVNC/src/com/iiordanov/bVNC/ConnectionBean.java index 12ac00760..b4d62cad0 100644 --- a/eclipse_projects/bVNC/src/com/iiordanov/bVNC/ConnectionBean.java +++ b/eclipse_projects/bVNC/src/com/iiordanov/bVNC/ConnectionBean.java @@ -453,6 +453,27 @@ void parseFromUri(Uri dataUri) { saveConnection = Boolean.parseBoolean(saveConnectionParam); // throw if invalid } + // Parse a passed-in TLS port number. + String tlsPortParam = dataUri.getQueryParameter(Constants.PARAM_TLS_PORT); + if (tlsPortParam != null) { + int tlsPort = Integer.parseInt(tlsPortParam); + if (!isValidPort(tlsPort)) + throw new IllegalArgumentException("The specified TLS port is not valid."); + setTlsPort(tlsPort); + } + + // Parse a CA Cert path parameter + String caCertPath = dataUri.getQueryParameter(Constants.PARAM_CACERT_PATH); + if (caCertPath != null) { + setCaCertPath(caCertPath); + } + + // Parse a Cert subject + String certSubject = dataUri.getQueryParameter(Constants.PARAM_CERT_SUBJECT); + if (certSubject != null) { + setCertSubject(certSubject); + } + // if we are going to save the connection, we will do so here // it may make sense to confirm overwriting data but is probably unnecessary if (saveConnection) { diff --git a/eclipse_projects/bVNC/src/com/iiordanov/bVNC/Constants.java b/eclipse_projects/bVNC/src/com/iiordanov/bVNC/Constants.java index 808b1f219..ebd35ef84 100644 --- a/eclipse_projects/bVNC/src/com/iiordanov/bVNC/Constants.java +++ b/eclipse_projects/bVNC/src/com/iiordanov/bVNC/Constants.java @@ -56,6 +56,9 @@ public class Constants { public static final String PARAM_COLORMODEL = "ColorModel"; public static final String PARAM_SAVE_CONN = "SaveConnection"; public static final String PARAM_APIKEY = "ApiKey"; + public static final String PARAM_TLS_PORT = "TlsPort"; + public static final String PARAM_CACERT_PATH = "CaCertPath"; + public static final String PARAM_CERT_SUBJECT = "CertSubject"; public static final int SECTYPE_NONE = 1; public static final int SECTYPE_VNC = 2;