/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Permission constants and string constants used to create permissions
* used throughout the JDK.
*/
public final class SecurityConstants {
// Cannot create one of these
private SecurityConstants () {
}
// Commonly used string constants for permission actions used by
// SecurityManager. Declare here for shortcut when checking permissions
// in FilePermission, SocketPermission, and PropertyPermission.
// Permission constants used in the various checkPermission() calls in JDK.
// java.lang.Class, java.lang.SecurityManager, java.lang.System,
// java.net.URLConnection, java.security.AllPermission, java.security.Policy,
// sun.security.provider.PolicyFile
/**
* Permission type used when AWT is not present.
*/
super(name);
}
}
}
/**
* Permission factory used when AWT is not present.
*/
private static class FakeAWTPermissionFactory
implements PermissionFactory<FakeAWTPermission>
{
return new FakeAWTPermission(name);
}
}
/**
* AWT Permissions used in the JDK.
*/
public static class AWT {
private AWT() { }
/**
* The class name of the factory to create java.awt.AWTPermission objects.
*/
/**
* The PermissionFactory to create AWT permissions (or fake permissions
* if AWT is not present).
*/
Class<?> c = AccessController
try {
} catch (ClassNotFoundException e) {
// not available
return null;
}
}});
if (c != null) {
// AWT present
try {
return (PermissionFactory<?>)c.newInstance();
} catch (InstantiationException x) {
throw new InternalError(x.getMessage());
} catch (IllegalAccessException x) {
throw new InternalError(x.getMessage());
}
} else {
// AWT not present
return new FakeAWTPermissionFactory();
}
}
}
// java.lang.SecurityManager
newAWTPermission("showWindowWithoutWarningBanner");
// java.lang.SecurityManager
newAWTPermission("accessClipboard");
// java.lang.SecurityManager
newAWTPermission("accessEventQueue");
// java.awt.Dialog
newAWTPermission("toolkitModality");
// java.awt.Robot
newAWTPermission("readDisplayPixels");
// java.awt.Robot
newAWTPermission("createRobot");
// java.awt.MouseInfo
newAWTPermission("watchMousePointer");
// java.awt.Window
newAWTPermission("setWindowAlwaysOnTop");
// java.awt.Toolkit
newAWTPermission("listenToAllAWTEvents");
// java.awt.SystemTray
newAWTPermission("accessSystemTray");
}
// java.net.URL
new NetPermission("specifyStreamHandler");
// java.net.ProxySelector
new NetPermission("setProxySelector");
// java.net.ProxySelector
new NetPermission("getProxySelector");
// java.net.CookieHandler
new NetPermission("setCookieHandler");
// java.net.CookieHandler
new NetPermission("getCookieHandler");
// java.net.ResponseCache
new NetPermission("setResponseCache");
// java.net.ResponseCache
new NetPermission("getResponseCache");
// java.lang.SecurityManager, sun.applet.AppletPanel, sun.misc.Launcher
new RuntimePermission("createClassLoader");
// java.lang.SecurityManager
new RuntimePermission("accessDeclaredMembers");
// java.lang.SecurityManager, sun.applet.AppletSecurity
new RuntimePermission("modifyThread");
// java.lang.SecurityManager, sun.applet.AppletSecurity
new RuntimePermission("modifyThreadGroup");
// java.lang.Class
new RuntimePermission("getProtectionDomain");
// java.lang.Class, java.lang.ClassLoader, java.lang.Thread
new RuntimePermission("getClassLoader");
// java.lang.Thread
new RuntimePermission("stopThread");
// java.lang.Thread
new RuntimePermission("getStackTrace");
// java.security.AccessControlContext
new SecurityPermission("createAccessControlContext");
// java.security.AccessControlContext
new SecurityPermission("getDomainCombiner");
// java.security.Policy, java.security.ProtectionDomain
new SecurityPermission ("getPolicy");
// java.lang.SecurityManager
}