java.security.AccessControlException类的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(225)

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

AccessControlException介绍

[英]AccessControlException is thrown if the access control infrastructure denies protected access due to missing permissions.
[中]如果访问控制基础结构由于缺少权限而拒绝受保护的访问,则引发AccessControlException。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public void checkPropertiesAccess() {
  throw new AccessControlException("Not Allowed");
}
@Override

代码示例来源:origin: spring-projects/spring-framework

@Override
  @Nullable
  protected String getSystemAttribute(String attributeName) {
    try {
      return System.getenv(attributeName);
    }
    catch (AccessControlException ex) {
      if (logger.isInfoEnabled()) {
        logger.info("Caught AccessControlException when accessing system environment variable '" +
            attributeName + "'; its value will be returned [null]. Reason: " + ex.getMessage());
      }
      return null;
    }
  }
};

代码示例来源:origin: groovy/groovy-core

protected void executeScript(Class scriptClass, Permission missingPermission) {
  try {
    Script script = InvokerHelper.createScript(scriptClass, new Binding());
    script.run();
    //InvokerHelper.runScript(scriptClass, null);
  } catch (AccessControlException ace) {
    if (missingPermission != null && missingPermission.implies(ace.getPermission())) {
      return;
    } else {
      fail(ace.toString());
    }
  }
  if (missingPermission != null) {
    fail("Should catch an AccessControlException");
  }
}

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

private static AccessControlException accessControlException(Exception e) {
 AccessControlException ace = new AccessControlException(e.getMessage());
 ace.initCause(e);
 return ace;
}

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

@Override
public final AccessControlException accessControlException(final Permission permission, final Permission permission_, final CodeSource codeSource, final ClassLoader classLoader) {
  final AccessControlException result = new AccessControlException(String.format(getLoggingLocale(), accessControlException$str(), permission_, codeSource, classLoader), permission);
  final StackTraceElement[] st = result.getStackTrace();
  result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
  return result;
}
private static final String secMgrChange = "WFSM000002: Security manager may not be changed";

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static Node copy(Node srcNode, Node destNode) {
  try {
    Session sess = srcNode.getSession();
    return copy(sess, srcNode.getPath(), destNode.getPath());
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to copy source node: " + srcNode + " to destination node: " + destNode, e);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static String getString(Node node, String name) {
  try {
    Property prop = node.getProperty(name);
    return prop.getString();
  } catch (PathNotFoundException e) {
    return null;
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to access property: " + name, e);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static Node getNode(Node parentNode, String name) {
  try {
    return parentNode.getNode(name);
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to retrieve the Node named " + name, e);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

/**
 * Assuming the specified property is a (WEAK)REFERENCE type, returns whether it is pointing at the specified node ID.
 */
public static boolean isReferencing(Node node, String refProp, String nodeId) {
  try {
    return node.getProperty(refProp).getNode().getIdentifier().equals(nodeId);
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to check reference property against node ID: " + nodeId, e);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static Node createNode(Node parentNode, String name, String nodeType) {
  try {
    return parentNode.addNode(name, nodeType);
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to create the Node named " + name, e);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static String getName(Node node) {
  try {
    return node.getName();
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Unable to get name of Node " + node, e);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

/**
 * Assuming the specified property is a (WEAK)REFERENCE type, returns whether it is pointing at the specified node.
 */
public static boolean isReferencing(Node node, String refProp, Node targetNode) {
  try {
    return node.getProperty(refProp).getNode().isSame(targetNode);
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to check reference property against node: " + node, e);
  }
}

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

throw new AccessControlException("No permission Project " + projectName
   + ".");
page.add("errorMsg", e.getMessage());

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static String getPath(Node node) {
  try {
    return node.getPath();
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Unable to get the Path", e);
  }
}

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

public void checkPermission(String key) {
  try {
    // Checking a random permission to check if it is server.
    if(isEmbeddedServer() || habitat == null
        || isACC() || isNotServerORACC()){
      return;
    }
    Permission perm = new RuntimePermission("SSLPassword");
    AccessController.checkPermission(perm);
  } catch (AccessControlException e) {
    String message = e.getMessage();
    Permission perm = new PropertyPermission(key, "read");
    if (message != null) {
      message = message.replace(e.getPermission().toString(), perm.toString());
    }
    throw new AccessControlException(message, perm);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static boolean hasProperty(Node node, String propName) {
  try {
    return node.hasProperty(propName);
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to test for property", e);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static boolean hasNode(Node parentNode, String name) {
  try {
    return parentNode.hasNode(name);
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to check for the existence of the node named " + name, e);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static void removeNode(Node node) {
  try {
    node.remove();
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to remove the node " + node, e);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static boolean isNodeType(Node node, String typeName) {
  try {
    return node.getPrimaryNodeType().isNodeType(typeName);
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to retrieve the type of node: " + node, e);
  }
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

public static Node getParent(Node node) {
  try {
    return node.getParent();
  } catch (AccessDeniedException e) {
    log.debug("Access denied", e);
    throw new AccessControlException(e.getMessage());
  } catch (RepositoryException e) {
    throw new MetadataRepositoryException("Failed to retrieve the parent of node: " + node, e);
  }
}

相关文章