Codota Logo
PrivilegedAction.run
Code IndexAdd Codota to your IDE (free)

How to use
run
method
in
java.security.PrivilegedAction

Best Java code snippets using java.security.PrivilegedAction.run (Showing top 20 results out of 909)

Refine searchRefine arrow

  • AccessController.doPrivileged
  • Common ways to obtain PrivilegedAction
private void myMethod () {
PrivilegedAction p =
  • Codota IconInputStream stream;stream.close()
  • Codota IconProperties props;InputStream inStream;props.load(inStream)
  • Codota IconClassLoader cl;Thread.currentThread().setContextClassLoader(cl)
  • Smart code suggestions by Codota
}
origin: wildfly/wildfly

private static <T> T doPrivileged(PrivilegedAction<T> action) {
 if (System.getSecurityManager() != null) {
   return AccessController.doPrivileged(action);
 } else {
   return action.run();
 }
}
origin: javax.validation/validation-api

  private <P> P run(PrivilegedAction<P> action) {
    return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
  }
}
origin: org.apache.logging.log4j/log4j-api

/**
 * Gets the current Thread ClassLoader. Returns the system ClassLoader if the TCCL is {@code null}. If the system
 * ClassLoader is {@code null} as well, then the ClassLoader for this class is returned. If running with a
 * {@link SecurityManager} that does not allow access to the Thread ClassLoader or system ClassLoader, then the
 * ClassLoader for this class is returned.
 *
 * @return the current ThreadContextClassLoader.
 */
public static ClassLoader getThreadContextClassLoader() {
  if (GET_CLASS_LOADER_DISABLED) {
    // we can at least get this class's ClassLoader regardless of security context
    // however, if this is null, there's really no option left at this point
    return LoaderUtil.class.getClassLoader();
  }
  return SECURITY_MANAGER == null ? TCCL_GETTER.run() : AccessController.doPrivileged(TCCL_GETTER);
}
origin: hibernate/hibernate-orm

private static Method doPrivilegedAction(PrivilegedAction<Method> privilegedAction) {
  Class<?> callerClass = getCallerClass();
  if ( !authorizedClasses.contains( callerClass.getName() ) ) {
    throw new SecurityException( "Unauthorized call by class " + callerClass );
  }
  return System.getSecurityManager() != null ? AccessController.doPrivileged( privilegedAction ) :
    privilegedAction.run();
}
origin: hibernate/hibernate-orm

  private AttributeAccess buildAttributeAccess(final String attributeName) {
    final PrivilegedAction<AttributeAccess> action = new PrivilegedAction<AttributeAccess>() {
      @Override
      public AttributeAccess run() {
        for ( Class clazz : classHierarchy ) {
          try {
            final Field field = clazz.getDeclaredField( attributeName );
            if ( field != null ) {
              return new FieldAttributeAccess( field );
            }
          }
          catch ( NoSuchFieldException e ) {
            final Method method = getMethod( clazz, attributeName );
            if ( method != null ) {
              return new MethodAttributeAccess( attributeName, method );
            }
          }
        }
        //we could not find any match
        return new NoSuchAttributeAccess( specifiedClass, attributeName );
      }
    };
    return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
  }
}
origin: wildfly/wildfly

/**
 * Perform an action with permission checking enabled.  If permission checking is already enabled, the action is
 * simply run.
 *
 * @param action the action to perform
 * @param context the access control context to use
 * @param <T> the action return type
 * @return the return value of the action
 */
public static <T> T doChecked(PrivilegedAction<T> action, AccessControlContext context) {
  final Context ctx = CTX.get();
  if (ctx.checking) {
    return action.run();
  }
  ctx.checking = true;
  try {
    return AccessController.doPrivileged(action, context);
  } finally {
    ctx.checking = false;
  }
}
origin: wildfly/wildfly

static <T> T doPrivileged(final PrivilegedAction<T> action) {
  return WildFlySecurityManager.isChecking() ? AccessController.doPrivileged(action) : action.run();
}
origin: hibernate/hibernate-orm

return System.getSecurityManager() != null ? AccessController.doPrivileged( getCallerClassAction ) :
    getCallerClassAction.run();
origin: wildfly/wildfly

@Override
public Object processInvocation(final InterceptorContext context) throws Exception {
  // TODO - special cases need to be handled where SecurityContext not established or minimal unauthenticated principal context instead.
  String previousContextID = this.setContextID(this.policyContextID);
  if (WildFlySecurityManager.isChecking()) {
    doPrivileged(pushAction);
  } else {
    pushAction.run();
  }
  try {
    return context.proceed();
  } finally {
    this.setContextID(previousContextID);
    if (WildFlySecurityManager.isChecking()) {
      doPrivileged(popAction);
    } else {
      popAction.run();
    }
  }
}
origin: hibernate/hibernate-orm

private ProxyDefinitionHelpers() {
  this.groovyGetMetaClassFilter = isSynthetic().and( named( "getMetaClass" )
      .and( returns( td -> "groovy.lang.MetaClass".equals( td.getName() ) ) ) );
  this.virtualNotFinalizerFilter = isVirtual().and( not( isFinalizer() ) );
  this.hibernateGeneratedMethodFilter = nameStartsWith( "$$_hibernate_" ).and( isVirtual() );
  PrivilegedAction<MethodDelegation> delegateToInterceptorDispatcherMethodDelegationPrivilegedAction =
      new PrivilegedAction<MethodDelegation>() {
    @Override
    public MethodDelegation run() {
      return MethodDelegation.to( ProxyConfiguration.InterceptorDispatcher.class );
    }
  };
  this.delegateToInterceptorDispatcherMethodDelegation = System.getSecurityManager() != null
      ? AccessController.doPrivileged( delegateToInterceptorDispatcherMethodDelegationPrivilegedAction )
      : delegateToInterceptorDispatcherMethodDelegationPrivilegedAction.run();
  PrivilegedAction<FieldAccessor.PropertyConfigurable> interceptorFieldAccessorPrivilegedAction =
      new PrivilegedAction<FieldAccessor.PropertyConfigurable>() {
    @Override
    public FieldAccessor.PropertyConfigurable run() {
      return FieldAccessor.ofField( ProxyConfiguration.INTERCEPTOR_FIELD_NAME )
          .withAssigner( Assigner.DEFAULT, Assigner.Typing.DYNAMIC );
    }
  };
  this.interceptorFieldAccessor = System.getSecurityManager() != null
      ? AccessController.doPrivileged( interceptorFieldAccessorPrivilegedAction )
      : interceptorFieldAccessorPrivilegedAction.run();
}
origin: hibernate/hibernate-validator

  /**
   * Runs the given privileged action, using a privileged block if required.
   * <p>
   * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
   * privileged actions within HV's protection domain.
   */
  private static <T> T run(PrivilegedAction<T> action) {
    return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
  }
}
origin: hibernate/hibernate-validator

/**
 * Runs the given privileged action, using a privileged block if required.
 * <p>
 * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
 * privileged actions within HV's protection domain.
 */
private <T> T run(PrivilegedAction<T> action) {
  return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
}
origin: org.hibernate.validator/hibernate-validator

  /**
   * Runs the given privileged action, using a privileged block if required.
   * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
   * privileged actions within HV's protection domain.
   */
  private static <V> V run(PrivilegedAction<V> action) {
    return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
  }
}
origin: org.hibernate.validator/hibernate-validator

  /**
   * Runs the given privileged action, using a privileged block if required.
   * <p>
   * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
   * privileged actions within HV's protection domain.
   */
  private static <T> T run(PrivilegedAction<T> action) {
    return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
  }
}
origin: org.hibernate.validator/hibernate-validator

  /**
   * Runs the given privileged action, using a privileged block if required.
   *
   * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
   * privileged actions within HV's protection domain.
   */
  private static <T> T run(PrivilegedAction<T> action) {
    return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
  }
}
origin: org.hibernate.validator/hibernate-validator

  /**
   * Runs the given privileged action, using a privileged block if required.
   * <p>
   * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
   * privileged actions within HV's protection domain.
   */
  private static <T> T run(PrivilegedAction<T> action) {
    return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
  }
}
origin: org.hibernate.validator/hibernate-validator

/**
 * Runs the given privileged action, using a privileged block if required.
 * <p>
 * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
 * privileged actions within HV's protection domain.
 */
private <T> T run(PrivilegedAction<T> action) {
  return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
}
origin: org.hibernate.validator/hibernate-validator

  /**
   * Runs the given privileged action, using a privileged block if required.
   * <p>
   * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
   * privileged actions within HV's protection domain.
   */
  private static <T> T run(PrivilegedAction<T> action) {
    return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
  }
}
origin: org.hibernate.validator/hibernate-validator

/**
 * Runs the given privileged action, using a privileged block if required.
 *
 * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
 * privileged actions within HV's protection domain.
 */
private static <T> T run(PrivilegedAction<T> action) {
  return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
}
origin: org.hibernate.validator/hibernate-validator

  /**
   * Runs the given privileged action, using a privileged block if required.
   * <p>
   * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
   * privileged actions within HV's protection domain.
   */
  private static <T> T run(PrivilegedAction<T> action) {
    return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
  }
}
java.securityPrivilegedActionrun

Javadoc

Performs the computation. This method will be called by AccessController.doPrivileged after enabling privileges.

Popular methods of PrivilegedAction

  • <init>

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • IOException (java.io)
    Signals that an I/O exception of some sort has occurred. This class is the general class of exceptio
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now