This class defines the methods necessary to
implement a security policy for the safe
execution of untrusted code. Before performing potentially sensitive
operations, Java calls methods of the
SecurityManager object currently in effect to
determine whether the operations are permitted. These methods throw a
SecurityException if the operation is not
permitted. Typical applications do not need to use or subclass
SecurityManager. It is typically used only by web
browsers, applet viewers, and other programs that need to run
untrusted code in a controlled environment.
Prior to Java 1.2, this class
is abstract, and the default implementation of
each check( ) method throws a
SecurityException unconditionally. The Java
security mechanism has been overhauled as of Java 1.2. As part of the
overhaul, this class is no longer abstract and its
methods have useful default implementations, so there is rarely a
need to subclass it. checkPermission( ) operates
by invoking the checkPermission( ) method of the
system java.security.AccessController object. In
Java 1.2 and later, all other check( ) methods of
SecurityManager are now implemented on top of
checkPermission( ).
public class SecurityManager {
// Public Constructors
public SecurityManager( );
// Public Instance Methods
public void checkAccept(String host, int port);
public void checkAccess(ThreadGroup g);
public void checkAccess(Thread t);
1.1 public void checkAwtEventQueueAccess( );
public void checkConnect(String host, int port);
public void checkConnect(String host, int port, Object context);
public void checkCreateClassLoader( );
public void checkDelete(String file);
public void checkExec(String cmd);
public void checkExit(int status);
public void checkLink(String lib);
public void checkListen(int port);
1.1 public void checkMemberAccess(Class<?> clazz, int which);
1.1 public void checkMulticast(java.net.InetAddress maddr);
public void checkPackageAccess(String pkg);
public void checkPackageDefinition(String pkg);
1.2 public void checkPermission(java.security.Permission perm);
1.2 public void checkPermission(java.security.Permission perm, Object context);
1.1 public void checkPrintJobAccess( );
public void checkPropertiesAccess( );
public void checkPropertyAccess(String key);
public void checkRead(String file);
public void checkRead(java.io.FileDescriptor fd);
public void checkRead(String file, Object context);
1.1 public void checkSecurityAccess(String target);
public void checkSetFactory( );
1.1 public void checkSystemClipboardAccess( );
public boolean checkTopLevelWindow(Object window);
public void checkWrite(java.io.FileDescriptor fd);
public void checkWrite(String file);
public Object getSecurityContext( ); default:AccessControlContext
1.1 public ThreadGroup getThreadGroup( );
// Protected Instance Methods
protected Class[ ] getClassContext( ); native
// Deprecated Public Methods
1.1# public void checkMulticast(java.net.InetAddress maddr, byte ttl);
# public boolean getInCheck( ); default:false
// Deprecated Protected Methods
# protected int classDepth(String name); native
# protected int classLoaderDepth( );
# protected ClassLoader currentClassLoader( );
1.1# protected Class<?> currentLoadedClass( );
# protected boolean inClass(String name);
# protected boolean inClassLoader( );
// Deprecated Protected Fields
# protected boolean inCheck;
}