2-Legged oAuth as another user


I’m trying to send a post request to Jira using 2-Legged OAuth, but I don’t know where to put the username to be impersonated

private JSONObject handlePostRequest(PropertiesCall arguments) {
Map<String, String> properties = propertiesClient.getPropertiesOrDefaults();
String url = properties.get(JIRA_HOME) + arguments.getApi();
try {
OAuthParameters parameters = this.getOAuthParameters();
HttpResponse response = sendResponsePostFromUrl(parameters, new GenericUrl(url), arguments);
return parseResponse(response);
} catch (HttpResponseException e) {
return new JSONObject(e.getContent());
} catch (Exception e) {
return null;

private static HttpResponse sendResponsePostFromUrl(OAuthParameters parameters, GenericUrl jiraUrl,
PropertiesCall arguments) throws IOException {
HttpRequestFactory requestFactory = new NetHttpTransport().createRequestFactory(parameters);
HttpRequest request = requestFactory.buildPostRequest(jiraUrl,
ByteArrayContent.fromString(“application/json”, arguments.getParametros()));
return request.execute();