org.wildfly.security.manager.WildFlySecurityManager.doChecked()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(93)

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

WildFlySecurityManager.doChecked介绍

[英]Perform an action with permission checking enabled. If permission checking is already enabled, the action is simply run.
[中]在启用权限检查的情况下执行操作。如果已启用权限检查,则只需运行该操作。

代码示例

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

@Override
public T readObject(ObjectInput input) throws IOException, ClassNotFoundException {
  PrivilegedExceptionAction<T> action = new PrivilegedExceptionAction<T>() {
    @Override
    public T run() throws InstantiationException, IllegalAccessException {
      return ExternalizableExternalizer.this.getTargetClass().newInstance();
    }
  };
  try {
    T object = WildFlySecurityManager.doChecked(action);
    object.readExternal(input);
    return object;
  } catch (PrivilegedActionException e) {
    throw new IOException(e.getCause());
  }
}

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

/**
 * Build this context factory.
 *
 * @return the context factory
 */
public DirContextFactory build() {
  assertNotBuilt();
  if (providerUrl == null) {
    throw log.noProviderUrlSet();
  }
  if(this.targetModule != null){
    if(WildFlySecurityManager.isChecking()){
      WildFlySecurityManager.doChecked(new GetModuleClassLoaderAction(this.targetModule));
    } else {
      this.targetClassLoader = this.targetModule.getClassLoader();
    }
  } else {
    if(WildFlySecurityManager.isChecking()){
      WildFlySecurityManager.getClassLoaderPrivileged(this.getClass());
    } else {
      this.targetClassLoader = this.getClass().getClassLoader();
    }
  }
  built = true;
  return new SimpleDirContextFactory();
}

代码示例来源:origin: org.jboss.invocation/jboss-invocation

public Object processInvocation(final InterceptorContext context) throws Exception {
    try {
      return WildFlySecurityManager.doChecked(context);
    } catch (PrivilegedActionException e) {
      throw e.getException();
    }
  }
}

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

WildFlySecurityManager.doChecked(privilegedAction, accessControlContext);

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

WildFlySecurityManager.doChecked(privilegedAction, accessControlContext);

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

WildFlySecurityManager.doChecked(privilegedAction, accessControlContext);

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

WildFlySecurityManager.doChecked(privilegedAction, accessControlContext);

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

WildFlySecurityManager.doChecked(privilegedAction, accessControlContext);

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

WildFlySecurityManager.doChecked(privilegedAction, accessControlContext);

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

WildFlySecurityManager.doChecked(privilegedAction, accessControlContext);

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

WildFlySecurityManager.doChecked(privilegedAction, accessControlContext);

代码示例来源:origin: org.jboss.eap/wildfly-clustering-marshalling-spi

@Override
public T readObject(ObjectInput input) throws IOException, ClassNotFoundException {
  PrivilegedExceptionAction<T> action = new PrivilegedExceptionAction<T>() {
    @Override
    public T run() throws InstantiationException, IllegalAccessException {
      return ExternalizableExternalizer.this.getTargetClass().newInstance();
    }
  };
  try {
    T object = WildFlySecurityManager.doChecked(action);
    object.readExternal(input);
    return object;
  } catch (PrivilegedActionException e) {
    throw new IOException(e.getCause());
  }
}

代码示例来源:origin: org.wildfly/wildfly-clustering-marshalling-spi

@Override
public T readObject(ObjectInput input) throws IOException, ClassNotFoundException {
  PrivilegedExceptionAction<T> action = new PrivilegedExceptionAction<T>() {
    @Override
    public T run() throws InstantiationException, IllegalAccessException {
      return ExternalizableExternalizer.this.getTargetClass().newInstance();
    }
  };
  try {
    T object = WildFlySecurityManager.doChecked(action);
    object.readExternal(input);
    return object;
  } catch (PrivilegedActionException e) {
    throw new IOException(e.getCause());
  }
}

代码示例来源:origin: org.infinispan.server/infinispan-server-jgroups

Introspector(org.jgroups.conf.ProtocolConfiguration config) {
  String name = config.getProtocolName();
  try {
    this.protocolClass = config.getClassLoader().loadClass(name).asSubclass(Protocol.class);
    PrivilegedAction<Void> action = () -> {
      Class<?> targetClass = Introspector.this.protocolClass;
      while (Protocol.class.isAssignableFrom(targetClass)) {
        for (Method method: targetClass.getDeclaredMethods()) {
          if (method.isAnnotationPresent(Property.class)) {
            String property = method.getAnnotation(Property.class).name();
            if (!property.isEmpty()) {
              Introspector.this.properties.add(property);
            }
          }
        }
        for (Field field: targetClass.getDeclaredFields()) {
          if (field.isAnnotationPresent(Property.class)) {
            String property = field.getAnnotation(Property.class).name();
            Introspector.this.properties.add(!property.isEmpty() ? property : field.getName());
          }
        }
        targetClass = targetClass.getSuperclass();
      }
      return null;
    };
    WildFlySecurityManager.doChecked(action);
  } catch (ClassNotFoundException e) {
    throw new IllegalArgumentException(e);
  }
}

代码示例来源:origin: org.infinispan.server/infinispan-server-jgroups

PrivilegedExceptionAction<TP> action = transportClass::newInstance;
try {
  stack.addAll(createProtocols(this.configuration, WildFlySecurityManager.doChecked(action).isMulticastCapable()));
} catch (PrivilegedActionException e) {
  throw new IllegalStateException(e.getCause());

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

/**
 * Build this context factory.
 *
 * @return the context factory
 */
public DirContextFactory build() {
  assertNotBuilt();
  if (providerUrl == null) {
    throw log.noProviderUrlSet();
  }
  if(this.targetModule != null){
    if(WildFlySecurityManager.isChecking()){
      WildFlySecurityManager.doChecked(new GetModuleClassLoaderAction(this.targetModule));
    } else {
      this.targetClassLoader = this.targetModule.getClassLoader();
    }
  } else {
    if(WildFlySecurityManager.isChecking()){
      WildFlySecurityManager.getClassLoaderPrivileged(this.getClass());
    } else {
      this.targetClassLoader = this.getClass().getClassLoader();
    }
  }
  built = true;
  return new SimpleDirContextFactory();
}

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

/**
 * Build this context factory.
 *
 * @return the context factory
 */
public DirContextFactory build() {
  assertNotBuilt();
  if (providerUrl == null) {
    throw log.noProviderUrlSet();
  }
  if(this.targetModule != null){
    if(WildFlySecurityManager.isChecking()){
      WildFlySecurityManager.doChecked(new GetModuleClassLoaderAction(this.targetModule));
    } else {
      this.targetClassLoader = this.targetModule.getClassLoader();
    }
  } else {
    if(WildFlySecurityManager.isChecking()){
      WildFlySecurityManager.getClassLoaderPrivileged(this.getClass());
    } else {
      this.targetClassLoader = this.getClass().getClassLoader();
    }
  }
  built = true;
  return new SimpleDirContextFactory();
}

代码示例来源:origin: org.infinispan.server/infinispan-server-jgroups

final JChannel channel = WildFlySecurityManager.doChecked(action);
ProtocolStack stack = channel.getProtocolStack();

相关文章

微信公众号

最新文章

更多