Listing All Permissions Granted to a Loaded Class : Permission « Security « Java

Listing All Permissions Granted to a Loaded Class


import java.util.Enumeration;

public class Main {
  public static void main(String[] argv) throws Exception {
    ProtectionDomain domain = String.class.getProtectionDomain();
    PermissionCollection pcoll = Policy.getPolicy().getPermissions(domain);
    Enumeration e = pcoll.elements();
    for (; e.hasMoreElements();) {
      Permission p = (Permission) e.nextElement();


Related examples in the same category

1.Checking Read/Write Permission for a Directory
2.Determining If One Permission Implies Another
3.Creating a Custom Permission
4.extends BasicPermission
5.boolean Permission.implies(Permission permission)
6.Controlling Access to an Object using a permission
7.Guard guard = new PropertyPermission("java.home", "read"); GuardedObject(Object obj, Guard)
9.Object GuardedObject.getObject()
10.Execution of reflection