Polishing.

Update RequestConfig. Upgrade to newer Vault version.

Closes gh-727, closes gh-728
This commit is contained in:
Mark Paluch
2022-10-17 15:36:25 +02:00
parent ebd734baba
commit 800730f413
3 changed files with 58 additions and 28 deletions

66
pom.xml
View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.vault</groupId>
@@ -27,10 +29,10 @@
<kotlin-coroutines.version>1.6.2</kotlin-coroutines.version>
<mockk.version>1.12.4</mockk.version>
<mockito-core.version>4.6.1</mockito-core.version>
<spring.version>6.0.0-SNAPSHOT</spring.version>
<spring-data-bom.version>2022.0.0-M5</spring-data-bom.version>
<spring.version>6.0.0-RC1</spring.version>
<spring-data-bom.version>2022.0.0-RC1</spring-data-bom.version>
<spring-security-bom.version>6.0.0-M6</spring-security-bom.version>
<reactor.version>2022.0.0-M4</reactor.version>
<reactor.version>2022.0.0-RC1</reactor.version>
<java.version>17</java.version>
<project.type>multi</project.type>
<dist.id>spring-vault</dist.id>
@@ -39,7 +41,7 @@
<doc.resources>${project.build.directory}/doc-resources</doc.resources>
<!-- To be overridden by individual modules -->
<java-module-name />
<java-module-name/>
</properties>
<inceptionYear>2016</inceptionYear>
@@ -319,6 +321,26 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-java-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>17</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -437,6 +459,12 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -492,7 +520,8 @@
<link>
https://projectreactor.io/docs/core/release/api/
</link>
<link>https://docs.oracle.com/en/java/javase/17/docs/api/</link>
<link>https://docs.oracle.com/en/java/javase/17/docs/api/
</link>
</links>
</configuration>
</plugin>
@@ -671,7 +700,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>enforce-no-third-party-snapshots</id>
@@ -680,8 +708,9 @@
</goals>
<configuration>
<rules>
<requireReleaseDeps />
<NoSnapshotDependenciesInDependencyManagementRule implementation="de.smartics.maven.enforcer.rule.NoSnapshotsInDependencyManagementRule">
<requireReleaseDeps/>
<NoSnapshotDependenciesInDependencyManagementRule
implementation="de.smartics.maven.enforcer.rule.NoSnapshotsInDependencyManagementRule">
<onlyWhenRelease>true</onlyWhenRelease>
</NoSnapshotDependenciesInDependencyManagementRule>
</rules>
@@ -741,7 +770,8 @@
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/
</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
@@ -854,15 +884,21 @@
<includeEnvVars>false</includeEnvVars>
</artifactory>
<publisher>
<contextUrl>{{artifactory.server}}</contextUrl>
<contextUrl>{{artifactory.server}}
</contextUrl>
<username>{{artifactory.username}}</username>
<password>{{artifactory.password}}</password>
<repoKey>{{artifactory.staging-repository}}</repoKey>
<snapshotRepoKey>{{artifactory.staging-repository}}</snapshotRepoKey>
<repoKey>{{artifactory.staging-repository}}
</repoKey>
<snapshotRepoKey>
{{artifactory.staging-repository}}
</snapshotRepoKey>
</publisher>
<buildInfo>
<buildName>{{artifactory.build-name}}</buildName>
<buildNumber>{{artifactory.build-number}}</buildNumber>
<buildName>{{artifactory.build-name}}
</buildName>
<buildNumber>{{artifactory.build-number}}
</buildNumber>
<buildUrl>{{BUILD_URL}}</buildUrl>
</buildInfo>
</configuration>

View File

@@ -57,6 +57,7 @@ import org.apache.hc.client5.http.impl.routing.SystemDefaultRoutePlanner;
import org.apache.hc.client5.http.ssl.HttpsSupport;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.util.Timeout;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
@@ -80,6 +81,7 @@ import org.springframework.vault.support.SslConfiguration.KeyStoreConfiguration;
*
* @author Mark Paluch
* @author Ryan Gow
* @author Spencer Gibb
* @since 2.2
*/
public class ClientHttpRequestFactoryFactory {
@@ -310,26 +312,18 @@ public class ClientHttpRequestFactoryFactory {
PoolingHttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder //
.create().setSSLSocketFactory(sslSocketFactory) //
.setDefaultSocketConfig(SocketConfig.custom() //
.setSoTimeout(Math.toIntExact(options.getReadTimeout().toMillis()),
TimeUnit.MILLISECONDS)
.build()) //
.setSoTimeout(Timeout.ofMilliseconds(options.getReadTimeout().toMillis())).build()) //
.build(); //
httpClientBuilder.setConnectionManager(connectionManager);
}
RequestConfig requestConfig = RequestConfig.custom()
//
.setConnectTimeout(Math.toIntExact(options.getConnectionTimeout().toMillis()),
TimeUnit.MILLISECONDS) //
.setConnectTimeout(Timeout.ofMilliseconds(options.getConnectionTimeout().toMillis()))
.setAuthenticationEnabled(true) //
.build();
.setRedirectsEnabled(true).build();
httpClientBuilder.setDefaultRequestConfig(requestConfig);
// Support redirects
// TODO: DefaultRedirectStrategy doesn't take method into account
// httpClientBuilder.setRedirectStrategy(new LaxRedirectStrategy());
return new HttpComponentsClientHttpRequestFactory(httpClientBuilder.build());
}

View File

@@ -8,8 +8,8 @@
set -o errexit
EDITION="${EDITION:-oss}"
VAULT_OSS="${VAULT_OSS:-1.8.1}"
VAULT_ENT="${VAULT_ENT:-1.8.1}"
VAULT_OSS="${VAULT_OSS:-1.11.0}"
VAULT_ENT="${VAULT_ENT:-1.11.0}"
UNAME=$(uname -s | tr '[:upper:]' '[:lower:]')
VERBOSE=false
VAULT_DIRECTORY=vault