sun.applet
Class AppletSecurity

java.lang.Object
  extended by java.lang.SecurityManager
      extended by sun.awt.AWTSecurityManager
          extended by sun.applet.AppletSecurity

public class AppletSecurity
extends sun.awt.AWTSecurityManager

This class defines an applet security policy


Constructor Summary
AppletSecurity()
          Construct and initialize.
 
Method Summary
 void checkAccess(Thread t)
          Applets are not allowed to manipulate threads outside applet thread groups.
 void checkAccess(ThreadGroup g)
          Applets are not allowed to manipulate thread groups outside applet thread groups.
 void checkAwtEventQueueAccess()
          Tests if a client can get access to the AWT event queue.
 void checkPackageAccess(String pkgname)
          Throws a SecurityException if the calling thread is not allowed to access the package specified by the argument.
 sun.awt.AppContext getAppContext()
          Get the AppContext corresponding to the current context.
 ThreadGroup getThreadGroup()
          Returns the thread group of the applet.
protected  boolean inThreadGroup(Thread thread)
          Returns true of the threadgroup of thread is in the applet's own threadgroup.
protected  boolean inThreadGroup(ThreadGroup g)
          Returns true if this threadgroup is in the applet's own thread group.
 void reset()
          Reset from Properties
 
Methods inherited from class java.lang.SecurityManager
checkAccept, checkConnect, checkConnect, checkCreateClassLoader, checkDelete, checkExec, checkExit, checkLink, checkListen, checkMemberAccess, checkMulticast, checkMulticast, checkPackageDefinition, checkPermission, checkPermission, checkPrintJobAccess, checkPropertiesAccess, checkPropertyAccess, checkRead, checkRead, checkRead, checkSecurityAccess, checkSetFactory, checkSystemClipboardAccess, checkTopLevelWindow, checkWrite, checkWrite, getClassContext, getSecurityContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppletSecurity

public AppletSecurity()
Construct and initialize.

Method Detail

reset

public void reset()
Reset from Properties


inThreadGroup

protected boolean inThreadGroup(ThreadGroup g)
Returns true if this threadgroup is in the applet's own thread group. This will return false if there is no current applet class loader.


inThreadGroup

protected boolean inThreadGroup(Thread thread)
Returns true of the threadgroup of thread is in the applet's own threadgroup.


checkAccess

public void checkAccess(Thread t)
Applets are not allowed to manipulate threads outside applet thread groups.

Overrides:
checkAccess in class SecurityManager
Parameters:
t - the thread to be checked.
See Also:
setDaemon, setName, setPriority, checkPermission

checkAccess

public void checkAccess(ThreadGroup g)
Applets are not allowed to manipulate thread groups outside applet thread groups.

Overrides:
checkAccess in class SecurityManager
Parameters:
g - the thread group to be checked.
See Also:
destroy, setDaemon, setMaxPriority, checkPermission

checkPackageAccess

public void checkPackageAccess(String pkgname)
Throws a SecurityException if the calling thread is not allowed to access the package specified by the argument.

This method is used by the loadClass method of class loaders.

The checkPackageAccess method for class SecurityManager calls checkPermission with the RuntimePermission("accessClassInPackage."+pkg) permission.

Overrides:
checkPackageAccess in class SecurityManager
Parameters:
pkg - the package name.
Throws:
SecurityException - if the caller does not have permission to access the specified package.
See Also:
ClassLoader.loadClass(java.lang.String, boolean)

checkAwtEventQueueAccess

public void checkAwtEventQueueAccess()
Tests if a client can get access to the AWT event queue.

This method calls checkPermission with the AWTPermission("accessEventQueue") permission.

Overrides:
checkAwtEventQueueAccess in class SecurityManager
Throws:
SecurityException - if the caller does not have permission to accesss the AWT event queue.
Since:
JDK1.1
See Also:
checkPermission

getThreadGroup

public ThreadGroup getThreadGroup()
Returns the thread group of the applet. We consult the classloader if there is one.

Overrides:
getThreadGroup in class SecurityManager
Returns:
ThreadGroup that new threads are instantiated into
See Also:
ThreadGroup

getAppContext

public sun.awt.AppContext getAppContext()
Get the AppContext corresponding to the current context. The default implementation returns null, but this method may be overridden by various SecurityManagers (e.g. AppletSecurity) to index AppContext objects by the calling context.

Overrides:
getAppContext in class sun.awt.AWTSecurityManager
Returns:
the AppContext corresponding to the current context.
Since:
JDK1.2.1
See Also:
AppContext, SecurityManager