Skip to content

Commit 800730f

Browse files
committed
Polishing.
Update RequestConfig. Upgrade to newer Vault version. Closes gh-727, closes gh-728
1 parent ebd734b commit 800730f

File tree

3 files changed

+58
-28
lines changed

3 files changed

+58
-28
lines changed

pom.xml

+51-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<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">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
35
<modelVersion>4.0.0</modelVersion>
46

57
<groupId>org.springframework.vault</groupId>
@@ -27,10 +29,10 @@
2729
<kotlin-coroutines.version>1.6.2</kotlin-coroutines.version>
2830
<mockk.version>1.12.4</mockk.version>
2931
<mockito-core.version>4.6.1</mockito-core.version>
30-
<spring.version>6.0.0-SNAPSHOT</spring.version>
31-
<spring-data-bom.version>2022.0.0-M5</spring-data-bom.version>
32+
<spring.version>6.0.0-RC1</spring.version>
33+
<spring-data-bom.version>2022.0.0-RC1</spring-data-bom.version>
3234
<spring-security-bom.version>6.0.0-M6</spring-security-bom.version>
33-
<reactor.version>2022.0.0-M4</reactor.version>
35+
<reactor.version>2022.0.0-RC1</reactor.version>
3436
<java.version>17</java.version>
3537
<project.type>multi</project.type>
3638
<dist.id>spring-vault</dist.id>
@@ -39,7 +41,7 @@
3941
<doc.resources>${project.build.directory}/doc-resources</doc.resources>
4042

4143
<!-- To be overridden by individual modules -->
42-
<java-module-name />
44+
<java-module-name/>
4345
</properties>
4446

4547
<inceptionYear>2016</inceptionYear>
@@ -319,6 +321,26 @@
319321
</executions>
320322
</plugin>
321323

324+
<plugin>
325+
<groupId>org.apache.maven.plugins</groupId>
326+
<artifactId>maven-enforcer-plugin</artifactId>
327+
<executions>
328+
<execution>
329+
<id>enforce-java-version</id>
330+
<goals>
331+
<goal>enforce</goal>
332+
</goals>
333+
<configuration>
334+
<rules>
335+
<requireJavaVersion>
336+
<version>17</version>
337+
</requireJavaVersion>
338+
</rules>
339+
</configuration>
340+
</execution>
341+
</executions>
342+
</plugin>
343+
322344
<plugin>
323345
<groupId>org.apache.maven.plugins</groupId>
324346
<artifactId>maven-surefire-plugin</artifactId>
@@ -437,6 +459,12 @@
437459
</configuration>
438460
</plugin>
439461

462+
<plugin>
463+
<groupId>org.apache.maven.plugins</groupId>
464+
<artifactId>maven-enforcer-plugin</artifactId>
465+
<version>3.1.0</version>
466+
</plugin>
467+
440468
<plugin>
441469
<groupId>org.apache.maven.plugins</groupId>
442470
<artifactId>maven-surefire-plugin</artifactId>
@@ -492,7 +520,8 @@
492520
<link>
493521
https://projectreactor.io/docs/core/release/api/
494522
</link>
495-
<link>https://docs.oracle.com/en/java/javase/17/docs/api/</link>
523+
<link>https://docs.oracle.com/en/java/javase/17/docs/api/
524+
</link>
496525
</links>
497526
</configuration>
498527
</plugin>
@@ -671,7 +700,6 @@
671700
<plugin>
672701
<groupId>org.apache.maven.plugins</groupId>
673702
<artifactId>maven-enforcer-plugin</artifactId>
674-
<version>3.1.0</version>
675703
<executions>
676704
<execution>
677705
<id>enforce-no-third-party-snapshots</id>
@@ -680,8 +708,9 @@
680708
</goals>
681709
<configuration>
682710
<rules>
683-
<requireReleaseDeps />
684-
<NoSnapshotDependenciesInDependencyManagementRule implementation="de.smartics.maven.enforcer.rule.NoSnapshotsInDependencyManagementRule">
711+
<requireReleaseDeps/>
712+
<NoSnapshotDependenciesInDependencyManagementRule
713+
implementation="de.smartics.maven.enforcer.rule.NoSnapshotsInDependencyManagementRule">
685714
<onlyWhenRelease>true</onlyWhenRelease>
686715
</NoSnapshotDependenciesInDependencyManagementRule>
687716
</rules>
@@ -741,7 +770,8 @@
741770
<snapshotRepository>
742771
<id>sonatype-nexus-snapshots</id>
743772
<name>Sonatype Nexus Snapshots</name>
744-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
773+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/
774+
</url>
745775
</snapshotRepository>
746776
<repository>
747777
<id>sonatype-nexus-staging</id>
@@ -854,15 +884,21 @@
854884
<includeEnvVars>false</includeEnvVars>
855885
</artifactory>
856886
<publisher>
857-
<contextUrl>{{artifactory.server}}</contextUrl>
887+
<contextUrl>{{artifactory.server}}
888+
</contextUrl>
858889
<username>{{artifactory.username}}</username>
859890
<password>{{artifactory.password}}</password>
860-
<repoKey>{{artifactory.staging-repository}}</repoKey>
861-
<snapshotRepoKey>{{artifactory.staging-repository}}</snapshotRepoKey>
891+
<repoKey>{{artifactory.staging-repository}}
892+
</repoKey>
893+
<snapshotRepoKey>
894+
{{artifactory.staging-repository}}
895+
</snapshotRepoKey>
862896
</publisher>
863897
<buildInfo>
864-
<buildName>{{artifactory.build-name}}</buildName>
865-
<buildNumber>{{artifactory.build-number}}</buildNumber>
898+
<buildName>{{artifactory.build-name}}
899+
</buildName>
900+
<buildNumber>{{artifactory.build-number}}
901+
</buildNumber>
866902
<buildUrl>{{BUILD_URL}}</buildUrl>
867903
</buildInfo>
868904
</configuration>

spring-vault-core/src/main/java/org/springframework/vault/client/ClientHttpRequestFactoryFactory.java

+5-11
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import org.apache.hc.client5.http.ssl.HttpsSupport;
5858
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
5959
import org.apache.hc.core5.http.io.SocketConfig;
60+
import org.apache.hc.core5.util.Timeout;
6061

6162
import org.springframework.http.client.ClientHttpRequestFactory;
6263
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
@@ -80,6 +81,7 @@
8081
*
8182
* @author Mark Paluch
8283
* @author Ryan Gow
84+
* @author Spencer Gibb
8385
* @since 2.2
8486
*/
8587
public class ClientHttpRequestFactoryFactory {
@@ -310,26 +312,18 @@ static ClientHttpRequestFactory usingHttpComponents(ClientOptions options, SslCo
310312
PoolingHttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder //
311313
.create().setSSLSocketFactory(sslSocketFactory) //
312314
.setDefaultSocketConfig(SocketConfig.custom() //
313-
.setSoTimeout(Math.toIntExact(options.getReadTimeout().toMillis()),
314-
TimeUnit.MILLISECONDS)
315-
.build()) //
315+
.setSoTimeout(Timeout.ofMilliseconds(options.getReadTimeout().toMillis())).build()) //
316316
.build(); //
317317
httpClientBuilder.setConnectionManager(connectionManager);
318318
}
319319

320320
RequestConfig requestConfig = RequestConfig.custom()
321-
//
322-
.setConnectTimeout(Math.toIntExact(options.getConnectionTimeout().toMillis()),
323-
TimeUnit.MILLISECONDS) //
321+
.setConnectTimeout(Timeout.ofMilliseconds(options.getConnectionTimeout().toMillis()))
324322
.setAuthenticationEnabled(true) //
325-
.build();
323+
.setRedirectsEnabled(true).build();
326324

327325
httpClientBuilder.setDefaultRequestConfig(requestConfig);
328326

329-
// Support redirects
330-
// TODO: DefaultRedirectStrategy doesn't take method into account
331-
// httpClientBuilder.setRedirectStrategy(new LaxRedirectStrategy());
332-
333327
return new HttpComponentsClientHttpRequestFactory(httpClientBuilder.build());
334328
}
335329

src/test/bash/install_vault.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
set -o errexit
99

1010
EDITION="${EDITION:-oss}"
11-
VAULT_OSS="${VAULT_OSS:-1.8.1}"
12-
VAULT_ENT="${VAULT_ENT:-1.8.1}"
11+
VAULT_OSS="${VAULT_OSS:-1.11.0}"
12+
VAULT_ENT="${VAULT_ENT:-1.11.0}"
1313
UNAME=$(uname -s | tr '[:upper:]' '[:lower:]')
1414
VERBOSE=false
1515
VAULT_DIRECTORY=vault

0 commit comments

Comments
 (0)