JAL-3633 Added Proxy Authentication credentials in Preferences and set via java.net...
[jalview.git] / src / jalview / jbgui / GPreferences.java
index 5be5bd4..85e5cfd 100755 (executable)
@@ -921,9 +921,11 @@ public class GPreferences extends JPanel
     systemProxy.setFont(LABEL_FONT);
     systemProxy.setHorizontalAlignment(SwingConstants.LEFT);
     systemProxy.setText(MessageManager.formatMessage("label.system_proxy",
-            displayHostPort(Cache.startupProxyProperties[0],
+            displayUserHostPort(Cache.startupProxyProperties[4],
+                    Cache.startupProxyProperties[0],
                     Cache.startupProxyProperties[1]),
-            displayHostPort(Cache.startupProxyProperties[2],
+            displayUserHostPort(Cache.startupProxyProperties[6],
+                    Cache.startupProxyProperties[2],
                     Cache.startupProxyProperties[3])));
     customProxy.setFont(LABEL_FONT);
     customProxy.setHorizontalAlignment(SwingConstants.LEFT);
@@ -957,7 +959,6 @@ public class GPreferences extends JPanel
     });
 
     setCustomProxyEnabled();
-    setProxyAuthEnabled();
 
     // Make proxy server panel
     JPanel proxyPanel = new JPanel();
@@ -1067,7 +1068,7 @@ public class GPreferences extends JPanel
     return proxyPanel;
   }
 
-  private String displayHostPort(String host, String port)
+  private String displayUserHostPort(String user, String host, String port)
   {
     boolean hostBlank = (host == null || host.isEmpty());
     boolean portBlank = (port == null || port.isEmpty());
@@ -1077,6 +1078,12 @@ public class GPreferences extends JPanel
     }
 
     StringBuilder sb = new StringBuilder();
+    if (user != null)
+    {
+      sb.append(user.isEmpty() || user.indexOf(" ") > -1 ? '"' + user + '"'
+              : user);
+      sb.append("@");
+    }
     sb.append(hostBlank ? "" : host);
     if (!portBlank)
     {