Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The driver is available from Maven Central, for all modern Java build systems.
Gradle:
```
dependencies {
compile('com.bettercloud:vault-java-driver:2.0.0')
compile('com.bettercloud:vault-java-driver:3.0.0')
}
```

Expand All @@ -39,7 +39,7 @@ Maven:
<dependency>
<groupId>com.bettercloud</groupId>
<artifactId>vault-java-driver</artifactId>
<version>2.0.0</version>
<version>3.0.0</version>
</dependency>
```

Expand Down Expand Up @@ -219,7 +219,7 @@ Note that changes to the major version (i.e. the first number) represent possibl
may require modifications in your code to migrate. Changes to the minor version (i.e. the second number)
should represent non-breaking changes. The third number represents any very minor bugfix patches.

* **3.0.0 (IN DEVELOPMENT)**: This is a breaking-change release, with several updates.
* **3.0.0**: This is a breaking-change release, with several updates.
* **API changes**:
* Adds support for writing arbitrary objects to Vault, instead of just strings (i.e. the
`com.bettercloud.vault.api.Logical.write(...)` method now accepts a `Map<String. Object>` rather than a
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'signing'

group 'com.bettercloud'
archivesBaseName = 'vault-java-driver'
version '3.0.0-SNAPSHOT'
version '3.0.0'
ext.isReleaseVersion = !version.endsWith('SNAPSHOT')

compileJava {
Expand Down Expand Up @@ -74,15 +74,15 @@ sourceSets {
}

task unitTest(type: Test) {
testClassesDir = sourceSets.unitTests.output.classesDir
testClassesDirs = sourceSets.unitTests.output.classesDirs
classpath = sourceSets.unitTests.runtimeClasspath
testLogging {
events "passed", "skipped", "failed"
}
}

task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTests.output.classesDir
testClassesDirs= sourceSets.integrationTests.output.classesDirs
classpath = sourceSets.integrationTests.runtimeClasspath
testLogging {
events "passed", "skipped", "failed"
Expand Down
43 changes: 21 additions & 22 deletions src/main/java/com/bettercloud/vault/SslConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* <p>A container for SSL-related configuration options, meant to be stored within a {@link VaultConfig} instance.</p>
*
* <p>Construct instances of this class using a builder pattern, calling setter methods for each value and then
* terminating with a call to {@link this#build()}:</p>
* terminating with a call to build().</p>
*/
public class SslConfig implements Serializable {

Expand Down Expand Up @@ -67,7 +67,7 @@ public class SslConfig implements Serializable {
* <code>protected</code> access level).</p>
*
* @param environmentLoader An environment variable loader implementation (presumably a mock)
* @return This object, with environmentLoader populated, ready for additional builder-pattern method calls or else finalization with the {@link this#build()} method
* @return This object, with environmentLoader populated, ready for additional builder-pattern method calls or else finalization with the build() method
*/
protected SslConfig environmentLoader(final EnvironmentLoader environmentLoader) {
this.environmentLoader = environmentLoader;
Expand Down Expand Up @@ -101,7 +101,7 @@ public SslConfig verify(final Boolean verify) {
* If you are not using certificate based client auth, then this field may remain un-set.</p>
*
* <p>Note that you cannot mix-and-match JKS based config with PEM based config. If any of the keyStore or
* trustStore setters are used, then the {@link this#build()} method will complete ignore any PEM data that was
* trustStore setters are used, then the build() method will complete ignore any PEM data that was
* set.</p>
*
* @param keyStore A keystore, containing a client certificate registered with Vault's TLS Certificate auth backend
Expand All @@ -120,13 +120,13 @@ public SslConfig keyStore(final KeyStore keyStore, final String password) {
* keystore from a JKS file on the filesystem.</p>
*
* <p>Note that you cannot mix-and-match JKS based config with PEM based config. If any of the keyStore or
* trustStore setters are used, then the {@link this#build()} method will complete ignore any PEM data that was
* trustStore setters are used, then the build() method will complete ignore any PEM data that was
* set.</p>
*
* @param keyStoreFile A JKS keystore file, containing a client certificate registered with Vault's TLS Certificate auth backend
* @param password The password needed to access the keystore (can be <code>null</code>)
* @return This object, with keyStore and keyStorePassword populated, ready for additional builder-pattern method calls or else finalization with the build() method
* @throws VaultException
* @throws VaultException If any error occurs while loading the keystore
*/
public SslConfig keyStoreFile(final File keyStoreFile, final String password) throws VaultException {
try (final InputStream inputStream = new FileInputStream(keyStoreFile)) {
Expand All @@ -145,13 +145,13 @@ public SslConfig keyStoreFile(final File keyStoreFile, final String password) th
* JAR/WAR/EAR file).</p>
*
* <p>Note that you cannot mix-and-match JKS based config with PEM based config. If any of the keyStore or
* trustStore setters are used, then the {@link this#build()} method will complete ignore any PEM data that was
* trustStore setters are used, then the build() method will complete ignore any PEM data that was
* set.</p>
*
* @param classpathResource A JKS keystore file, containing a client certificate registered with Vault's TLS Certificate auth backend
* @param password The password needed to access the keystore (can be <code>null</code>)
* @return This object, with keyStore and keyStorePassword populated, ready for additional builder-pattern method calls or else finalization with the build() method
* @throws VaultException
* @throws VaultException If any error occurs while loading the keystore
*/
public SslConfig keyStoreResource(final String classpathResource, final String password) throws VaultException {
try (final InputStream inputStream = this.getClass().getResourceAsStream(classpathResource)) {
Expand All @@ -168,8 +168,7 @@ public SslConfig keyStoreResource(final String classpathResource, final String p
* from the server using this cert.</p>
*
* <p>Note that you cannot mix-and-match JKS based config with PEM based config. If any of the keyStore or
* trustStore setters are used, then the {@link this#build()} method will complete ignore any PEM data that was
* set.</p>
* trustStore setters are used, then the build() method will complete ignore any PEM data that was set.</p>
*
* @param trustStore A truststore, containing the Vault server's X509 certificate
* @return This object, with trustStore populated, ready for additional builder-pattern method calls or else finalization with the build() method
Expand All @@ -184,11 +183,11 @@ public SslConfig trustStore(final KeyStore trustStore) {
* from the server using this cert. This method load the truststore from a JKS file on the filesystem.</p>
*
* <p>Note that you cannot mix-and-match JKS based config with PEM based config. If any of the keyStore or
* trustStore setters are used, then the {@link this#build()} method will complete ignore any PEM data that was
* set.</p>
* trustStore setters are used, then the build() method will complete ignore any PEM data that was set.</p>
*
* @param trustStoreFile A JKS truststore file, containing the Vault server's X509 certificate
* @return This object, with trustStore populated, ready for additional builder-pattern method calls or else finalization with the build() method
* @throws VaultException If any error occurs while loading the truststore
*/
public SslConfig trustStoreFile(final File trustStoreFile) throws VaultException {
try (final InputStream inputStream = new FileInputStream(trustStoreFile)) {
Expand All @@ -205,11 +204,11 @@ public SslConfig trustStoreFile(final File trustStoreFile) throws VaultException
* the JKS file into your library or application's JAR/WAR/EAR file).</p>
*
* <p>Note that you cannot mix-and-match JKS based config with PEM based config. If any of the keyStore or
* trustStore setters are used, then the {@link this#build()} method will complete ignore any PEM data that was
* set.</p>
* trustStore setters are used, then the build() method will complete ignore any PEM data that was set.</p>
*
* @param classpathResource A JKS truststore file, containing the Vault server's X509 certificate
* @return This object, with trustStore populated, ready for additional builder-pattern method calls or else finalization with the build() method
* @throws VaultException If any error occurs while loading the truststore
*/
public SslConfig trustStoreResource(final String classpathResource) throws VaultException {
try (final InputStream inputStream = this.getClass().getResourceAsStream(classpathResource)) {
Expand Down Expand Up @@ -320,7 +319,7 @@ public SslConfig pemResource(final String classpathResource) throws VaultExcepti

/**
* <p>An X.509 client certificate, for use with Vault's TLS Certificate auth backend. This string should meet
* the same formatting requirements as {@link this#pemUTF8(String)}.</p>
* the same formatting requirements as pemUTF8(String).</p>
*
* @param clientPemUTF8 An X.509 client certificate, in unencrypted PEM format with UTF-8 encoding.
* @return This object, with clientPemUTF8 populated, ready for additional builder-pattern method calls or else finalization with the build() method
Expand All @@ -334,8 +333,7 @@ public SslConfig clientPemUTF8(final String clientPemUTF8) {

/**
* <p>An X.509 client certificate, for use with Vault's TLS Certificate auth backend. This method accepts the
* path of a file containing the certificate data. This file should meet the same requirements as
* {@link this#pemFile(File)}.</p>
* path of a file containing the certificate data. This file should meet the same requirements as pemFile(File).</p>
*
* @param clientPemFile The path of a file containing an X.509 certificate, in unencrypted PEM format with UTF-8 encoding.
* @return This object, with clientPemUTF8 populated, ready for additional builder-pattern method calls or else finalization with the build() method
Expand All @@ -355,8 +353,7 @@ public SslConfig clientPemFile(final File clientPemFile) throws VaultException {
/**
* <p>An X.509 certificate, for use with Vault's TLS Certificate auth backend. This method accepts the path of
* a classpath resource containing the certificate data (e.g. you've bundled the cert into your library or
* application's JAR/WAR/EAR file). This resource's contents should meet the same requirements as
* {@link this#pemResource(String)}.</p>
* application's JAR/WAR/EAR file). This resource's contents should meet the same requirements as pemResource(String).</p>
*
* @param classpathResource The path of a classpath resource containing an X.509 certificate, in unencrypted PEM format with UTF-8 encoding.
* @return This object, with clientPemUTF8 populated, ready for additional builder-pattern method calls or else finalization with the build() method
Expand Down Expand Up @@ -401,6 +398,7 @@ public SslConfig clientKeyPemUTF8(final String clientKeyPemUTF8) {
*
* @param clientKeyPemFile The path of a file containing an RSA private key, in unencrypted PEM format with UTF-8 encoding.
* @return This object, with clientKeyPemUTF8 populated, ready for additional builder-pattern method calls or else finalization with the build() method
* @throws VaultException If any error occurs while loading and parsing the PEM file
*/
public SslConfig clientKeyPemFile(final File clientKeyPemFile) throws VaultException {
try (final InputStream input = new FileInputStream(clientKeyPemFile)){
Expand All @@ -423,6 +421,7 @@ public SslConfig clientKeyPemFile(final File clientKeyPemFile) throws VaultExcep
*
* @param classpathResource The path of a classpath resource containing an RSA private key, in unencrypted PEM format with UTF-8 encoding.
* @return This object, with clientKeyPemUTF8 populated, ready for additional builder-pattern method calls or else finalization with the build() method
* @throws VaultException If any error occurs while loading and parsing the PEM file
*/
public SslConfig clientKeyPemResource(final String classpathResource) throws VaultException {
try (final InputStream input = this.getClass().getResourceAsStream(classpathResource)){
Expand Down Expand Up @@ -634,13 +633,13 @@ private static String inputStreamToUTF8(final InputStream input) throws IOExcept
* <p>Therefore, that member field is declared <code>transient</code>. This means that if an SslConfig object is
* serialized, its member field will be <code>null</code> after deserialization. Fortunately, the Java
* deserialization process provides this lifecycle hook, which is used here to re-populate the
* {@link this#sslContext} member field.</p>
* sslContext member field.</p>
*
* @see Serializable
*
* @param in
* @throws IOException
* @throws ClassNotFoundException
* @param in The object being deserialized
* @throws IOException If an error occurs during deserialization (part of the default Java process)
* @throws ClassNotFoundException If an error occurs during deserialization (part of the default Java process)
*/
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {//NOPMD
try {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/bettercloud/vault/VaultConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* <p>A container for the configuration settings needed to initialize a <code>Vault</code> driver instance.</p>
*
* <p>Construct instances of this class using a builder pattern, calling setter methods for each value and then
* terminating with a call to {@link this#build()}:</p>
* terminating with a call to build():</p>
*
* <blockquote>
* <pre>{@code
Expand Down Expand Up @@ -49,7 +49,7 @@ public class VaultConfig implements Serializable {
* <code>protected</code> access level).</p>
*
* @param environmentLoader An environment variable loader implementation (presumably a mock)
* @return This object, with environmentLoader populated, ready for additional builder-pattern method calls or else finalization with the {@link this#build()} method
* @return This object, with environmentLoader populated, ready for additional builder-pattern method calls or else finalization with the build() method
*/
protected VaultConfig environmentLoader(final EnvironmentLoader environmentLoader) {
this.environmentLoader = environmentLoader;
Expand Down
Loading