|
Build 1.1_r1 (from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.SecurityManager
public class SecurityManager
Provides security verification facilities for applications. SecurityManager contains a set of checkXXX methods which determine
if it is safe to perform a specific operation such as establishing network
connections, modifying files, and many more. In general, these methods simply
return if they allow the application to perform the operation; if an
operation is not allowed, then they throw a SecurityException. The
only exception is checkTopLevelWindow(Object), which returns a
boolean to indicate permission.
| Field Summary | |
|---|---|
protected boolean |
inCheck
Deprecated. Use checkPermission(java.security.Permission) |
| Constructor Summary | |
|---|---|
SecurityManager()
Constructs a new SecurityManager instance. |
|
| Method Summary | |
|---|---|
void |
checkAccept(String host,
int port)
Checks whether the calling thread is allowed to accept socket connections. |
void |
checkAccess(Thread thread)
Checks whether the calling thread is allowed to modify the specified thread. |
void |
checkAccess(ThreadGroup group)
Checks whether the calling thread is allowed to modify the specified thread group. |
void |
checkAwtEventQueueAccess()
Checks whether the calling thread is allowed to access the AWT event queue. |
void |
checkConnect(String host,
int port)
Checks whether the calling thread is allowed to establish socket connections. |
void |
checkConnect(String host,
int port,
Object context)
Checks whether the specified security context is allowed to establish socket connections. |
void |
checkCreateClassLoader()
Checks whether the calling thread is allowed to create a class loader. |
void |
checkDelete(String file)
Checks whether the calling thread is allowed to delete the file with the specified name, which should be passed in canonical form. |
void |
checkExec(String cmd)
Checks whether the calling thread is allowed to execute the specified platform specific command. |
void |
checkExit(int status)
Checks whether the calling thread is allowed to terminate the virtual machine. |
void |
checkLink(String libName)
Checks whether the calling thread is allowed to load the specified native library. |
void |
checkListen(int port)
Checks whether the calling thread is allowed to listen on the specified port. |
void |
checkMemberAccess(Class<?> cls,
int type)
Checks whether the calling thread is allowed to access members. |
void |
checkMulticast(InetAddress maddr)
Checks whether the calling thread is allowed to use the specified IP multicast group address. |
void |
checkMulticast(InetAddress maddr,
byte ttl)
Deprecated. use checkMulticast(java.net.InetAddress) |
void |
checkPackageAccess(String packageName)
Checks whether the calling thread is allowed to access the specified package. |
void |
checkPackageDefinition(String packageName)
Checks whether the calling thread is allowed to define new classes in the specified package. |
void |
checkPermission(Permission permission)
Checks whether the calling thread is allowed to access the resource being guarded by the specified permission object. |
void |
checkPermission(Permission permission,
Object context)
Checks whether the specified security context is allowed to access the resource being guarded by the specified permission object. |
void |
checkPrintJobAccess()
Checks whether the calling thread is allowed to start a new print job. |
void |
checkPropertiesAccess()
Checks whether the calling thread is allowed to access the system properties. |
void |
checkPropertyAccess(String key)
Checks whether the calling thread is allowed to access a particular system property. |
void |
checkRead(FileDescriptor fd)
Checks whether the calling thread is allowed to read from the file with the specified file descriptor. |
void |
checkRead(String file)
Checks whether the calling thread is allowed to read from the file with the specified name, which should be passed in canonical form. |
void |
checkRead(String file,
Object context)
Checks whether the given security context is allowed to read from the file named by the argument, which should be passed in canonical form. |
void |
checkSecurityAccess(String target)
Checks whether the calling thread is allowed to perform the security operation named by the target. |
void |
checkSetFactory()
Checks whether the calling thread is allowed to set the net object factories. |
void |
checkSystemClipboardAccess()
Checks whether the calling thread is allowed to access the system clipboard. |
boolean |
checkTopLevelWindow(Object window)
Checks whether the calling thread is trusted to show the specified top level window. |
void |
checkWrite(FileDescriptor fd)
Checks whether the calling thread is allowed to write to the file with the specified file descriptor. |
void |
checkWrite(String file)
Checks whether the calling thread is allowed to write to the file with the specified name, which should be passed in canonical form. |
protected int |
classDepth(String name)
Deprecated. Use checkPermission(java.security.Permission). |
protected int |
classLoaderDepth()
Deprecated. Use checkPermission(java.security.Permission). |
protected ClassLoader |
currentClassLoader()
Deprecated. Use checkPermission(java.security.Permission). |
protected Class<?> |
currentLoadedClass()
Deprecated. Use checkPermission(java.security.Permission). |
protected Class[] |
getClassContext()
Returns an array containing one entry for each method in the current execution stack. |
boolean |
getInCheck()
Deprecated. Use checkPermission(java.security.Permission). |
Object |
getSecurityContext()
Returns an object which encapsulates the security state of the current point in the execution. |
ThreadGroup |
getThreadGroup()
Returns the thread group which should be used to instantiate new threads. |
protected boolean |
inClass(String name)
Deprecated. Use checkPermission(java.security.Permission). |
protected boolean |
inClassLoader()
Deprecated. Use checkPermission(java.security.Permission) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Deprecated protected boolean inCheck
checkPermission(java.security.Permission)
| Constructor Detail |
|---|
public SecurityManager()
SecurityManager instance.
The RuntimePermission("createSecurityManager") is checked if a
security manager is installed.
| Method Detail |
|---|
public void checkAccept(String host,
int port)
host - the address of the host that attempts to connect.port - the port number to check.
NullPointerException - if host is null.
SecurityException - if the calling thread is not allowed to accept socket
connections from host through port.public void checkAccess(Thread thread)
thread - the thread to access.
SecurityException - if the calling thread is not allowed to access thread.public void checkAccess(ThreadGroup group)
group - the thread group to access.
NullPointerException - if group is null.
SecurityException - if the calling thread is not allowed to access group.
public void checkConnect(String host,
int port)
host - the address of the host to connect to.port - the port number to check, or -1 for resolve.
NullPointerException - if host is null.
SecurityException - if the calling thread is not allowed to connect to host through port.
public void checkConnect(String host,
int port,
Object context)
host - the address of the host to connect to.port - the port number to check, or -1 for resolve.context - the security context to use for the check.
NullPointerException - if host is null.
SecurityException - if context is not allowed to connect to host
through port.public void checkCreateClassLoader()
SecurityException - if the calling thread is not allowed to create a class
loader.public void checkDelete(String file)
file - the name of the file to delete.
SecurityException - if the calling thread is not allowed to delete file.public void checkExec(String cmd)
cmd - the command line to execute.
SecurityException - if the calling thread is not allowed to execute cmd.public void checkExit(int status)
status - the status that the virtual machine returns when it is
terminated.
SecurityException - if the calling thread is not allowed to terminate the virtual
machine with status.public void checkLink(String libName)
libName - the name of the library to load.
SecurityException - if the calling thread is not allowed to load libName.public void checkListen(int port)
port - the port number to check.
SecurityException - if the calling thread is not allowed listen on port.
public void checkMemberAccess(Class<?> cls,
int type)
java.lang.reflect.Member.PUBLIC) and to classes loaded by the same
loader as the original caller (that is, the method that called the
reflect API). Due to the nature of the check, overriding implementations
cannot call super.checkMemberAccess() since the stack would no
longer be of the expected shape.
cls - the class of which members are accessed.type - the access type, either java.lang.reflect.Member.PUBLIC or java.lang.reflect.Member.DECLARED.
SecurityException - if the calling thread is not allowed to access members of
cls.public void checkMulticast(InetAddress maddr)
maddr - the internet group address to use.
SecurityException - if the calling thread is not allowed to use maddr.
@Deprecated
public void checkMulticast(InetAddress maddr,
byte ttl)
checkMulticast(java.net.InetAddress)
maddr - the internet group address to use.ttl - the value in use for multicast send. This parameter is
ignored.
SecurityException - if the calling thread is not allowed to use maddr.public void checkPackageAccess(String packageName)
packageName - the name of the package to access.
SecurityException - if the calling thread is not allowed to access packageName.public void checkPackageDefinition(String packageName)
packageName - the name of the package to add a class to.
SecurityException - if the calling thread is not allowed to add classes to
packageName.public void checkPropertiesAccess()
SecurityException - if the calling thread is not allowed to access system
properties.public void checkPropertyAccess(String key)
key - the name of the property to access.
SecurityException - if the calling thread is not allowed to access the key system property.public void checkRead(FileDescriptor fd)
fd - the file descriptor of the file to read from.
SecurityException - if the calling thread is not allowed to read from fd.public void checkRead(String file)
file - the name of the file or directory to read from.
SecurityException - if the calling thread is not allowed to read from file.
public void checkRead(String file,
Object context)
file - the name of the file or directory to check.context - the security context to use for the check.
SecurityException - if context is not allowed to read from file.public void checkSecurityAccess(String target)
target - the name of the operation to perform.
SecurityException - if the calling thread is not allowed to perform
target.public void checkSetFactory()
SecurityException - if the calling thread is not allowed to set the net object
factories.public boolean checkTopLevelWindow(Object window)
window - the window to show.
true if the calling thread is allowed to show window; false otherwise.
NullPointerException - if window is null.public void checkSystemClipboardAccess()
SecurityException - if the calling thread is not allowed to access the system
clipboard.public void checkAwtEventQueueAccess()
SecurityException - if the calling thread is not allowed to access the AWT event
queue.public void checkPrintJobAccess()
SecurityException - if the calling thread is not allowed to start a new print
job.public void checkWrite(FileDescriptor fd)
fd - the file descriptor of the file to write to.
SecurityException - if the calling thread is not allowed to write to fd.public void checkWrite(String file)
file - the name of the file or directory to write to.
SecurityException - if the calling thread is not allowed to write to
file.@Deprecated public boolean getInCheck()
checkPermission(java.security.Permission).
true if this security manager is executing a security
check method; false otherwise.protected Class[] getClassContext()
java.lang.Class which
represents the class in which the method is defined.
@Deprecated protected ClassLoader currentClassLoader()
checkPermission(java.security.Permission).
@Deprecated protected int classLoaderDepth()
checkPermission(java.security.Permission).
@Deprecated protected Class<?> currentLoadedClass()
checkPermission(java.security.Permission).
@Deprecated protected int classDepth(String name)
checkPermission(java.security.Permission).
name - the name of the class to look for.
name.@Deprecated protected boolean inClass(String name)
checkPermission(java.security.Permission).
name - the name of the class to look for.
true if a method from the class identified by name is executing; false otherwise.@Deprecated protected boolean inClassLoader()
checkPermission(java.security.Permission)
true if a method from a class that was defined by a
non-system class loader is executing; false otherwise.public ThreadGroup getThreadGroup()
public Object getSecurityContext()
AccessControlContext.
public void checkPermission(Permission permission)
permission - the permission to check.
SecurityException - if the requested permission is denied according to
the current security policy.
public void checkPermission(Permission permission,
Object context)
permission - the permission to check.context - the security context for which to check permission.
SecurityException - if context is not an instance of AccessControlContext or if the requested permission
is denied for context according to the current
security policy.
|
Build 1.1_r1 (from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||