| Java2SecTest demostrates the usages of AccessController class and Policy file(s) while Security Manager is enabled:
1. testNoPrivilegePassed shows the usage of no AccessController but it still work fine
because it has all the permissions.
2. testNoPrivilegeFailure shows the usage of AccessController with LessPermission.java,
which is not right approach.
3. testDoPrivilegePassed shows the correct practice of java 2 security by granting the appropriate
permission in the policy file(s0 and wrapping the AccessController calls with MorePermission.java.
4. testDoPrivilegeFailure shows the reverse call order of MorePermission and LessPermission
from testDoPrivilegedPassed.
5. testAccessControlContextFailure shows the AccessContext which contains a no-permission class
on the stack can cause a failure. In our case, the no-permission class is
LessPermissionAccessControlContext.
|