loginUserFromVault with JavaScript

Description
dan7777777
Posts: 7
Joined: Wed May 17, 2017 5:08 pm

loginUserFromVault with JavaScript

Postby dan7777777 » Wed Nov 29, 2017 9:28 pm

Has anybody been able to achieve this?
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!

dan7777777
Posts: 7
Joined: Wed May 17, 2017 5:08 pm

Re: loginUserFromVault with JavaScript

Postby dan7777777 » Thu Nov 30, 2017 2:17 pm

Edit:
After adding try-catch blocks I get a more specific error:
java.lang.ArrayIndexOutOfBoundsException

Why would this be occurring?


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests