Package java.security

Examples of java.security.PermissionCollection.implies()


            FilePermission fp = new FilePermission( root, "read" );
            rootDirectory = fp.newPermissionCollection();
            rootDirectory.add( fp );
            rootDirectory.add( new FilePermission( root + File.separator + "-", "read" ) );
        }
        return ( rootDirectory.implies( new FilePermission( file.getCanonicalPath(), "read" ) ) );
    }

    /**
     * This method tries to find a suitable InetAddress that is routable.  It calls {@link java.net.InetAddress#getLocalHost}
     * to find the local host.  If that address it a site local address (192.168.*.*, 10.*.*.*, or 172.16.*.*) or the
View Full Code Here


        // excluded ?
        if (excludedPermissions.implies(permission)) {
            logger.debug("Permission ''{0}'' is excluded, return false", permission);
            return false;
        } else if (uncheckedPermissions.implies(permission)) { // unchecked
            logger.debug("Permission ''{0}'' is unchecked, return true", permission);
            return true;
        } else {
            // per role if any or false
            if (domain.getPrincipals().length > 0) {
View Full Code Here

                logger.debug("Checking permission ''{0}'' with permissions of Principal ''{1}''.", permission, principals[i]
                        .getName());
            }
            permissions = jPolicyConfiguration.getPermissionsForPrincipal(principals[i]);

            if (permissions.implies(permission)) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Permission implied with principal ''{0}''.", principals[i].getName());
                }
                implied = true;
            }
View Full Code Here

 
  public final boolean checkPermission(Permission perm)
  {
    PermissionCollection perms = getCombinedPermissions();
    if (perms != null) {
      if (perms.implies(perm)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

 
    Citizen citizen = _citizen;
    if (citizen != null) {
      PermissionCollection pc = citizen.getCombinedPermissions();
      if (pc != null) {
        if (pc.implies(perm)) {
          return true;
        }
      }
    }
   
View Full Code Here

    public void testWildCards() {
        PermissionCollection collection = new EJBMethodPermission("HelloWorld", "").newPermissionCollection();
        collection.add(new EJBMethodPermission("HelloWorld", ""));

        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",,")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local,")));
View Full Code Here

    public void testWildCards() {
        PermissionCollection collection = new EJBMethodPermission("HelloWorld", "").newPermissionCollection();
        collection.add(new EJBMethodPermission("HelloWorld", ""));

        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",,")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local,")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "hello")));
View Full Code Here

        PermissionCollection collection = new EJBMethodPermission("HelloWorld", "").newPermissionCollection();
        collection.add(new EJBMethodPermission("HelloWorld", ""));

        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",,")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local,")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "hello")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "hello,,a,b,c")));
View Full Code Here

        collection.add(new EJBMethodPermission("HelloWorld", ""));

        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",,")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local,")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "hello")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "hello,,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "hello,,")));
View Full Code Here

        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",,")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", ",Local,")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "hello")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "hello,,a,b,c")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "hello,,")));
        assertTrue(collection.implies(new EJBMethodPermission("HelloWorld", "hello,Local")));
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.