private HttpUriRequest createAuthenticationRequest() { final Map<String, String> parameters = new HashMap<>(); parameters.put("username", username); parameters.put("password", password); return HttpUriRequestBuilder.create() .method(HttpMethods.POST) .methodParameters(parameters) .path(loginUrl) .build(); }