code: public static void pushRunAsIdentity(final RunAsIdentity principal) {
          AccessController.doPrivileged(new PrivilegedAction<Void>() {
  
              @Override
              public Void run() {
                  SecurityContext sc = getSecurityContext();
                  if (sc == null)
                      throw MESSAGES.noSecurityContext();
                  sc.setOutgoingRunAs(principal);
                  return null;
              }
          });
      }
docs: Sets the run as identity
  
  @param principal the identity