Package java.security

Examples of java.security.Permission.implies()


        Permission x;
        synchronized (this) {
            x = (Permission) perms.get(p.getName());
        }
        if (x != null) return x.implies(p);

        return false;
  }

    /**
 
View Full Code Here


   *          the permission to check
   */
  public boolean implies(Permission perm) {
    Permission p = perms.get(perm);

    if ((p != null) && p.implies(perm)) {
      return true;
    }

    Enumeration<Permission> permsEnum = elements();

View Full Code Here

   *          the permission to check
   */
  public boolean implies(Permission perm) {
    Permission p = (Permission) perms.get(perm);

    if ((p != null) && p.implies(perm)) {
      return true;
    }

    Enumeration permsEnum = elements();

View Full Code Here

       gp3 = new GrantPermission(new FooPermission()),
       gp4 = new GrantPermission("FooPermission; BarPermission"),
       gp5 = new GrantPermission("BarPermission");
      
  // sanity check
  if (!(gp1.equals(gp2) && gp1.implies(gp2) &&
        gp1.hashCode() == gp2.hashCode()))
  {
      throw new Error();
  }
  // unresolved FooPerm should imply resolved FooPerm
View Full Code Here

        gp1.hashCode() == gp2.hashCode()))
  {
      throw new Error();
  }
  // unresolved FooPerm should imply resolved FooPerm
  if (!gp1.implies(gp3)) {
      throw new Error();
  }
  // resolved FooPerm should not imply or equal unresolved FooPerm
  if (gp1.equals(gp3) || gp3.implies(gp1)) {
      throw new Error();
View Full Code Here

  // resolved FooPerm should not imply or equal unresolved FooPerm
  if (gp1.equals(gp3) || gp3.implies(gp1)) {
      throw new Error();
  }
  // original equality should still hold despite gp1 "inflation"
  if (!(gp1.equals(gp2) && gp1.implies(gp2) && gp2.implies(gp1) &&
        gp1.hashCode() == gp2.hashCode()))
  {
      throw new Error();
  }
  // unresolved FooPerm should not imply or equal unresolved FooPerm +
View Full Code Here

  {
      throw new Error();
  }
  // unresolved FooPerm should not imply or equal unresolved FooPerm +
  // unresolved BarPerm
  if (gp1.implies(gp4) || gp1.equals(gp4)) {
      throw new Error();
  }
  // ...but unresolved FooPerm, BarPerm should imply unresolved FooPerm
  if (!gp4.implies(gp1)) {
      throw new Error();
View Full Code Here

  // ...but unresolved FooPerm, BarPerm should imply unresolved FooPerm
  if (!gp4.implies(gp1)) {
      throw new Error();
  }
  // disjoint unresolved perms shouldn't imply or equal each other
  if (gp1.implies(gp5) || gp5.implies(gp1) || gp1.equals(gp5)) {
      throw new Error();
  }
  // sanity check
  if (!gp4.implies(gp5)) {
      throw new Error();
View Full Code Here

  }
  // test self implies(), equals()
  Permission[] gpa = { gp1, gp2, gp3, gp4, gp5 };
  for (int i = 0; i < gpa.length; i++) {
      Permission gp = gpa[i];
      if (!(gp.implies(gp) && gp.equals(gp))) {
    throw new Error();
      }
  }
    }
}
View Full Code Here

     
      int len = permissionTable.size();
      for(int i = 0; i < len ; i++)
      {
         Permission p = (Permission)permissionTable.get(i);
         if(p.implies(perm))
            return true;
      }
     
      return false;
   }
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.