org.apache.commons.logging.security
Class MockSecurityManager
java.lang.Object
java.lang.SecurityManager
org.apache.commons.logging.security.MockSecurityManager
public class MockSecurityManager
- extends SecurityManager
Custom implementation of a security manager, so we can control the
security environment for tests in this package.
Method Summary |
void |
addPermission(Permission p)
Define the set of permissions to be granted to classes in the o.a.c.l package,
but NOT to unit-test classes in o.a.c.l.security package. |
void |
checkPermission(Permission p)
|
int |
getUntrustedCodeCount()
This returns the number of times that a check of a permission failed
due to stack-walking tracing up into untrusted code. |
Methods inherited from class java.lang.SecurityManager |
checkAccept, checkAccess, checkAccess, checkAwtEventQueueAccess, checkConnect, checkConnect, checkCreateClassLoader, checkDelete, checkExec, checkExit, checkLink, checkListen, checkMemberAccess, checkMulticast, checkMulticast, checkPackageAccess, checkPackageDefinition, checkPermission, checkPrintJobAccess, checkPropertiesAccess, checkPropertyAccess, checkRead, checkRead, checkRead, checkSecurityAccess, checkSetFactory, checkSystemClipboardAccess, checkTopLevelWindow, checkWrite, checkWrite, classDepth, classLoaderDepth, currentClassLoader, currentLoadedClass, getClassContext, getInCheck, getSecurityContext, getThreadGroup, inClass, inClassLoader |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MockSecurityManager
public MockSecurityManager()
addPermission
public void addPermission(Permission p)
- Define the set of permissions to be granted to classes in the o.a.c.l package,
but NOT to unit-test classes in o.a.c.l.security package.
getUntrustedCodeCount
public int getUntrustedCodeCount()
- This returns the number of times that a check of a permission failed
due to stack-walking tracing up into untrusted code. Any non-zero
value indicates a bug in JCL, ie a situation where code was not
correctly wrapped in an AccessController block. The result of such a
bug is that signing JCL is not sufficient to allow JCL to perform
the operation; the caller would need to be signed too.
checkPermission
public void checkPermission(Permission p)
throws SecurityException
- Overrides:
checkPermission
in class SecurityManager
- Throws:
SecurityException
Copyright © 2001-2009 Apache Software Foundation. All Rights Reserved.