From de17f48be25a01b9b9a6dc10c399f1431c6d177e Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Fri, 11 Jun 2021 21:15:49 +0200 Subject: [PATCH 1/6] move builder into main package, introduce new invocation method (#51) The builder is target of major refactoring in the 1.0 development branch so we introduce some delegate classes and methods to prepare migration. --- CHANGELOG.md | 9 + README.md | 8 +- pom.xml | 2 +- .../jvault/connector/HTTPVaultConnector.java | 10 + .../connector/HTTPVaultConnectorBuilder.java | 299 ++++++++++++++++++ .../builder/HTTPVaultConnectorBuilder.java | 276 +--------------- .../builder/VaultConnectorBuilder.java | 3 + .../factory/HTTPVaultConnectorFactory.java | 2 +- .../connector/HTTPVaultConnectorTest.java | 1 - .../HTTPVaultConnectorBuilderTest.java | 10 +- 10 files changed, 337 insertions(+), 283 deletions(-) create mode 100644 src/main/java/de/stklcode/jvault/connector/HTTPVaultConnectorBuilder.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 48d44d2..029cf95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## 0.9.5 (unreleased) + +### Deprecations +* Deprecated builder invocation `VaultConnectorBuilder.http()` in favor of `HTTPVaultConnector.builder()`. +* Deprecated `de.stklcode.jvault.connector.builder.HTTPVaultConnectorBuilder` in favor of `de.stklcode.jvault.connector.HTTPVaultConnectorBuilder` (only package changed). + +Old builders will be removed in 1.0 + + ## 0.9.4 (2021-06-06) ### Deprecations diff --git a/README.md b/README.md index edd7a12..dbfb8fe 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Java Vault Connector is a connector library for [Vault](https://www.vaultproject de.stklcode.jvault jvault-connector - 0.9.4 + 0.9.5-SNAPSHOT ``` @@ -50,21 +50,21 @@ Java Vault Connector is a connector library for [Vault](https://www.vaultproject ```java // Instantiate using builder pattern style factory (TLS enabled by default) -VaultConnector vault = VaultConnectorBuilder.http() +VaultConnector vault = HTTPVaultConnector.builder() .withHost("127.0.0.1") .withPort(8200) .withTLS() .build(); // Instantiate with custom SSL context -VaultConnector vault = VaultConnectorBuilder.http() +VaultConnector vault = HTTPVaultConnector.builder() .withHost("example.com") .withPort(8200) .withTrustedCA(Paths.get("/path/to/CA.pem")) .build(); // Initialization from environment variables -VaultConnector vault = VaultConnectorBuilder.http() +VaultConnector vault = HTTPVaultConnector.builder() .fromEnv() .build(); ``` diff --git a/pom.xml b/pom.xml index f0d8b57..7dc2b6f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ de.stklcode.jvault jvault-connector - 0.9.4 + 0.9.5-SNAPSHOT jar diff --git a/src/main/java/de/stklcode/jvault/connector/HTTPVaultConnector.java b/src/main/java/de/stklcode/jvault/connector/HTTPVaultConnector.java index c01de36..2674341 100644 --- a/src/main/java/de/stklcode/jvault/connector/HTTPVaultConnector.java +++ b/src/main/java/de/stklcode/jvault/connector/HTTPVaultConnector.java @@ -71,6 +71,16 @@ public class HTTPVaultConnector implements VaultConnector { private String token; // Current token. private long tokenTTL = 0; // Expiration time for current token. + /** + * Get a new builder for a connector. + * + * @return Builder instance. + * @since 0.9.5 + */ + public static HTTPVaultConnectorBuilder builder() { + return new HTTPVaultConnectorBuilder(); + } + /** * Create connector using hostname and schema. * diff --git a/src/main/java/de/stklcode/jvault/connector/HTTPVaultConnectorBuilder.java b/src/main/java/de/stklcode/jvault/connector/HTTPVaultConnectorBuilder.java new file mode 100644 index 0000000..439a03a --- /dev/null +++ b/src/main/java/de/stklcode/jvault/connector/HTTPVaultConnectorBuilder.java @@ -0,0 +1,299 @@ +/* + * Copyright 2016-2021 Stefan Kalscheuer + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.stklcode.jvault.connector; + +import de.stklcode.jvault.connector.builder.VaultConnectorBuilder; +import de.stklcode.jvault.connector.exception.ConnectionException; +import de.stklcode.jvault.connector.exception.TlsException; +import de.stklcode.jvault.connector.exception.VaultConnectorException; + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; + +/** + * Vault Connector Builder implementation for HTTP Vault connectors. + * + * @author Stefan Kalscheuer + * @since 0.8.0 + * @since 0.9.5 Package {@link de.stklcode.jvault.connector} + */ +public class HTTPVaultConnectorBuilder implements VaultConnectorBuilder { + private static final String ENV_VAULT_ADDR = "VAULT_ADDR"; + private static final String ENV_VAULT_CACERT = "VAULT_CACERT"; + private static final String ENV_VAULT_TOKEN = "VAULT_TOKEN"; + private static final String ENV_VAULT_MAX_RETRIES = "VAULT_MAX_RETRIES"; + + public static final String DEFAULT_HOST = "127.0.0.1"; + public static final Integer DEFAULT_PORT = 8200; + public static final boolean DEFAULT_TLS = true; + public static final String DEFAULT_TLS_VERSION = "TLSv1.2"; + public static final String DEFAULT_PREFIX = "/v1/"; + public static final int DEFAULT_NUMBER_OF_RETRIES = 0; + + private String host; + private Integer port; + private boolean tls; + private String tlsVersion; + private String prefix; + private X509Certificate trustedCA; + private int numberOfRetries; + private Integer timeout; + private String token; + + /** + * Default empty constructor. + * Initializes factory with default values. + */ + public HTTPVaultConnectorBuilder() { + host = DEFAULT_HOST; + port = DEFAULT_PORT; + tls = DEFAULT_TLS; + tlsVersion = DEFAULT_TLS_VERSION; + prefix = DEFAULT_PREFIX; + numberOfRetries = DEFAULT_NUMBER_OF_RETRIES; + } + + /** + * Set hostname (default: 127.0.0.1). + * + * @param host Hostname or IP address + * @return self + */ + public HTTPVaultConnectorBuilder withHost(final String host) { + this.host = host; + return this; + } + + /** + * Set port (default: 8200). + * + * @param port Vault TCP port + * @return self + */ + public HTTPVaultConnectorBuilder withPort(final Integer port) { + this.port = port; + return this; + } + + /** + * Set TLS usage (default: TRUE). + * + * @param useTLS use TLS or not + * @return self + */ + public HTTPVaultConnectorBuilder withTLS(final boolean useTLS) { + this.tls = useTLS; + return this; + } + + /** + * Set TLS usage (default: TRUE). + * + * @param useTLS Use TLS or not. + * @param version Supported TLS version ({@code TLSv1.2}, {@code TLSv1.1}, {@code TLSv1.0}, {@code TLS}). + * @return self + * @since 0.8 Added version parameter (#22). + */ + public HTTPVaultConnectorBuilder withTLS(final boolean useTLS, final String version) { + this.tls = useTLS; + this.tlsVersion = version; + return this; + } + + /** + * Convenience Method for TLS usage (enabled by default). + * + * @param version Supported TLS version ({@code TLSv1.2}, {@code TLSv1.1}, {@code TLSv1.0}, {@code TLS}). + * @return self + * @since 0.8 Added version parameter (#22). + */ + public HTTPVaultConnectorBuilder withTLS(final String version) { + return withTLS(true, version); + } + + /** + * Convenience Method for TLS usage (enabled by default). + * + * @return self + */ + public HTTPVaultConnectorBuilder withTLS() { + return withTLS(true); + } + + /** + * Convenience Method for NOT using TLS. + * + * @return self + */ + public HTTPVaultConnectorBuilder withoutTLS() { + return withTLS(false); + } + + /** + * Set API prefix. Default is "/v1/" and changes should not be necessary for current state of development. + * + * @param prefix Vault API prefix (default: "/v1/" + * @return self + */ + public HTTPVaultConnectorBuilder withPrefix(final String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Add a trusted CA certificate for HTTPS connections. + * + * @param cert path to certificate file + * @return self + * @throws VaultConnectorException on error + * @since 0.4.0 + */ + public HTTPVaultConnectorBuilder withTrustedCA(final Path cert) throws VaultConnectorException { + if (cert != null) { + return withTrustedCA(certificateFromFile(cert)); + } else { + this.trustedCA = null; + } + return this; + } + + /** + * Add a trusted CA certificate for HTTPS connections. + * + * @param cert path to certificate file + * @return self + * @since 0.8.0 + */ + public HTTPVaultConnectorBuilder withTrustedCA(final X509Certificate cert) { + this.trustedCA = cert; + return this; + } + + /** + * Set token for automatic authentication, using {@link #buildAndAuth()}. + * + * @param token Vault token + * @return self + * @since 0.6.0 + */ + public HTTPVaultConnectorBuilder withToken(final String token) { + this.token = token; + return this; + } + + /** + * Build connector based on the {@code }VAULT_ADDR} and {@code VAULT_CACERT} (optional) environment variables. + * + * @return self + * @throws VaultConnectorException if Vault address from environment variables is malformed + * @since 0.6.0 + */ + public HTTPVaultConnectorBuilder fromEnv() throws VaultConnectorException { + /* Parse URL from environment variable */ + if (System.getenv(ENV_VAULT_ADDR) != null && !System.getenv(ENV_VAULT_ADDR).trim().isEmpty()) { + try { + URL url = new URL(System.getenv(ENV_VAULT_ADDR)); + this.host = url.getHost(); + this.port = url.getPort(); + this.tls = url.getProtocol().equals("https"); + } catch (MalformedURLException e) { + throw new ConnectionException("URL provided in environment variable malformed", e); + } + } + + /* Read number of retries */ + if (System.getenv(ENV_VAULT_MAX_RETRIES) != null) { + try { + numberOfRetries = Integer.parseInt(System.getenv(ENV_VAULT_MAX_RETRIES)); + } catch (NumberFormatException ignored) { + /* Ignore malformed values. */ + } + } + + /* Read token */ + token = System.getenv(ENV_VAULT_TOKEN); + + /* Parse certificate, if set */ + if (System.getenv(ENV_VAULT_CACERT) != null && !System.getenv(ENV_VAULT_CACERT).trim().isEmpty()) { + return withTrustedCA(Paths.get(System.getenv(ENV_VAULT_CACERT))); + } + return this; + } + + /** + * Define the number of retries to attempt on 5xx errors. + * + * @param numberOfRetries The number of retries to attempt on 5xx errors (default: 0) + * @return self + * @since 0.6.0 + */ + public HTTPVaultConnectorBuilder withNumberOfRetries(final int numberOfRetries) { + this.numberOfRetries = numberOfRetries; + return this; + } + + /** + * Define a custom timeout for the HTTP connection. + * + * @param milliseconds Timeout value in milliseconds. + * @return self + * @since 0.6.0 + */ + public HTTPVaultConnectorBuilder withTimeout(final int milliseconds) { + this.timeout = milliseconds; + return this; + } + + @Override + public HTTPVaultConnector build() { + return new HTTPVaultConnector(host, tls, tlsVersion, port, prefix, trustedCA, numberOfRetries, timeout); + } + + @Override + public HTTPVaultConnector buildAndAuth() throws VaultConnectorException { + if (token == null) { + throw new ConnectionException("No vault token provided, unable to authenticate."); + } + HTTPVaultConnector con = build(); + con.authToken(token); + return con; + } + + /** + * Read given certificate file to X.509 certificate. + * + * @param certFile Path to certificate file + * @return X.509 Certificate object + * @throws TlsException on error + * @since 0.4.0 + */ + private X509Certificate certificateFromFile(final Path certFile) throws TlsException { + try (InputStream is = Files.newInputStream(certFile)) { + return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(is); + } catch (IOException | CertificateException e) { + throw new TlsException("Unable to read certificate.", e); + } + } +} diff --git a/src/main/java/de/stklcode/jvault/connector/builder/HTTPVaultConnectorBuilder.java b/src/main/java/de/stklcode/jvault/connector/builder/HTTPVaultConnectorBuilder.java index bec6243..e7e7d1e 100644 --- a/src/main/java/de/stklcode/jvault/connector/builder/HTTPVaultConnectorBuilder.java +++ b/src/main/java/de/stklcode/jvault/connector/builder/HTTPVaultConnectorBuilder.java @@ -16,283 +16,17 @@ package de.stklcode.jvault.connector.builder; -import de.stklcode.jvault.connector.HTTPVaultConnector; -import de.stklcode.jvault.connector.exception.ConnectionException; -import de.stklcode.jvault.connector.exception.TlsException; -import de.stklcode.jvault.connector.exception.VaultConnectorException; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; - /** * Vault Connector Builder implementation for HTTP Vault connectors. * * @author Stefan Kalscheuer * @since 0.8.0 + * @since 0.9.5 Extends new class for migration purposes only. + * @deprecated Use {@link de.stklcode.jvault.connector.HTTPVaultConnectorBuilder} instead. Will be removed in 1.0 */ -public final class HTTPVaultConnectorBuilder implements VaultConnectorBuilder { - private static final String ENV_VAULT_ADDR = "VAULT_ADDR"; - private static final String ENV_VAULT_CACERT = "VAULT_CACERT"; - private static final String ENV_VAULT_TOKEN = "VAULT_TOKEN"; - private static final String ENV_VAULT_MAX_RETRIES = "VAULT_MAX_RETRIES"; - - public static final String DEFAULT_HOST = "127.0.0.1"; - public static final Integer DEFAULT_PORT = 8200; - public static final boolean DEFAULT_TLS = true; - public static final String DEFAULT_TLS_VERSION = "TLSv1.2"; - public static final String DEFAULT_PREFIX = "/v1/"; - public static final int DEFAULT_NUMBER_OF_RETRIES = 0; - - private String host; - private Integer port; - private boolean tls; - private String tlsVersion; - private String prefix; - private X509Certificate trustedCA; - private int numberOfRetries; - private Integer timeout; - private String token; - - /** - * Default empty constructor. - * Initializes factory with default values. - */ +@Deprecated +public class HTTPVaultConnectorBuilder extends de.stklcode.jvault.connector.HTTPVaultConnectorBuilder { public HTTPVaultConnectorBuilder() { - host = DEFAULT_HOST; - port = DEFAULT_PORT; - tls = DEFAULT_TLS; - tlsVersion = DEFAULT_TLS_VERSION; - prefix = DEFAULT_PREFIX; - numberOfRetries = DEFAULT_NUMBER_OF_RETRIES; - } - - /** - * Set hostname (default: 127.0.0.1). - * - * @param host Hostname or IP address - * @return self - */ - public HTTPVaultConnectorBuilder withHost(final String host) { - this.host = host; - return this; - } - - /** - * Set port (default: 8200). - * - * @param port Vault TCP port - * @return self - */ - public HTTPVaultConnectorBuilder withPort(final Integer port) { - this.port = port; - return this; - } - - /** - * Set TLS usage (default: TRUE). - * - * @param useTLS use TLS or not - * @return self - */ - public HTTPVaultConnectorBuilder withTLS(final boolean useTLS) { - this.tls = useTLS; - return this; - } - - /** - * Set TLS usage (default: TRUE). - * - * @param useTLS Use TLS or not. - * @param version Supported TLS version ({@code TLSv1.2}, {@code TLSv1.1}, {@code TLSv1.0}, {@code TLS}). - * @return self - * @since 0.8 Added version parameter (#22). - */ - public HTTPVaultConnectorBuilder withTLS(final boolean useTLS, final String version) { - this.tls = useTLS; - this.tlsVersion = version; - return this; - } - - /** - * Convenience Method for TLS usage (enabled by default). - * - * @param version Supported TLS version ({@code TLSv1.2}, {@code TLSv1.1}, {@code TLSv1.0}, {@code TLS}). - * @return self - * @since 0.8 Added version parameter (#22). - */ - public HTTPVaultConnectorBuilder withTLS(final String version) { - return withTLS(true, version); - } - - /** - * Convenience Method for TLS usage (enabled by default). - * - * @return self - */ - public HTTPVaultConnectorBuilder withTLS() { - return withTLS(true); - } - - /** - * Convenience Method for NOT using TLS. - * - * @return self - */ - public HTTPVaultConnectorBuilder withoutTLS() { - return withTLS(false); - } - - /** - * Set API prefix. Default is "/v1/" and changes should not be necessary for current state of development. - * - * @param prefix Vault API prefix (default: "/v1/" - * @return self - */ - public HTTPVaultConnectorBuilder withPrefix(final String prefix) { - this.prefix = prefix; - return this; - } - - /** - * Add a trusted CA certificate for HTTPS connections. - * - * @param cert path to certificate file - * @return self - * @throws VaultConnectorException on error - * @since 0.4.0 - */ - public HTTPVaultConnectorBuilder withTrustedCA(final Path cert) throws VaultConnectorException { - if (cert != null) { - return withTrustedCA(certificateFromFile(cert)); - } else { - this.trustedCA = null; - } - return this; - } - - /** - * Add a trusted CA certificate for HTTPS connections. - * - * @param cert path to certificate file - * @return self - * @since 0.8.0 - */ - public HTTPVaultConnectorBuilder withTrustedCA(final X509Certificate cert) { - this.trustedCA = cert; - return this; - } - - /** - * Set token for automatic authentication, using {@link #buildAndAuth()}. - * - * @param token Vault token - * @return self - * @since 0.6.0 - */ - public HTTPVaultConnectorBuilder withToken(final String token) { - this.token = token; - return this; - } - - /** - * Build connector based on the {@code }VAULT_ADDR} and {@code VAULT_CACERT} (optional) environment variables. - * - * @return self - * @throws VaultConnectorException if Vault address from environment variables is malformed - * @since 0.6.0 - */ - public HTTPVaultConnectorBuilder fromEnv() throws VaultConnectorException { - /* Parse URL from environment variable */ - if (System.getenv(ENV_VAULT_ADDR) != null && !System.getenv(ENV_VAULT_ADDR).trim().isEmpty()) { - try { - URL url = new URL(System.getenv(ENV_VAULT_ADDR)); - this.host = url.getHost(); - this.port = url.getPort(); - this.tls = url.getProtocol().equals("https"); - } catch (MalformedURLException e) { - throw new ConnectionException("URL provided in environment variable malformed", e); - } - } - - /* Read number of retries */ - if (System.getenv(ENV_VAULT_MAX_RETRIES) != null) { - try { - numberOfRetries = Integer.parseInt(System.getenv(ENV_VAULT_MAX_RETRIES)); - } catch (NumberFormatException ignored) { - /* Ignore malformed values. */ - } - } - - /* Read token */ - token = System.getenv(ENV_VAULT_TOKEN); - - /* Parse certificate, if set */ - if (System.getenv(ENV_VAULT_CACERT) != null && !System.getenv(ENV_VAULT_CACERT).trim().isEmpty()) { - return withTrustedCA(Paths.get(System.getenv(ENV_VAULT_CACERT))); - } - return this; - } - - /** - * Define the number of retries to attempt on 5xx errors. - * - * @param numberOfRetries The number of retries to attempt on 5xx errors (default: 0) - * @return self - * @since 0.6.0 - */ - public HTTPVaultConnectorBuilder withNumberOfRetries(final int numberOfRetries) { - this.numberOfRetries = numberOfRetries; - return this; - } - - /** - * Define a custom timeout for the HTTP connection. - * - * @param milliseconds Timeout value in milliseconds. - * @return self - * @since 0.6.0 - */ - public HTTPVaultConnectorBuilder withTimeout(final int milliseconds) { - this.timeout = milliseconds; - return this; - } - - @Override - public HTTPVaultConnector build() { - return new HTTPVaultConnector(host, tls, tlsVersion, port, prefix, trustedCA, numberOfRetries, timeout); - } - - @Override - public HTTPVaultConnector buildAndAuth() throws VaultConnectorException { - if (token == null) { - throw new ConnectionException("No vault token provided, unable to authenticate."); - } - HTTPVaultConnector con = build(); - con.authToken(token); - return con; - } - - /** - * Read given certificate file to X.509 certificate. - * - * @param certFile Path to certificate file - * @return X.509 Certificate object - * @throws TlsException on error - * @since 0.4.0 - */ - private X509Certificate certificateFromFile(final Path certFile) throws TlsException { - try (InputStream is = Files.newInputStream(certFile)) { - return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(is); - } catch (IOException | CertificateException e) { - throw new TlsException("Unable to read certificate.", e); - } + super(); } } diff --git a/src/main/java/de/stklcode/jvault/connector/builder/VaultConnectorBuilder.java b/src/main/java/de/stklcode/jvault/connector/builder/VaultConnectorBuilder.java index 3ad809b..e023732 100644 --- a/src/main/java/de/stklcode/jvault/connector/builder/VaultConnectorBuilder.java +++ b/src/main/java/de/stklcode/jvault/connector/builder/VaultConnectorBuilder.java @@ -16,6 +16,7 @@ package de.stklcode.jvault.connector.builder; +import de.stklcode.jvault.connector.HTTPVaultConnector; import de.stklcode.jvault.connector.VaultConnector; import de.stklcode.jvault.connector.exception.VaultConnectorException; @@ -31,7 +32,9 @@ public interface VaultConnectorBuilder { * Get Factory implementation for HTTP Vault Connector. * * @return HTTP Connector Factory + * @deprecated Use {@link HTTPVaultConnector#builder()} instead. This interface will be removed in 1.0 */ + @Deprecated static HTTPVaultConnectorBuilder http() { return new HTTPVaultConnectorBuilder(); } diff --git a/src/main/java/de/stklcode/jvault/connector/factory/HTTPVaultConnectorFactory.java b/src/main/java/de/stklcode/jvault/connector/factory/HTTPVaultConnectorFactory.java index 0d22143..33640a6 100644 --- a/src/main/java/de/stklcode/jvault/connector/factory/HTTPVaultConnectorFactory.java +++ b/src/main/java/de/stklcode/jvault/connector/factory/HTTPVaultConnectorFactory.java @@ -17,7 +17,7 @@ package de.stklcode.jvault.connector.factory; import de.stklcode.jvault.connector.HTTPVaultConnector; -import de.stklcode.jvault.connector.builder.HTTPVaultConnectorBuilder; +import de.stklcode.jvault.connector.HTTPVaultConnectorBuilder; import de.stklcode.jvault.connector.exception.VaultConnectorException; import javax.net.ssl.SSLContext; diff --git a/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java b/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java index aa6e9fe..4c24d13 100644 --- a/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java +++ b/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java @@ -16,7 +16,6 @@ package de.stklcode.jvault.connector; -import de.stklcode.jvault.connector.builder.HTTPVaultConnectorBuilder; import de.stklcode.jvault.connector.builder.VaultConnectorBuilder; import de.stklcode.jvault.connector.exception.*; import de.stklcode.jvault.connector.model.AppRole; diff --git a/src/test/java/de/stklcode/jvault/connector/builder/HTTPVaultConnectorBuilderTest.java b/src/test/java/de/stklcode/jvault/connector/builder/HTTPVaultConnectorBuilderTest.java index 9832496..6ca2b55 100644 --- a/src/test/java/de/stklcode/jvault/connector/builder/HTTPVaultConnectorBuilderTest.java +++ b/src/test/java/de/stklcode/jvault/connector/builder/HTTPVaultConnectorBuilderTest.java @@ -18,6 +18,7 @@ package de.stklcode.jvault.connector.builder; import com.github.stefanbirkner.systemlambda.SystemLambda; import de.stklcode.jvault.connector.HTTPVaultConnector; +import de.stklcode.jvault.connector.HTTPVaultConnectorBuilder; import de.stklcode.jvault.connector.exception.TlsException; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -25,7 +26,6 @@ import org.junit.jupiter.api.io.TempDir; import java.io.File; import java.lang.reflect.Field; import java.nio.file.NoSuchFileException; -import java.util.concurrent.Callable; import static com.github.stefanbirkner.systemlambda.SystemLambda.withEnvironmentVariable; import static org.hamcrest.CoreMatchers.*; @@ -55,7 +55,7 @@ class HTTPVaultConnectorBuilderTest { /* Provide address only should be enough */ withVaultEnv(VAULT_ADDR, null, null, null).execute(() -> { HTTPVaultConnectorBuilder builder = assertDoesNotThrow( - () -> VaultConnectorBuilder.http().fromEnv(), + () -> HTTPVaultConnector.builder().fromEnv(), "Factory creation from minimal environment failed" ); HTTPVaultConnector connector = builder.build(); @@ -70,7 +70,7 @@ class HTTPVaultConnectorBuilderTest { /* Provide address and number of retries */ withVaultEnv(VAULT_ADDR, null, VAULT_MAX_RETRIES.toString(), null).execute(() -> { HTTPVaultConnectorBuilder builder = assertDoesNotThrow( - () -> VaultConnectorBuilder.http().fromEnv(), + () -> HTTPVaultConnector.builder().fromEnv(), "Factory creation from environment failed" ); HTTPVaultConnector connector = builder.build(); @@ -87,7 +87,7 @@ class HTTPVaultConnectorBuilderTest { withVaultEnv(VAULT_ADDR, VAULT_CACERT, VAULT_MAX_RETRIES.toString(), null).execute(() -> { TlsException e = assertThrows( TlsException.class, - () -> VaultConnectorBuilder.http().fromEnv(), + () -> HTTPVaultConnector.builder().fromEnv(), "Creation with unknown cert path failed." ); assertThat(e.getCause(), is(instanceOf(NoSuchFileException.class))); @@ -99,7 +99,7 @@ class HTTPVaultConnectorBuilderTest { /* Automatic authentication */ withVaultEnv(VAULT_ADDR, null, VAULT_MAX_RETRIES.toString(), VAULT_TOKEN).execute(() -> { HTTPVaultConnectorBuilder builder = assertDoesNotThrow( - () -> VaultConnectorBuilder.http().fromEnv(), + () -> HTTPVaultConnector.builder().fromEnv(), "Factory creation from minimal environment failed" ); assertThat("Token nor set correctly", getPrivate(builder, "token"), is(equalTo(VAULT_TOKEN))); From e578591a497e70356fb05d25f9ff7a9c0f07c3fa Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Fri, 11 Jun 2021 21:33:59 +0200 Subject: [PATCH 2/6] deprecate convenience methods to interact with "secret/" mount (#52) --- CHANGELOG.md | 5 +++-- .../java/de/stklcode/jvault/connector/VaultConnector.java | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 029cf95..c56b769 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ ## 0.9.5 (unreleased) ### Deprecations -* Deprecated builder invocation `VaultConnectorBuilder.http()` in favor of `HTTPVaultConnector.builder()`. -* Deprecated `de.stklcode.jvault.connector.builder.HTTPVaultConnectorBuilder` in favor of `de.stklcode.jvault.connector.HTTPVaultConnectorBuilder` (only package changed). +* Deprecate ` {read,write,delete}Secret()` convenience methods. Use `{read,write,delete}("secret/...")` instead (#52) +* Deprecated builder invocation `VaultConnectorBuilder.http()` in favor of `HTTPVaultConnector.builder()` (#51) +* Deprecated `de.stklcode.jvault.connector.builder.HTTPVaultConnectorBuilder` in favor of `de.stklcode.jvault.connector.HTTPVaultConnectorBuilder` (only package changed) (#51) Old builders will be removed in 1.0 diff --git a/src/main/java/de/stklcode/jvault/connector/VaultConnector.java b/src/main/java/de/stklcode/jvault/connector/VaultConnector.java index 4fc1a0f..cf3732c 100644 --- a/src/main/java/de/stklcode/jvault/connector/VaultConnector.java +++ b/src/main/java/de/stklcode/jvault/connector/VaultConnector.java @@ -401,7 +401,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @param key Secret identifier * @return Secret response * @throws VaultConnectorException on error + * @deprecated Convenience method will be removed in 1.0. Use {@link #read(String)} instead with key prefix "secret/". */ + @Deprecated default SecretResponse readSecret(final String key) throws VaultConnectorException { return read(PATH_SECRET + "/" + key); } @@ -642,7 +644,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @param key Secret path * @param value Secret value * @throws VaultConnectorException on error + * @deprecated Convenience method will be removed in 1.0. Use {@link #write(String, String)} instead with key prefix "secret/". */ + @Deprecated default void writeSecret(final String key, final String value) throws VaultConnectorException { writeSecret(key, Collections.singletonMap("value", value)); } @@ -656,7 +660,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @param data Secret content. Value must be be JSON serializable. * @throws VaultConnectorException on error * @since 0.5.0 + * @deprecated Convenience method will be removed in 1.0. Use {@link #write(String, Map)} instead with key prefix "secret/". */ + @Deprecated default void writeSecret(final String key, final Map data) throws VaultConnectorException { if (key == null || key.isEmpty()) { throw new InvalidRequestException("Secret path must not be empty."); @@ -680,7 +686,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * * @param key Secret path * @throws VaultConnectorException on error + * @deprecated Convenience method will be removed in 1.0. Use {@link #delete(String)} instead with key prefix "secret/". */ + @Deprecated default void deleteSecret(final String key) throws VaultConnectorException { delete(PATH_SECRET + "/" + key); } From 53d954ea12c84de67e9afab36829dbe53896d630 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sat, 12 Jun 2021 10:46:10 +0200 Subject: [PATCH 3/6] deprecate all convenience methods to interact with "secret/" mount Follow-up deprecation for the not yet deprecated wrapper methods. --- .../jvault/connector/VaultConnector.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/de/stklcode/jvault/connector/VaultConnector.java b/src/main/java/de/stklcode/jvault/connector/VaultConnector.java index cf3732c..8790787 100644 --- a/src/main/java/de/stklcode/jvault/connector/VaultConnector.java +++ b/src/main/java/de/stklcode/jvault/connector/VaultConnector.java @@ -450,7 +450,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @return Metadata for the created/updated secret. * @throws VaultConnectorException on error * @since 0.8 + * @deprecated Convenience method will be removed in 1.0. Use {@link #writeSecretData(String, String, Map)} instead with mount parameter "secret". */ + @Deprecated default SecretVersionResponse writeSecretData(final String key, final Map data) throws VaultConnectorException { return writeSecretData(PATH_SECRET, key, data, null); } @@ -499,7 +501,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @return Secret response * @throws VaultConnectorException on error * @since 0.8 + * @deprecated Convenience method will be removed in 1.0. Use {@link #readSecretVersion(String, String, Integer)} instead with mount parameter "secret". */ + @Deprecated default SecretResponse readSecretVersion(final String key, final Integer version) throws VaultConnectorException { return readSecretVersion(PATH_SECRET, key, version); } @@ -528,7 +532,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @return Metadata response * @throws VaultConnectorException on error * @since 0.8 + * @deprecated Convenience method will be removed in 1.0. Use {@link #readSecretMetadata(String, String)} instead with mount parameter "secret". */ + @Deprecated default MetadataResponse readSecretMetadata(final String key) throws VaultConnectorException { return readSecretMetadata(PATH_SECRET, key); } @@ -544,7 +550,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @param casRequired Specify if Check-And-Set is required for this secret. * @throws VaultConnectorException on error * @since 0.8 + * @deprecated Convenience method will be removed in 1.0. Use {@link #updateSecretMetadata(String, String, Integer, boolean)} instead with mount parameter "secret". */ + @Deprecated default void updateSecretMetadata(final String key, final Integer maxVersions, final boolean casRequired) throws VaultConnectorException { updateSecretMetadata(PATH_SECRET, key, maxVersions, casRequired); } @@ -596,7 +604,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @param path Root path to search * @return List of secret keys * @throws VaultConnectorException on error + * @deprecated Convenience method will be removed in 1.0. Use {@link #list(String)} instead with key prefix "secret/". */ + @Deprecated default List listSecrets(final String path) throws VaultConnectorException { return list(PATH_SECRET + "/" + path); } @@ -701,7 +711,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @param key Secret path. * @throws VaultConnectorException on error * @since 0.8 + * @deprecated Convenience method will be removed in 1.0. Use {@link #deleteLatestSecretVersion(String, String)} instead with mount parameter "secret". */ + @Deprecated default void deleteLatestSecretVersion(final String key) throws VaultConnectorException { deleteLatestSecretVersion(PATH_SECRET, key); } @@ -727,7 +739,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @param key Secret path. * @throws VaultConnectorException on error * @since 0.8 + * @deprecated Convenience method will be removed in 1.0. Use {@link #deleteAllSecretVersions(String)} instead with mount parameter "secret". */ + @Deprecated default void deleteAllSecretVersions(final String key) throws VaultConnectorException { deleteAllSecretVersions(PATH_SECRET, key); } @@ -754,7 +768,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @param versions Versions of the secret to delete. * @throws VaultConnectorException on error * @since 0.8 + * @deprecated Convenience method will be removed in 1.0. Use {@link #deleteSecretVersions(String, String, int...)} instead with mount parameter "secret". */ + @Deprecated default void deleteSecretVersions(final String key, final int... versions) throws VaultConnectorException { deleteSecretVersions(PATH_SECRET, key, versions); } @@ -780,7 +796,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @param versions Versions of the secret to undelete. * @throws VaultConnectorException on error * @since 0.8 + * @deprecated Convenience method will be removed in 1.0. Use {@link #undeleteSecretVersions(String, String, int...)} instead with mount parameter "secret". */ + @Deprecated default void undeleteSecretVersions(final String key, final int... versions) throws VaultConnectorException { undeleteSecretVersions(PATH_SECRET, key, versions); } @@ -805,7 +823,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @param versions Versions of the secret to destroy. * @throws VaultConnectorException on error * @since 0.8 + * @deprecated Convenience method will be removed in 1.0. Use {@link #destroySecretVersions(String, String, int...)} instead with mount parameter "secret". */ + @Deprecated default void destroySecretVersions(final String key, final int... versions) throws VaultConnectorException { destroySecretVersions(PATH_SECRET, key, versions); } From eed61c45694fe0ffc2e0ec4ab7c73a25558017ae Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Tue, 27 Jul 2021 21:25:20 +0200 Subject: [PATCH 4/6] minor dependency updates --- .drone.yml | 10 +++++----- .travis.yml | 4 ++-- CHANGELOG.md | 5 +++++ README.md | 2 +- pom.xml | 16 +++++----------- .../jvault/connector/HTTPVaultConnectorTest.java | 2 +- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.drone.yml b/.drone.yml index 96fd8e8..fe692b8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,12 +25,12 @@ steps: - name: unit-integration-tests image: maven:3-jdk-11 environment: - VAULT_VERSION: 1.7.2 + VAULT_VERSION: 1.7.3 commands: - - curl -s -o vault_1.7.2_linux_amd64.zip https://releases.hashicorp.com/vault/1.7.2/vault_1.7.2_linux_amd64.zip - - curl -s https://releases.hashicorp.com/vault/1.7.2/vault_1.7.2_SHA256SUMS | grep linux_amd64 | sha256sum -c - - unzip vault_1.7.2_linux_amd64.zip - - rm vault_1.7.2_linux_amd64.zip + - curl -s -o vault_1.7.3_linux_amd64.zip https://releases.hashicorp.com/vault/1.7.3/vault_1.7.3_linux_amd64.zip + - curl -s https://releases.hashicorp.com/vault/1.7.3/vault_1.7.3_SHA256SUMS | grep linux_amd64 | sha256sum -c + - unzip vault_1.7.3_linux_amd64.zip + - rm vault_1.7.3_linux_amd64.zip - mv vault /bin/ - mvn -B resources:testResources compiler:testCompile surefire:test when: diff --git a/.travis.yml b/.travis.yml index 2d68e45..c1b2147 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ addons: secure: "sM9OfX5jW764pn9cb2LSXArnXucKMws+eGeg5NnZxHRcGYt4hpBKLSregBSsBNzUoWVj0zNzPCpnh+UQvgxQzUerOqwEdjTBpy3SNPaxSn7UpoSg+Wz3aUmL9ugmx01b51/wMG4UCHEwTZt2tpgTPVtw8K6uSO78e0dSICCBHDnRcdQwOjMEQHIJJ/qHVRwuy/MzLCAP3W1JPZlsphZg9QsFyhB4hW97dE90joZezfocQIv2xI/r6k+BLz0pY6MxYCul0RiDumaiaej0CPvEJI/uSu//BAQjUdHw+mQgnKUYIbrn2ONOviwNfwdr94JyoZEN2B6zASUmNLjPf4AbIojDeyS+CrpQpm17EVm/Qk/Ds+Xra4PPPIcsZhiWzV0KoDUz9xLfXuRJ526VT5tDPiaeI7oETf0+8l+JIS1b399FyqHi7smzjpvC6GuKflQrbuHK4MuKzDh7WTHiqokGG4SS0wOQIaaHB3dfdwwQzPh6IM24e8CETxh3DjMeqUTU4DWmv5po55jZ934TtxVQvVN78bTG9O0zS9u+JmRY04OZ+OaXuFam6MfMUFQi0EPZzdGul/oWSibGUu3bNfVEBp60CnJwYNM/dKG6U7pJthLHvSwiQFOdKzHZ+l1jZJ4gPaXaIGqpwqVGr28ntqA/El1rytPixr2driE6bYMt5jw=" env: - - PATH=$PATH:. VAULT_VERSION=1.7.2 ANALYSIS=false + - PATH=$PATH:. VAULT_VERSION=1.7.3 ANALYSIS=false cache: directories: @@ -18,7 +18,7 @@ jobs: include: - jdk: openjdk8 - jdk: openjdk11 - env: PATH=$PATH:. VAULT_VERSION=1.7.2 ANALYSIS=true + env: PATH=$PATH:. VAULT_VERSION=1.7.3 ANALYSIS=true - jdk: openjdk16 before_script: diff --git a/CHANGELOG.md b/CHANGELOG.md index c56b769..a14e5c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ Old builders will be removed in 1.0 +### Improvements +* Minor dependency updates + +### Test +* Tested against Vault 1.7.3 ## 0.9.4 (2021-06-06) diff --git a/README.md b/README.md index dbfb8fe..f83282b 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Java Vault Connector is a connector library for [Vault](https://www.vaultproject * SQL secret handling * KV v1 and v2 support * Connector Factory with builder pattern -* Tested against Vault 1.7.2 +* Tested against Vault 1.7.3 ## Maven Artifact diff --git a/pom.xml b/pom.xml index 7dc2b6f..4f4a919 100644 --- a/pom.xml +++ b/pom.xml @@ -113,7 +113,7 @@ com.fasterxml.jackson.core jackson-databind - 2.12.3 + 2.12.4 @@ -128,16 +128,10 @@ 2.2 test - - org.mockito - mockito-core - 3.11.0 - test - org.mockito mockito-inline - 3.11.0 + 3.11.2 test @@ -149,7 +143,7 @@ commons-io commons-io - 2.9.0 + 2.11.0 test @@ -200,7 +194,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.3.0 1.8 @@ -293,7 +287,7 @@ org.owasp dependency-check-maven - 6.2.0 + 6.2.2 diff --git a/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java b/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java index 4c24d13..e5117bb 100644 --- a/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java +++ b/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java @@ -53,7 +53,7 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue; */ @Tag("online") class HTTPVaultConnectorTest { - private static String VAULT_VERSION = "1.7.2"; // the vault version this test is supposed to run against + private static String VAULT_VERSION = "1.7.3"; // the vault version this test is supposed to run against private static final String KEY1 = "E38bkCm0VhUvpdCKGQpcohhD9XmcHJ/2hreOSY019Lho"; private static final String KEY2 = "O5OHwDleY3IiPdgw61cgHlhsrEm6tVJkrxhF6QAnILd1"; private static final String KEY3 = "mw7Bm3nbt/UWa/juDjjL2EPQ04kiJ0saC5JEXwJvXYsB"; From 3a920fe9605169cba17ea3c9b299fdce4a7aeb5c Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Wed, 28 Jul 2021 19:34:48 +0200 Subject: [PATCH 5/6] prepare release 0.9.5 --- CHANGELOG.md | 4 ++-- README.md | 2 +- pom.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a14e5c9..04758e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ -## 0.9.5 (unreleased) +## 0.9.5 (2021-07-28) ### Deprecations * Deprecate ` {read,write,delete}Secret()` convenience methods. Use `{read,write,delete}("secret/...")` instead (#52) * Deprecated builder invocation `VaultConnectorBuilder.http()` in favor of `HTTPVaultConnector.builder()` (#51) * Deprecated `de.stklcode.jvault.connector.builder.HTTPVaultConnectorBuilder` in favor of `de.stklcode.jvault.connector.HTTPVaultConnectorBuilder` (only package changed) (#51) - + Old builders will be removed in 1.0 ### Improvements diff --git a/README.md b/README.md index f83282b..abd2074 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Java Vault Connector is a connector library for [Vault](https://www.vaultproject de.stklcode.jvault jvault-connector - 0.9.5-SNAPSHOT + 0.9.5 ``` diff --git a/pom.xml b/pom.xml index 4f4a919..45a667f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ de.stklcode.jvault jvault-connector - 0.9.5-SNAPSHOT + 0.9.5 jar From bbceee35f27a1d5c45f626aa99970b9f5b5c3dc5 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Wed, 28 Jul 2021 19:38:06 +0200 Subject: [PATCH 6/6] test against Vault 1.8.0 --- .drone.yml | 10 +++++----- .travis.yml | 4 ++-- CHANGELOG.md | 2 +- README.md | 2 +- .../jvault/connector/HTTPVaultConnectorTest.java | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.drone.yml b/.drone.yml index fe692b8..a1e6145 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,12 +25,12 @@ steps: - name: unit-integration-tests image: maven:3-jdk-11 environment: - VAULT_VERSION: 1.7.3 + VAULT_VERSION: 1.8.0 commands: - - curl -s -o vault_1.7.3_linux_amd64.zip https://releases.hashicorp.com/vault/1.7.3/vault_1.7.3_linux_amd64.zip - - curl -s https://releases.hashicorp.com/vault/1.7.3/vault_1.7.3_SHA256SUMS | grep linux_amd64 | sha256sum -c - - unzip vault_1.7.3_linux_amd64.zip - - rm vault_1.7.3_linux_amd64.zip + - curl -s -o vault_1.8.0_linux_amd64.zip https://releases.hashicorp.com/vault/1.8.0/vault_1.8.0_linux_amd64.zip + - curl -s https://releases.hashicorp.com/vault/1.8.0/vault_1.8.0_SHA256SUMS | grep linux_amd64 | sha256sum -c + - unzip vault_1.8.0_linux_amd64.zip + - rm vault_1.8.0_linux_amd64.zip - mv vault /bin/ - mvn -B resources:testResources compiler:testCompile surefire:test when: diff --git a/.travis.yml b/.travis.yml index c1b2147..0bce30d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ addons: secure: "sM9OfX5jW764pn9cb2LSXArnXucKMws+eGeg5NnZxHRcGYt4hpBKLSregBSsBNzUoWVj0zNzPCpnh+UQvgxQzUerOqwEdjTBpy3SNPaxSn7UpoSg+Wz3aUmL9ugmx01b51/wMG4UCHEwTZt2tpgTPVtw8K6uSO78e0dSICCBHDnRcdQwOjMEQHIJJ/qHVRwuy/MzLCAP3W1JPZlsphZg9QsFyhB4hW97dE90joZezfocQIv2xI/r6k+BLz0pY6MxYCul0RiDumaiaej0CPvEJI/uSu//BAQjUdHw+mQgnKUYIbrn2ONOviwNfwdr94JyoZEN2B6zASUmNLjPf4AbIojDeyS+CrpQpm17EVm/Qk/Ds+Xra4PPPIcsZhiWzV0KoDUz9xLfXuRJ526VT5tDPiaeI7oETf0+8l+JIS1b399FyqHi7smzjpvC6GuKflQrbuHK4MuKzDh7WTHiqokGG4SS0wOQIaaHB3dfdwwQzPh6IM24e8CETxh3DjMeqUTU4DWmv5po55jZ934TtxVQvVN78bTG9O0zS9u+JmRY04OZ+OaXuFam6MfMUFQi0EPZzdGul/oWSibGUu3bNfVEBp60CnJwYNM/dKG6U7pJthLHvSwiQFOdKzHZ+l1jZJ4gPaXaIGqpwqVGr28ntqA/El1rytPixr2driE6bYMt5jw=" env: - - PATH=$PATH:. VAULT_VERSION=1.7.3 ANALYSIS=false + - PATH=$PATH:. VAULT_VERSION=1.8.0 ANALYSIS=false cache: directories: @@ -18,7 +18,7 @@ jobs: include: - jdk: openjdk8 - jdk: openjdk11 - env: PATH=$PATH:. VAULT_VERSION=1.7.3 ANALYSIS=true + env: PATH=$PATH:. VAULT_VERSION=1.8.0 ANALYSIS=true - jdk: openjdk16 before_script: diff --git a/CHANGELOG.md b/CHANGELOG.md index 04758e0..abf8da7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ Old builders will be removed in 1.0 * Minor dependency updates ### Test -* Tested against Vault 1.7.3 +* Tested against Vault 1.8.0 ## 0.9.4 (2021-06-06) diff --git a/README.md b/README.md index abd2074..7a49564 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Java Vault Connector is a connector library for [Vault](https://www.vaultproject * SQL secret handling * KV v1 and v2 support * Connector Factory with builder pattern -* Tested against Vault 1.7.3 +* Tested against Vault 1.8.0 ## Maven Artifact diff --git a/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java b/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java index e5117bb..b113514 100644 --- a/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java +++ b/src/test/java/de/stklcode/jvault/connector/HTTPVaultConnectorTest.java @@ -53,7 +53,7 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue; */ @Tag("online") class HTTPVaultConnectorTest { - private static String VAULT_VERSION = "1.7.3"; // the vault version this test is supposed to run against + private static String VAULT_VERSION = "1.8.0"; // the vault version this test is supposed to run against private static final String KEY1 = "E38bkCm0VhUvpdCKGQpcohhD9XmcHJ/2hreOSY019Lho"; private static final String KEY2 = "O5OHwDleY3IiPdgw61cgHlhsrEm6tVJkrxhF6QAnILd1"; private static final String KEY3 = "mw7Bm3nbt/UWa/juDjjL2EPQ04kiJ0saC5JEXwJvXYsB";