private void addBasicAuthHeaders(HashMap<String, String> headers) {
    String authString = username + ":" + password;
    byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
    String authStringEnc = new String(authEncBytes);

    headers.put("Authorization", "Basic " + authStringEnc);
  }
Provider of an input stream for a request to the Remote Ambari server.
ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariStreamProvider.java