本文整理了Java中java.security.Permissions.add()
方法的一些代码示例,展示了Permissions.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Permissions.add()
方法的具体详情如下:
包路径:java.security.Permissions
类名称:Permissions
方法名:add
[英]Adds a permission object to the PermissionCollection for the class the permission belongs to. For example, if permission is a FilePermission, it is added to the FilePermissionCollection stored in this Permissions object. This method creates a new PermissionCollection object (and adds the permission to it) if an appropriate collection does not yet exist.
[中]将权限对象添加到该权限所属类的PermissionCollection中。例如,如果权限是FilePermission,则会将其添加到存储在此Permissions对象中的FilePermissionCollection中。如果适当的集合尚不存在,此方法将创建一个新的PermissionCollection对象(并向其添加权限)。
代码示例来源:origin: apache/geode
void addPermission(Permission perm) {
perms.add(perm);
}
代码示例来源:origin: google/guava
void addPermission(Permission perm) {
perms.add(perm);
}
代码示例来源:origin: google/guava
AdjustablePolicy(Permission... permissions) {
for (Permission permission : permissions) perms.add(permission);
}
代码示例来源:origin: ben-manes/caffeine
AdjustablePolicy(Permission... permissions) {
for (Permission permission : permissions) {
perms.add(permission);
}
}
void addPermission(Permission perm) { perms.add(perm); }
代码示例来源:origin: jankotek/mapdb
AdjustablePolicy(Permission... permissions) {
for (Permission permission : permissions)
perms.add(permission);
}
void addPermission(Permission perm) { perms.add(perm); }
代码示例来源:origin: ben-manes/caffeine
void addPermission(Permission perm) { perms.add(perm); }
void clearPermissions() { perms = new Permissions(); }
代码示例来源:origin: jankotek/mapdb
void addPermission(Permission perm) { perms.add(perm); }
void clearPermissions() { perms = new Permissions(); }
代码示例来源:origin: wildfly/wildfly
@Override
public void addToExcludedPolicy(Permission permission) throws PolicyContextException {
checkNotNullParam("permission", permission);
synchronized (this) { // prevents state change while adding
checkIfInOpenState();
this.excludedPermissions.add(permission);
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public void addToUncheckedPolicy(Permission permission) throws PolicyContextException {
checkNotNullParam("permission", permission);
synchronized (this) { // prevents state change while adding
checkIfInOpenState();
this.uncheckedPermissions.add(permission);
}
}
代码示例来源:origin: org.apache.ant/ant
} else {
final java.security.Permission perm = createPermission(p);
granted.add(perm);
granted.add(new SocketPermission("localhost:1024-", "listen"));
granted.add(new PropertyPermission("java.version", "read"));
granted.add(new PropertyPermission("java.vendor", "read"));
granted.add(new PropertyPermission("java.vendor.url", "read"));
granted.add(new PropertyPermission("java.class.version", "read"));
granted.add(new PropertyPermission("os.name", "read"));
granted.add(new PropertyPermission("os.version", "read"));
granted.add(new PropertyPermission("os.arch", "read"));
granted.add(new PropertyPermission("file.encoding", "read"));
granted.add(new PropertyPermission("file.separator", "read"));
granted.add(new PropertyPermission("path.separator", "read"));
granted.add(new PropertyPermission("line.separator", "read"));
granted.add(new PropertyPermission("java.specification.version", "read"));
granted.add(new PropertyPermission("java.specification.vendor", "read"));
granted.add(new PropertyPermission("java.specification.name", "read"));
granted.add(new PropertyPermission("java.vm.specification.version", "read"));
granted.add(new PropertyPermission("java.vm.specification.vendor", "read"));
granted.add(new PropertyPermission("java.vm.specification.name", "read"));
granted.add(new PropertyPermission("java.vm.version", "read"));
granted.add(new PropertyPermission("java.vm.vendor", "read"));
granted.add(new PropertyPermission("java.vm.name", "read"));
代码示例来源:origin: wildfly/wildfly
@Override
public void addToRole(String roleName, Permission permission) throws PolicyContextException {
checkNotNullParam("roleName", roleName);
checkNotNullParam("permission", permission);
synchronized (this) { // prevents state change while adding
checkIfInOpenState();
this.rolePermissions.computeIfAbsent(roleName, s -> new Permissions()).add(permission);
}
}
代码示例来源:origin: dlew/joda-time-android
public PermissionCollection getPermissions(CodeSource codesource) {
Permissions p = new Permissions();
p.add(new AllPermission()); // enable everything
return p;
}
public void refresh() {
代码示例来源:origin: dlew/joda-time-android
public PermissionCollection getPermissions(CodeSource codesource) {
Permissions p = new Permissions();
p.add(new AllPermission()); // enable everything
return p;
}
public void refresh() {
代码示例来源:origin: spring-projects/spring-framework
perms.add(new AuthPermission("getSubject"));
ProtectionDomain pd = new ProtectionDomain(null, perms);
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Add dynamic {@link SocketPermission} for the specified port range.
*
* @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission} to.
* @param portRange the port range
*/
private static void addSocketPermissionForPortRange(final Permissions policy, final String portRange) {
// listen is always called with 'localhost' but use wildcard to be sure, no name service is consulted.
// see SocketPermission implies() code
policy.add(new SocketPermission("*:" + portRange, "listen,resolve"));
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Add access to single file path
* @param policy current policy to add permissions to
* @param path the path itself
* @param permissions set of file permissions to grant to the path
*/
@SuppressForbidden(reason = "only place where creating Java-9 compatible FilePermission objects is possible")
public static void addSingleFilePath(Permissions policy, Path path, String permissions) throws IOException {
policy.add(new FilePermission(path.toString(), permissions));
if (VERSION_IS_AT_LEAST_JAVA_9 && Files.exists(path)) {
// Java 9 FilePermission model requires this due to the removal of pathname canonicalization,
// see also https://github.com/elastic/elasticsearch/issues/21534
Path realPath = path.toRealPath();
if (path.toString().equals(realPath.toString()) == false) {
policy.add(new FilePermission(realPath.toString(), permissions));
}
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
policy.add(new FilePermission(path.toString(), permissions));
policy.add(new FilePermission(path.toString() + path.getFileSystem().getSeparator() + "-", permissions));
if (VERSION_IS_AT_LEAST_JAVA_9) {
policy.add(new FilePermission(realPath.toString(), permissions));
policy.add(new FilePermission(realPath.toString() + realPath.getFileSystem().getSeparator() + "-", permissions));
代码示例来源:origin: org.picketbox/picketbox
void addToExcludedPolicy(Permission permission)
throws PolicyContextException
{
excludedPermissions.add(permission);
}
代码示例来源:origin: org.picketbox/picketbox
void addToRole(String roleName, Permission permission)
throws PolicyContextException
{
Permissions perms = rolePermissions.get(roleName);
if( perms == null )
{
perms = new Permissions();
rolePermissions.put(roleName, perms);
}
perms.add(permission);
}
代码示例来源:origin: org.jboss.modules/jboss-modules
private static PermissionCollection copyPermissions(PermissionCollection permissionCollection) {
final Permissions permissions = new Permissions();
final Enumeration<Permission> elements = permissionCollection.elements();
while (elements.hasMoreElements()) {
permissions.add(elements.nextElement());
}
permissions.setReadOnly();
return permissions;
}
内容来源于网络,如有侵权,请联系作者删除!