container-common/src/main/java/com/streamsets/datacollector/security/SecurityUtil.java
public static <T> T doAs(
      Subject subject,
      PrivilegedExceptionAction<T> privilegedExceptionAction
  ) throws PrivilegedActionException {
    checkDoAsPermission();
    if (privilegedExceptionAction == null) {
      throw new RuntimeException("No privileged exception action provided");
    }

    return AccessController.doPrivileged(privilegedExceptionAction,
        createContext(subject, AccessController.getContext())
    );
  }
public static <T> T doAs(
      Subject subject,
      PrivilegedExceptionAction<T> privilegedExceptionAction
  ) throws PrivilegedActionException {
    checkDoAsPermission();
    if (privilegedExceptionAction == null) {
      throw new RuntimeException("No privileged exception action provided");
    }

    return AccessController.doPrivileged(privilegedExceptionAction,
        createContext(subject, AccessController.getContext())
    );
  }
Influenced by javax.security.auth.Subject.#doAs