Package java.security

Examples of java.security.SecurityPermission


     */
    public void testGetPermissions_CodeSource() throws Exception {
        CodeSource cs = new CodeSource(null, (Certificate[])null);
        CodeSource cs2 = new CodeSource(new URL("http://a.b.c"),
            (Certificate[])null);
        Permission sp1 = new SecurityPermission("aaa");
        Permission sp2 = new SecurityPermission("bbb");
        Permission sp3 = new SecurityPermission("ccc");
        PolicyEntry pe1 = new PolicyEntry(cs, null, Arrays
            .asList(new Permission[] { sp1 }));
        PolicyEntry pe2 = new PolicyEntry(cs2, new HashSet(), Arrays
            .asList(new Permission[] { sp2 }));
        PolicyEntry pe3 = new PolicyEntry(cs, Arrays
View Full Code Here


    /**
     * Tests proper policy evaluation for ProtectionDomain parameters.
     */
    public void testGetPermissions_ProtectionDomain() throws Exception {
        Permission sp1 = new SecurityPermission("aaa");
        Permission sp2 = new SecurityPermission("bbb");
        Permission sp3 = new SecurityPermission("ccc");
        Permission sp4 = new SecurityPermission("ddd");
        Permission spZ = new SecurityPermission("zzz");
        PermissionCollection pcZ = spZ.newPermissionCollection();
        pcZ.add(spZ);
        CodeSource cs = new CodeSource(null, (Certificate[])null);
        CodeSource cs2 = new CodeSource(new URL("http://a.b.c"),
            (Certificate[])null);
        ProtectionDomain pd1 = new ProtectionDomain(cs, null);
View Full Code Here

     *     SecurityPermission</code>
     */
    public void setPolicy(ClassLoader loader, Policy subPolicy) {
  SecurityManager sm = System.getSecurityManager();
  if (sm != null) {
      sm.checkPermission(new SecurityPermission("setPolicy"));
  }
  synchronized (subPolicies) {
      subPolicyCache.clear();
      if (loader != null) {
    if (subPolicy != null) {
View Full Code Here

  public void checkPermission(Permission perm) {
    AccessController.checkPermission(perm);
  }
 
  public void checkSecurityAccess(String target) {
    checkPermission(new SecurityPermission(target));
  }
View Full Code Here

    }

    public static PolicyContextHandler getInstance() {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new SecurityPermission("setPolicy"));
        }
   
        return _getInstance();
    }
View Full Code Here

   {
     
      // Validate the caller permission
      SecurityManager sm = System.getSecurityManager();
      if (sm != null)
         sm.checkPermission(new SecurityPermission("setPolicy"));

      if (factory == null)
      {
         String factoryName = null;
         Class clazz = null;
View Full Code Here

    }

    public static PolicyContextHandler getInstance() {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new SecurityPermission("setPolicy"));
        }
   
        return _getInstance();
    }
View Full Code Here

            Policy.setPolicy(policy);

            try {
                r.run();
            } finally {
                policy.addPermission(new SecurityPermission("setPolicy"));
                Policy.setPolicy(savedPolicy);
            }
        }
    }
View Full Code Here

            // Permissions j.u.c. needs directly
            (new RuntimePermission("modifyThread"),
             new RuntimePermission("getClassLoader"),
             new RuntimePermission("setContextClassLoader"),
             // Permissions needed to change permissions!
             new SecurityPermission("getPolicy"),
             new SecurityPermission("setPolicy"),
             new RuntimePermission("setSecurityManager"),
             // Permissions needed by the junit test harness
             new RuntimePermission("accessDeclaredMembers"),
             new PropertyPermission("*", "read"),
             new java.io.FilePermission("<<ALL FILES>>", "read"));
View Full Code Here

   * @throws IllegalArgumentException if action is ""
   * @since 1.1
   */
  public void checkSecurityAccess(String action)
  {
    checkPermission(new SecurityPermission(action));
  }
View Full Code Here

TOP

Related Classes of java.security.SecurityPermission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.