Name
SecurityManager
Synopsis
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access