FileDocCategorySizeDatePackage
J2EESecurityManager.javaAPI DocGlassfish v2 API5209Fri May 04 22:31:16 BST 2007com.sun.enterprise

J2EESecurityManager

public class J2EESecurityManager extends RMISecurityManager
Java 2 security manager that enforces code security.
author
Harish Prabandham

Fields Summary
private static Logger
_logger
private com.sun.enterprise.security.CachedPermissionImpl
connectPerm
private com.sun.enterprise.security.PermissionCache
cache
private boolean
cacheEnabled
Constructors Summary
public J2EESecurityManager()


      
    
Methods Summary
public synchronized booleancacheEnabled()

	return cacheEnabled;
    
public voidcheckAccess(java.lang.ThreadGroup t)

       super.checkAccess(t);
       checkPermission(new java.lang.RuntimePermission("modifyThreadGroup"));
   
public voidcheckConnect(java.lang.String host, int port)

	if (checkConnectPermission()) {
	    return;
	}
	super.checkConnect(host, port);
    
public voidcheckConnect(java.lang.String host, int port, java.lang.Object context)

	if (checkConnectPermission()) {
	    return;
	}
	super.checkConnect(host, port, context);
    
private booleancheckConnectPermission()

	if (cacheEnabled()) {
	    return connectPerm.checkPermission();
	} 
	return false;
    
public voidcheckExit(int status)

        // Verify exit permission
        super.checkExit(status);
    
public voidcheckPackageAccess(java.lang.String pkgname)

	// Remove this once 1.2.2 SecurityManager/ClassLoader bug is fixed.
	if(!pkgname.startsWith("sun."))
	    super.checkPackageAccess(pkgname);
    
private booleancheckProperty(java.lang.String key)

	if (cacheEnabled()) {
	    return cache.checkPermission(new PropertyPermission(key, "read"));
	} 
	return false;
    
public voidcheckPropertyAccess(java.lang.String key)

	if (checkProperty(key)) {
	    return;
	} 
	super.checkPropertyAccess(key);
    
public synchronized voidenablePermissionCache(com.sun.enterprise.security.PermissionCache c)

	if (c != null) {
	    cache = c;
	    connectPerm = new CachedPermissionImpl
		(cache, new SocketPermission("*","connect"));
	    cacheEnabled = true;
	}