diff options
Diffstat (limited to 'netx/net/sourceforge/jnlp/config')
3 files changed, 95 insertions, 0 deletions
diff --git a/netx/net/sourceforge/jnlp/config/Defaults.java b/netx/net/sourceforge/jnlp/config/Defaults.java index 8b9785a..9e51d78 100644 --- a/netx/net/sourceforge/jnlp/config/Defaults.java +++ b/netx/net/sourceforge/jnlp/config/Defaults.java @@ -42,6 +42,7 @@ import static net.sourceforge.jnlp.runtime.Translator.R; import java.io.File; import java.util.HashMap; import java.util.Map; +import net.sourceforge.jnlp.security.appletextendedsecurity.AppletSecurityLevel; import net.sourceforge.jnlp.ShortcutDesc; import net.sourceforge.jnlp.runtime.JNLPProxySelector; @@ -384,6 +385,12 @@ public class Defaults { DeploymentConfiguration.KEY_PLUGIN_JVM_ARGUMENTS, null, null + }, + //unsigned applet security level + { + DeploymentConfiguration.KEY_SECURITY_LEVEL, + new SecurityValueValidator(), + null } }; diff --git a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java index c7e3e33..98dc88b 100644 --- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java +++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java @@ -51,6 +51,7 @@ public final class DeploymentConfiguration { public static final String DEPLOYMENT_DIR = ".icedtea"; public static final String DEPLOYMENT_CONFIG = "deployment.config"; public static final String DEPLOYMENT_PROPERTIES = "deployment.properties"; + public static final String APPLET_TRUST_SETTINGS = ".appletTrustSettings"; public static final String DEPLOYMENT_COMMENT = "Netx deployment configuration"; @@ -105,6 +106,9 @@ public final class DeploymentConfiguration { /** Boolean. Only show security prompts to user if true */ public static final String KEY_SECURITY_PROMPT_USER = "deployment.security.askgrantdialog.show"; + //enum of AppletSecurityLevel in result + public static final String KEY_SECURITY_LEVEL = "deployment.security.level"; + public static final String KEY_SECURITY_TRUSTED_POLICY = "deployment.security.trusted.policy"; /** Boolean. Only give AWTPermission("showWindowWithoutWarningBanner") if true */ @@ -196,6 +200,17 @@ public final class DeploymentConfiguration { load(true); } + public static File getAppletTrustUserSettingsPath() { + return new File(System.getProperty("user.home") + File.separator + DEPLOYMENT_DIR + + File.separator + APPLET_TRUST_SETTINGS); + } + + public static File getAppletTrustGlobalSettingsPath() { + return new File(File.separator + "etc" + File.separator + ".java" + File.separator + + "deployment" + File.separator + APPLET_TRUST_SETTINGS); + + } + /** * Initialize this deployment configuration by reading configuration files. * Generally, it will try to continue and ignore errors it finds (such as file not found). diff --git a/netx/net/sourceforge/jnlp/config/SecurityValueValidator.java b/netx/net/sourceforge/jnlp/config/SecurityValueValidator.java new file mode 100644 index 0000000..099cabd --- /dev/null +++ b/netx/net/sourceforge/jnlp/config/SecurityValueValidator.java @@ -0,0 +1,73 @@ +/* Copyright (C) 2013 Red Hat, Inc. + + This file is part of IcedTea. + + IcedTea is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by + the Free Software Foundation, version 2. + + IcedTea is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with IcedTea; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from + or based on this library. If you modify this library, you may extend + this exception to your version of the library, but you are not + obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + */ +package net.sourceforge.jnlp.config; + +import net.sourceforge.jnlp.security.appletextendedsecurity.AppletSecurityLevel; + +class SecurityValueValidator implements ValueValidator { + + public SecurityValueValidator() { + } + + @Override + public void validate(Object value) throws IllegalArgumentException { + if (value == null) { + throw new IllegalArgumentException("Value can't be null"); + } + if (value instanceof AppletSecurityLevel) { + //?? + return; + } + if (!(value instanceof String)) { + throw new IllegalArgumentException("Expected was String, was " + value.getClass()); + } + try { + AppletSecurityLevel validated = AppletSecurityLevel.fromString((String) value); + if (validated == null) { + throw new IllegalArgumentException("Result can't be null, was"); + } + //thrown by fromString + } catch (RuntimeException ex) { + throw new IllegalArgumentException(ex); + } + } + + @Override + public String getPossibleValues() { + return AppletSecurityLevel.allToString(); + } + +} |