java.lang.SecurityManager.getSecurityContext()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(126)

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

SecurityManager.getSecurityContext介绍

[英]Creates an object that encapsulates the current execution environment. The result of this method is used, for example, by the three-argument checkConnect method and by the two-argument checkRead method. These methods are needed because a trusted method may be called on to read a file or open a socket on behalf of another method. The trusted method needs to determine if the other (possibly untrusted) method would be allowed to perform the operation on its own.

The default implementation of this method is to return an AccessControlContext object.
[中]创建封装当前执行环境的对象。例如,此方法的结果由三参数checkConnect方法和两参数checkRead方法使用。之所以需要这些方法,是因为可能会调用受信任的方法来读取文件或代表另一个方法打开套接字。受信任的方法需要确定是否允许另一个(可能不受信任的)方法自己执行操作。
此方法的默认实现是返回AccessControlContext对象。

代码示例

代码示例来源:origin: frohoff/ysoserial

@Override
public Object getSecurityContext() {
  return getSecurityManager().getSecurityContext();
}

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

@Override
public Object getSecurityContext()
{
  return managerExists() ? securityManager.getSecurityContext() : super.getSecurityContext();
}

代码示例来源:origin: com.github.stefanbirkner/system-rules

@Override
public Object getSecurityContext() {
  return (originalSecurityManager == null) ? super.getSecurityContext()
    : originalSecurityManager.getSecurityContext();
}

代码示例来源:origin: stefanbirkner/system-rules

@Override
public Object getSecurityContext() {
  return (originalSecurityManager == null) ? super.getSecurityContext()
    : originalSecurityManager.getSecurityContext();
}

代码示例来源:origin: Nextdoor/bender

@Override
public Object getSecurityContext() {
  return (originalSecurityManager == null) ? super.getSecurityContext()
    : originalSecurityManager.getSecurityContext();
}

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

public Object getSecurityContext() {
  if (fSecurityManager != null) {
    return fSecurityManager.getSecurityContext();
  }
  return super.getSecurityContext();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.util

/**
 * Constructs a new SecureAction object. The constructed SecureAction object
 * uses the caller's AccessControlContext to perform security checks
 */
public SecurityUtil() {
  // save the control context to be used.
  SecurityManager sm = System.getSecurityManager();
  if (sm != null) {
    controlContext = sm.getSecurityContext();
  }
}

代码示例来源:origin: net.sf.jstuff/jstuff-core

@Override
public Object getSecurityContext() {
 if (wrapped == null)
   return super.getSecurityContext();
 return wrapped.getSecurityContext();
}

代码示例来源:origin: org.apache.servicemix.kernel/org.apache.servicemix.kernel.main

if (sm != null)
  acc = ((SecurityManager) sm).getSecurityContext();

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

if (sm != null)
  acc = ((SecurityManager) sm).getSecurityContext();

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

sm.checkPermission(null, sm.getSecurityContext());

相关文章