When running on Windows, changing the current user is called impersionation. There are various ways to do this in Windows, including WindowsIdentity.Impersonate on .NET (e.g. when using C#, VB.et net or Delphi Prism) which requires P/Invoke of LogonUser, CloseHandle and sometimes*DuplicateToken as ...
More...