List of usage examples for io.vertx.core.net PemKeyCertOptions toJson
public JsonObject toJson()
From source file:examples.ConfigVaultExamples.java
License:Apache License
public void example1WithConfig(Vertx vertx) { JsonObject vault_config = new JsonObject().put("host", "127.0.0.1") // The host name .put("port", 8200) // The port .put("ssl", true); // Whether or not SSL is used (disabled by default) // Certificates PemKeyCertOptions certs = new PemKeyCertOptions().addCertPath("target/vault/config/ssl/client-cert.pem") .addKeyPath("target/vault/config/ssl/client-privatekey.pem"); vault_config.put("pemKeyCertOptions", certs.toJson()); // Truststore JksOptions jks = new JksOptions().setPath("target/vault/config/ssl/truststore.jks"); vault_config.put("trustStoreOptions", jks.toJson()); // Path to the secret to read. vault_config.put("path", "secret/my-secret"); ConfigStoreOptions store = new ConfigStoreOptions().setType("vault").setConfig(vault_config); ConfigRetriever retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(store)); }
From source file:examples.ConfigVaultExamples.java
License:Apache License
public void exampleWithCerts(Vertx vertx) { JsonObject vault_config = new JsonObject(); // .../* w w w .ja v a2 s . c o m*/ PemKeyCertOptions certs = new PemKeyCertOptions().addCertPath("target/vault/config/ssl/client-cert.pem") .addKeyPath("target/vault/config/ssl/client-privatekey.pem"); vault_config.put("pemKeyCertOptions", certs.toJson()); PemTrustOptions trust = new PemTrustOptions().addCertPath("target/vault/config/ssl/cert.pem"); vault_config.put("pemTrustStoreOptions", trust.toJson()); JksOptions jks = new JksOptions().setPath("target/vault/config/ssl/truststore.jks"); vault_config.put("trustStoreOptions", jks.toJson()); vault_config.put("auth-backend", "cert"); // Path to the secret to read. vault_config.put("path", "secret/my-secret"); ConfigStoreOptions store = new ConfigStoreOptions().setType("vault").setConfig(vault_config); ConfigRetriever retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(store)); }