OpenText LiveLink : How can use ImpersonateUser function?

790 Views Asked by At

I'd like to have from an admin user the context of the current loggin user. For that, I use the admin token to have the current one with the function impersonateUser() because I don't have the password of the user.

I have the following error when I call the impersonateUser() on the Authentication object : javax.xml.ws.soap.SOAPFaultException: OTDS username and password are required.

Here my example :

URL authLocation = new URL("http://localhost:8080/les-services/services/Authentication?wsdl");
String aToken = WebServiceUtil.getAuthenticationToken(authLocation, username, password);//admin token
OTAuthentication fOTAuth = new OTAuthentication();
fOTAuth.setAuthenticationToken(aToken);
com.opentext.livelink.service.core.Authentication auth = webServiceUtil.getAuthenticationService(authLocation);             
String token = auth.impersonateUser(newUser);
fOTAuth.setAuthenticationToken(token);

I also found a class ImpersonateUser but I don't know how to use it :

ImpersonateUser impUser = new ImpersonateUser();
impUser.setUserName(newUser);

Do you have any advice ?

Thanks !

1

There are 1 best solutions below

1
On

Here are the docs for the ImpersonateUser() method.