Package java.security

Examples of java.security.PermissionCollection.elements()


        });
     
        // add the newly granted perms,
        // avoiding duplicates
        synchronized (newPerms) {
      e = newPerms.elements();
      while (e.hasMoreElements()) {
          Permission newPerm = (Permission)e.nextElement();
          if (!perms.implies(newPerm)) {
        perms.add(newPerm);
        if (debug != null)
View Full Code Here


            policyConfiguration.addToExcludedPolicy(componentPermissions.getExcludedPermissions());
            policyConfiguration.addToUncheckedPolicy(componentPermissions.getUncheckedPermissions());
            for (Map.Entry<String, PermissionCollection> roleEntry : componentPermissions.getRolePermissions().entrySet()) {
                String roleName = roleEntry.getKey();
                PermissionCollection rolePermissions = roleEntry.getValue();
                for (Enumeration permissions = rolePermissions.elements(); permissions.hasMoreElements();) {
                    Permission permission = (Permission) permissions.nextElement();
                    policyConfiguration.addToRole(roleName, permission);

                }
            }
View Full Code Here

            policyConfiguration.addToExcludedPolicy(componentPermissions.getExcludedPermissions());
            policyConfiguration.addToUncheckedPolicy(componentPermissions.getUncheckedPermissions());
            for (Map.Entry<String, PermissionCollection> roleEntry : componentPermissions.getRolePermissions().entrySet()) {
                String roleName = roleEntry.getKey();
                PermissionCollection rolePermissions = roleEntry.getValue();
                for (Enumeration permissions = rolePermissions.elements(); permissions.hasMoreElements();) {
                    Permission permission = (Permission) permissions.nextElement();
                    policyConfiguration.addToRole(roleName, permission);

                }
            }
View Full Code Here

        policy.pc = sp.newPermissionCollection();
                
        //case1: empty policy, no static permissions in PD
        PermissionCollection pc4pd = policy.getPermissions(pd);
        assertNotNull(pc4pd);
        Enumeration en = pc4pd.elements();
        assertFalse(en.hasMoreElements());
       
        //case2: empty policy, some static permissions in PD
        pc4pd = policy.getPermissions(pd2);
        assertNotNull(pc4pd);
View Full Code Here

        //case3: non-empty policy, no static permissions in PD
        policy.pc.add(sp);
        pc4pd = policy.getPermissions(pd);
        assertNotNull(pc4pd);
        Collection c = new HashSet();
        for (en = pc4pd.elements();en.hasMoreElements(); c.add(en.nextElement())) {
        }

        assertTrue(c.contains(sp));
       
        //case4: non-empty policy, some static permissions in PD
View Full Code Here

       
        //case4: non-empty policy, some static permissions in PD
        pc4pd = policy.getPermissions(pd2);
        assertNotNull(pc4pd);
        c = new HashSet();
        for (en = pc4pd.elements();en.hasMoreElements(); c.add(en.nextElement())) {
        }

        assertTrue(c.contains(sp));
        //no check for static permissions
    }
View Full Code Here

        CodeSource codeSource = new CodeSource(
                new URL("file:" + codeSourceURL),
                (java.security.cert.Certificate[]) null);

        PermissionCollection pCollection = p.getPermissions(codeSource);
        Enumeration<Permission> elements = pCollection.elements();

        SecurityPermission perm = new SecurityPermission(
                "codeBaseForPolicyTest");

        while (elements.hasMoreElements()) {
View Full Code Here

      }
    }

    MyClassLoader myloader = new MyClassLoader();
    PermissionCollection pc = myloader.getPerms();
    Enumeration e1 = pc.elements();
    int count = 0;
    while (e1.hasMoreElements()) {
      e1.nextElement();
      count++;
    }
View Full Code Here

        Permission p2 = new AllPermission();
        Collection c1 = Arrays.asList(new Permission[] { p1, p2, });

        PermissionCollection pc = PolicyUtils.toPermissionCollection(null);
        assertNotNull(pc);
        assertFalse(pc.elements().hasMoreElements());

        pc = PolicyUtils.toPermissionCollection(new HashSet());
        assertNotNull(pc);
        assertFalse(pc.elements().hasMoreElements());
View Full Code Here

        assertNotNull(pc);
        assertFalse(pc.elements().hasMoreElements());

        pc = PolicyUtils.toPermissionCollection(new HashSet());
        assertNotNull(pc);
        assertFalse(pc.elements().hasMoreElements());

        pc = PolicyUtils.toPermissionCollection(c1);
        assertNotNull(pc);
        Enumeration en = pc.elements();
        Collection c2 = new HashSet();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.