public class

AppletSecurity

extends AWTSecurityManager
java.lang.Object
   ↳ java.lang.SecurityManager
     ↳ sun.awt.AWTSecurityManager
       ↳ sun.applet.AppletSecurity

Class Overview

This class defines an applet security policy

Summary

[Expand]
Inherited Fields
From class java.lang.SecurityManager
Public Constructors
AppletSecurity()
Construct and initialize.
Public Methods
void checkAccess(Thread t)
Applets are not allowed to manipulate threads outside applet thread groups.
synchronized 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.
AppContext getAppContext()
Get the AppContext corresponding to the current context.
ThreadGroup getThreadGroup()
Returns the thread group of the applet.
void reset()
Reset from Properties
Protected Methods
boolean inThreadGroup(Thread thread)
Returns true of the threadgroup of thread is in the applet's own threadgroup.
boolean inThreadGroup(ThreadGroup g)
Returns true if this threadgroup is in the applet's own thread group.
[Expand]
Inherited Methods
From class sun.awt.AWTSecurityManager
From class java.lang.SecurityManager
From class java.lang.Object

Public Constructors

public AppletSecurity ()

Construct and initialize.

Public Methods

public void checkAccess (Thread t)

Applets are not allowed to manipulate threads outside applet thread groups. However a terminated thread no longer belongs to any group.

Parameters
t the thread to be checked.

public synchronized void checkAccess (ThreadGroup g)

Applets are not allowed to manipulate thread groups outside applet thread groups.

Parameters
g the thread group to be checked.

public void checkAwtEventQueueAccess ()

Tests if a client can get access to the AWT event queue.

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

Throws
SecurityException if the caller does not have permission to accesss the AWT event queue.

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.

Parameters
pkgname the package name.
Throws
SecurityException if the caller does not have permission to access the specified package.

public 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.

Returns
  • the AppContext corresponding to the current context.

public ThreadGroup getThreadGroup ()

Returns the thread group of the applet. We consult the classloader if there is one.

Returns
  • ThreadGroup that new threads are instantiated into

public void reset ()

Reset from Properties

Protected Methods

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. This will return false if there is no current class loader.