我想从管理员用户那里获得当前登录用户的上下文。 为此,我使用管理令牌使当前的一个具有impersonateUser()函数,因为我没有用户的密码。
当我在Authentication对象上调用impersonateUser()时出现以下错误: javax.xml.ws.soap.SOAPFaultException:需要OTDS用户名和密码。
这是我的例子:
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);
我还发现了一个ImpersonateUser类,但我不知道如何使用它:
ImpersonateUser impUser = new ImpersonateUser();
impUser.setUserName(newUser);
你有什么建议吗?
谢谢!