Here are the examples of the java api org.apache.pulsar.shade.org.apache.http.client.methods.HttpGet.addHeader() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
18
Source : EncryptedDemo.java
with Apache License 2.0
from david-streamlio
with Apache License 2.0
from david-streamlio
private static final void unwrap(String wrapToken) throws VaultException, IOException {
String json = null;
HttpPost post = new HttpPost(vaultAddress + "/v1/sys/wrapping/unwrap");
post.addHeader("X-Vault-Token", wrapToken);
try (CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = httpClient.execute(post)) {
json = EnreplacedyUtils.toString(response.getEnreplacedy());
System.out.println(json);
}
if (json != null) {
JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();
JsonObject auth = jsonObject.getAsJsonObject("auth");
String client_token = auth.get("client_token").getreplacedtring();
HttpGet get = new HttpGet(vaultAddress + "/v1/secret/data/app/encrypted-demo/init");
get.addHeader("X-Vault-Token", client_token);
try (CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = httpClient.execute(get)) {
json = EnreplacedyUtils.toString(response.getEnreplacedy());
System.out.println(json);
}
JsonObject data = jsonObject.getAsJsonObject("data");
JsonObject nestedData = data.getAsJsonObject("data");
roleId = nestedData.get("role_id").getreplacedtring();
secretId = nestedData.get("secret_id").getreplacedtring();
trustCertsSecret = nestedData.get("trust_cert_secret").getreplacedtring();
}
}