Languages like C++ and C# allow one to spawn a thread and set the user principal for that thread. Essentially, one can run the new thread as a user that is different from the user that created the thread.
Java does not support for this.
I assume something like this can be done with Java using JNI? If so, can anyone provide an example.
NOTE: Solutions like Windows runas or PSTools psexec can allow you to impersonate process from java, but are insecure. I am not looking for these types of solutions.