private Configuration setupTrustStoreForHadoop(KeyStore trustStore)
    throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException {
    Path tmpDirPath = Files.createTempDirectory("hbase_rest_client_truststore");
    File trustStoreFile = tmpDirPath.resolve("truststore.jks").toFile();
    // Shouldn't be needed with the secure temp dir, but let's generate a password anyway
    String password = Double.toString(Math.random());
    try (FileOutputStream fos = new FileOutputStream(trustStoreFile)) {
      trustStore.store(fos, password.toCharArray());
    }

    Configuration sslConf = new Configuration();
    // Type is the Java default, we use the same JVM to read this back
    sslConf.set("ssl.client.truststore.location", trustStoreFile.getAbsolutePath());
    sslConf.set("ssl.client.truststore.password", password);
    return sslConf;
  }
Initiate client side Kerberos negotiation with the server.
@param method method to inject the authentication token into.
@param uri    the String to parse as a URL.
@throws IOException if unknown protocol is found.
hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java