Given the following code:
String newToken = changeUser("someUser", token);
fOTAuth = new OTAuthentication();
fOTAuth.setAuthenticationToken( newToken );
Why do we get the first user as the one who executes actions, and not the impersonificated one?
Is there something that we are missing?
_________________________________________________________
public String changeUser(String userName, String token)
{
String serviceURL = "http://ETC:8080/les-services/services/Authentication";
String username = userName;
String newToken = null;
try
{
newToken = WebServiceUtil.getImpersonateUser(new URL( WebServiceUtil.getServiceLocation( serviceURL, "Authentication" ) ), token, username);
}
catch ( Exception ex )
{
System.out.println( ex.getMessage() + "Error" );
}
return newToken;
}
_________________________________________________
public static String getImpersonateUser( URL location, String token, String userName) //added
throws Exception
{
Authentication endpoint = getAuthenticationService( location );
setSoapHeader( (WSBindingProvider) endpoint, token );
return endpoint.impersonateUser(userName);
}