我想从管理员用户那里获得当前登录用户的上下文。为此,我使用管理员令牌来获取当前具有功能 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);
你有什么建议吗?
谢谢 !