java.security.Permissions.implies()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中java.security.Permissions.implies()方法的一些代码示例,展示了Permissions.implies()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Permissions.implies()方法的具体详情如下:
包路径:java.security.Permissions
类名称:Permissions
方法名:implies

Permissions.implies介绍

[英]Checks to see if this object's PermissionCollection for permissions of the specified permission's type implies the permissions expressed in the permission object. Returns true if the combination of permissions in the appropriate PermissionCollection (e.g., a FilePermissionCollection for a FilePermission) together imply the specified permission.

For example, suppose there is a FilePermissionCollection in this Permissions object, and it contains one FilePermission that specifies "read" access for all files in all subdirectories of the "/tmp" directory, and another FilePermission that specifies "write" access for all files in the "/tmp/scratch/foo" directory. Then if the implies method is called with a permission specifying both "read" and "write" access to files in the "/tmp/scratch/foo" directory, true is returned.

Additionally, if this PermissionCollection contains the AllPermission, this method will always return true.
[中]检查此对象指定权限类型的权限的PermissionCollection是否表示权限对象中表达的权限。如果相应PermissionCollection中的权限组合(例如,FilePermissionCollection中的FilePermission)一起暗示指定的权限,则返回true。
例如,假设此权限对象中有一个FilePermissionCollection,其中一个FilePermission指定“/tmp”目录所有子目录中所有文件的“读取”访问权限,另一个FilePermission指定“/tmp/scratch/foo”目录中所有文件的“写入”访问权限。然后,如果使用指定对“/tmp/scratch/foo”目录中文件的“读取”和“写入”访问权限的权限调用implies方法,则返回true
此外,如果此PermissionCollection包含AllPermission,则此方法将始终返回true。

代码示例

代码示例来源:origin: apache/geode

@Override
public boolean implies(ProtectionDomain pd, Permission p) {
 return perms.implies(p);
}

代码示例来源:origin: google/guava

public boolean implies(ProtectionDomain pd, Permission p) {
 return perms.implies(p);
}

代码示例来源:origin: ben-manes/caffeine

@Override
public boolean implies(ProtectionDomain pd, Permission p) {
  return perms.implies(p);
}
@Override

代码示例来源:origin: jankotek/mapdb

public boolean implies(ProtectionDomain pd, Permission p) {
  return perms.implies(p);
}
public void refresh() {}

代码示例来源:origin: wildfly/wildfly

private boolean impliesUncheckedPermission(Permission permission, ElytronPolicyConfiguration policyConfiguration) {
  Permissions uncheckedPermissions = policyConfiguration.getUncheckedPermissions();
  synchronized (uncheckedPermissions) {
    return uncheckedPermissions.implies(permission);
  }
}

代码示例来源:origin: wildfly/wildfly

private boolean impliesExcludedPermission(Permission permission, ElytronPolicyConfiguration policyConfiguration) {
  Permissions excludedPermissions = policyConfiguration.getExcludedPermissions();
  synchronized (excludedPermissions) {
    return excludedPermissions.implies(permission);
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * The central point in checking permissions.
 * Overridden from java.lang.SecurityManager
 *
 * @param perm The permission requested.
 */
@Override
public void checkPermission(final java.security.Permission perm) {
  if (active) {
    if (delegateToOldSM && !perm.getName().equals("exitVM")) {
      boolean permOK = false;
      if (granted.implies(perm)) {
        permOK = true;
      }
      checkRevoked(perm);
      /*
       if the permission was not explicitly granted or revoked
       the original security manager will do its work
      */
      if (!permOK && origSm != null) {
        origSm.checkPermission(perm);
      }
    }  else {
      if (!granted.implies(perm)) {
        throw new SecurityException("Permission " + perm + " was not granted.");
      }
      checkRevoked(perm);
    }
  }
}

代码示例来源:origin: wildfly/wildfly

private boolean impliesRolePermission(ProtectionDomain domain, Permission permission, ElytronPolicyConfiguration policyConfiguration) throws PolicyContextException, ClassNotFoundException {
  Set<String> roles = new HashSet<>();
  // keep JACC behavior where roles are obtained as Principal instances from a ProtectionDomain
  extractRolesFromProtectionDomain(domain, roles);
  // obtain additional roles from the current authenticated identity.
  // in this case the a RoleMapper will be used to map roles from the authenticated identity
  extractRolesFromCurrentIdentity(roles);
  roles.add(ANY_AUTHENTICATED_USER_ROLE);
  Map<String, Permissions> rolePermissions = policyConfiguration.getRolePermissions();
  synchronized (rolePermissions) {
    for (String roleName : roles) {
      Permissions permissions = rolePermissions.get(roleName);
      if (permissions != null) {
        if (permissions.implies(permission)) {
          return true;
        }
      }
    }
  }
  return false;
}

代码示例来源:origin: org.glassfish.main.security/security-ee

private boolean checkLoadedCache(Permission p, Epoch e) {
if (e == null) {
  return cache.implies(p);
} else {
  if (e.epoch != epoch) {
  e.granted = cache.implies(p);
  e.epoch = epoch;
  }
  return e.granted;
}
}

代码示例来源:origin: org.glassfish.main.security/inmemory.jacc.provider

boolean implies(Permission p) {
  boolean rvalue = false;
  if (permissions != null) {
    rvalue = permissions.implies(p);
  }
  return rvalue;
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

private boolean impliesUncheckedPermission(Permission permission, ElytronPolicyConfiguration policyConfiguration) {
  Permissions uncheckedPermissions = policyConfiguration.getUncheckedPermissions();
  synchronized (uncheckedPermissions) {
    return uncheckedPermissions.implies(permission);
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

private boolean impliesExcludedPermission(Permission permission, ElytronPolicyConfiguration policyConfiguration) {
  Permissions excludedPermissions = policyConfiguration.getExcludedPermissions();
  synchronized (excludedPermissions) {
    return excludedPermissions.implies(permission);
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

private boolean impliesUncheckedPermission(Permission permission, ElytronPolicyConfiguration policyConfiguration) {
  Permissions uncheckedPermissions = policyConfiguration.getUncheckedPermissions();
  synchronized (uncheckedPermissions) {
    return uncheckedPermissions.implies(permission);
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-jacc

private boolean impliesExcludedPermission(Permission permission, ElytronPolicyConfiguration policyConfiguration) {
  Permissions excludedPermissions = policyConfiguration.getExcludedPermissions();
  synchronized (excludedPermissions) {
    return excludedPermissions.implies(permission);
  }
}

代码示例来源:origin: org.knopflerfish/framework

/**
 *
 */
@Override
public boolean implies(final Permission permission) {
 if (unresolved != 0) {
  resolve();
 }
 return pc.implies(permission);
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-jacc

private boolean impliesUncheckedPermission(Permission permission, ElytronPolicyConfiguration policyConfiguration) {
  Permissions uncheckedPermissions = policyConfiguration.getUncheckedPermissions();
  synchronized (uncheckedPermissions) {
    return uncheckedPermissions.implies(permission);
  }
}

代码示例来源:origin: org.eclipse/osgi

public boolean implies(Permission permission) {
  // first check implied permissions
  if ((impliedPermissions != null) && impliedPermissions.implies(permission))
    return true;
  // Now check implied permissions added by weaving hooks.
  if (wovenPermissions.implies(permission))
    return true;
  // We must be allowed by the restricted permissions to have any hope of passing the check
  if ((restrictedPermissions != null) && !restrictedPermissions.implies(permission))
    return false;
  return securityAdmin.checkPermission(permission, this);
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.osgi

public boolean implies(Permission permission) {
  // first check implied permissions
  if ((impliedPermissions != null) && impliedPermissions.implies(permission))
    return true;
  // Now check implied permissions added by weaving hooks.
  if (wovenPermissions.implies(permission))
    return true;
  // We must be allowed by the restricted permissions to have any hope of passing the check
  if ((restrictedPermissions != null) && !restrictedPermissions.implies(permission))
    return false;
  return securityAdmin.checkPermission(permission, this);
}

代码示例来源:origin: com.github.veithen.cosmos/cosmos-equinox

public boolean implies(Permission permission) {
  // first check implied permissions
  if ((impliedPermissions != null) && impliedPermissions.implies(permission))
    return true;
  // Now check implied permissions added by weaving hooks.
  if (wovenPermissions.implies(permission))
    return true;
  // We must be allowed by the restricted permissions to have any hope of passing the check
  if ((restrictedPermissions != null) && !restrictedPermissions.implies(permission))
    return false;
  return securityAdmin.checkPermission(permission, this);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.osgi

public boolean implies(Permission permission) {
  // first check implied permissions
  if ((impliedPermissions != null) && impliedPermissions.implies(permission))
    return true;
  // Now check implied permissions added by weaving hooks.
  if (wovenPermissions.implies(permission))
    return true;
  // We must be allowed by the restricted permissions to have any hope of passing the check
  if ((restrictedPermissions != null) && !restrictedPermissions.implies(permission))
    return false;
  return securityAdmin.checkPermission(permission, this);
}

相关文章