I would like to use this for a doAsUser method, but I'm not able to get the subject object. Whenever I try to use the method, I get this error on my browser console:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
This is my code:
Code: Select all
var subject = securityService.loginUserFromVault("vaultKey", "test");
var JavaPackage = new JavaImporter(java.security.PrivilegedAction);
with(JavaPackage){securityService.doAsUser(subject , new PrivilegedAction(){
run: function() {
try{
securityService.addContextRoleToUser(userId, role, contextId);
}catch(e){
}
}
});
}
Any information would be amazing!