aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/icedteanp/java/sun/applet/PluginMain.java
diff options
context:
space:
mode:
authorOmair Majid <[email protected]>2010-11-23 10:05:06 -0500
committerOmair Majid <[email protected]>2010-11-23 10:05:06 -0500
commit870e7d61c514309119de218c3d7181ceeeffcb38 (patch)
tree5f7bc0ac13c08275d872bc645e20716c5f51b627 /plugin/icedteanp/java/sun/applet/PluginMain.java
parentb2311631f029fd5f77e62d36807678a099bd6a4d (diff)
integrate basic proxy configuration support
2010-11-23 Omair Majid <[email protected]> * netx/net/sourceforge/jnlp/runtime/DeploymentConfiguration.java: Add KEY_PROXY_TYPE, KEY_PROXY_SAME, KEY_PROXY_AUTO_CONFIG_URL, KEY_PROXY_BYPASS_LIST, KEY_PROXY_BYPASS_LOCAL, KEY_PROXY_HTTP_HOST, KEY_PROXY_HTTP_PORT, KEY_PROXY_HTTPS_HOST, KEY_PROXY_HTTPS_PORT, KEY_PROXY_FTP_HOST, KEY_PROXY_FTP_PORT, KEY_PROXY_SOCKS4_HOST, KEY_PROXY_SOCKS4_PORT, and KEY_PROXY_OVERRIDE_HOSTS. (loadDefaultProperties): Use the new constants. * netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java: New class. (JNLPProxySelector): New method. (parseConfiguration): New method. Initializes this object by querying the configuration. (getHost): New method. (getPort): New method. (connectFailed): New method. (select): New method. Returns a list of appropriate proxies to use for a given uri. (inBypassList): New method. Return true if the host in the URI should be bypassed for proxy purposes. (isLocalHost): New method. (getFromConfiguration): New method. Finds a proxy based on configuration. (getFromPAC): New method. (getFromBrowser): New method. * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java (initialize): Install proxy selector and authenticator. * plugin/icedteanp/java/sun/applet/PluginMain.java (init): Do not install authenticator. (CustomAuthenticator): Moved to... * netx/net/sourceforge/jnlp/security/JNLPAuthenticator.java: Here. * plugin/icedteanp/java/sun/applet/PasswordAuthenticationDialog.java Moved to... * netx/net/sourceforge/jnlp/security /PasswordAuthenticationDialog.java: Here. * plugin/icedteanp/java/sun/applet/PluginProxySelector.java: Extend JNLPProxySelector. (select): Renamed to... (getFromBrowser): New method.
Diffstat (limited to 'plugin/icedteanp/java/sun/applet/PluginMain.java')
-rw-r--r--plugin/icedteanp/java/sun/applet/PluginMain.java24
1 files changed, 3 insertions, 21 deletions
diff --git a/plugin/icedteanp/java/sun/applet/PluginMain.java b/plugin/icedteanp/java/sun/applet/PluginMain.java
index f270d9e..6c83ffd 100644
--- a/plugin/icedteanp/java/sun/applet/PluginMain.java
+++ b/plugin/icedteanp/java/sun/applet/PluginMain.java
@@ -77,6 +77,7 @@ import java.util.Properties;
import net.sourceforge.jnlp.runtime.DeploymentConfiguration;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.security.JNLPAuthenticator;
/**
* The main entry point into PluginAppletViewer.
@@ -202,8 +203,9 @@ public class PluginMain
boolean installAuthenticator = Boolean.valueOf(JNLPRuntime.getConfiguration()
.getProperty(DeploymentConfiguration.KEY_SECURITY_INSTALL_AUTHENTICATOR));
if (installAuthenticator) {
- Authenticator.setDefault(new CustomAuthenticator());
+ Authenticator.setDefault(new JNLPAuthenticator());
}
+ // override the proxy selector set by JNLPRuntime
ProxySelector.setDefault(new PluginProxySelector());
CookieManager ckManager = new PluginCookieManager();
@@ -218,24 +220,4 @@ public class PluginMain
return streamHandler.getMessage();
}
- static class CustomAuthenticator extends Authenticator {
-
- public PasswordAuthentication getPasswordAuthentication() {
-
- // No security check is required here, because the only way to
- // set parameters for which auth info is needed
- // (Authenticator:requestPasswordAuthentication()), has a security
- // check
-
- String type = this.getRequestorType() == RequestorType.PROXY ? "proxy" : "web";
-
- // request auth info from user
- PasswordAuthenticationDialog pwDialog = new PasswordAuthenticationDialog();
- PasswordAuthentication auth = pwDialog.askUser(this.getRequestingHost(), this.getRequestingPort(), this.getRequestingPrompt(), type);
-
- // send it along
- return auth;
- }
- }
-
}