Porting loginAs feature on JSPUI