Build against Spring Vault 3.0 snapshots
See gh-644
This commit is contained in:
@@ -353,7 +353,7 @@ If one is not supplied then the friendly name of the current IAM user will be us
|
||||
* `server-name` sets the value to use for the `X-Vault-AWS-IAM-Server-ID` header preventing certain types of replay attacks.
|
||||
* `endpoint-uri` sets the value to use for the AWS STS API used for the `iam_request_url` parameter.
|
||||
|
||||
AWS-IAM requires the AWS Java SDK dependency (`com.amazonaws:aws-java-sdk-core`) as the authentication implementation uses AWS SDK types for credentials and request signing.
|
||||
AWS-IAM requires the AWS Java SDK v2 dependency (`software.amazon.awssdk:auth`) as the authentication implementation uses AWS SDK types for credentials and request signing.
|
||||
|
||||
See also: https://www.vaultproject.io/docs/auth/aws.html[Vault Documentation: Using the aws auth backend]
|
||||
|
||||
|
||||
@@ -96,24 +96,20 @@
|
||||
<groupId>io.projectreactor.netty</groupId>
|
||||
<artifactId>reactor-netty</artifactId>
|
||||
<optional>true</optional>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.projectreactor.netty</groupId>
|
||||
<artifactId>reactor-netty-http-brave</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- AWS -->
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-java-sdk-core</artifactId>
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<artifactId>auth</artifactId>
|
||||
<version>2.17.195</version>
|
||||
<optional>true</optional>
|
||||
<version>1.11.865</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>software.amazon.ion</groupId>
|
||||
<artifactId>ion-java</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-cbor</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- BouncyCastle -->
|
||||
@@ -130,12 +126,6 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.cloud</groupId>
|
||||
<artifactId>google-cloud-iamcredentials</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.cloud</groupId>
|
||||
<artifactId>google-cloud-iamcredentials</artifactId>
|
||||
|
||||
@@ -22,9 +22,9 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import com.amazonaws.auth.AWSCredentials;
|
||||
import com.amazonaws.auth.AWSCredentialsProvider;
|
||||
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
|
||||
import software.amazon.awssdk.auth.credentials.AwsCredentials;
|
||||
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
|
||||
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.boot.system.SystemProperties;
|
||||
@@ -277,7 +277,7 @@ class ClientAuthenticationFactory {
|
||||
|
||||
AwsIamProperties awsIam = vaultProperties.getAwsIam();
|
||||
|
||||
AWSCredentialsProvider credentialsProvider = AwsCredentialProvider.getAwsCredentialsProvider();
|
||||
AwsCredentialsProvider credentialsProvider = AwsCredentialProvider.getAwsCredentialsProvider();
|
||||
|
||||
AwsIamAuthenticationOptionsBuilder builder = AwsIamAuthenticationOptions.builder();
|
||||
|
||||
@@ -429,32 +429,27 @@ class ClientAuthenticationFactory {
|
||||
|
||||
private static class AwsCredentialProvider {
|
||||
|
||||
private static AWSCredentialsProvider getAwsCredentialsProvider() {
|
||||
private static AwsCredentialsProvider getAwsCredentialsProvider() {
|
||||
|
||||
DefaultAWSCredentialsProviderChain backingCredentialsProvider = DefaultAWSCredentialsProviderChain
|
||||
.getInstance();
|
||||
DefaultCredentialsProvider backingCredentialsProvider = DefaultCredentialsProvider.create();
|
||||
|
||||
// Eagerly fetch credentials preventing lag during the first, actual login.
|
||||
AWSCredentials firstAccess = backingCredentialsProvider.getCredentials();
|
||||
AwsCredentials firstAccess = backingCredentialsProvider.resolveCredentials();
|
||||
|
||||
AtomicReference<AWSCredentials> once = new AtomicReference<>(firstAccess);
|
||||
AtomicReference<AwsCredentials> once = new AtomicReference<>(firstAccess);
|
||||
|
||||
return new AWSCredentialsProvider() {
|
||||
return new AwsCredentialsProvider() {
|
||||
|
||||
@Override
|
||||
public AWSCredentials getCredentials() {
|
||||
public AwsCredentials resolveCredentials() {
|
||||
|
||||
if (once.compareAndSet(firstAccess, null)) {
|
||||
return firstAccess;
|
||||
}
|
||||
|
||||
return backingCredentialsProvider.getCredentials();
|
||||
return backingCredentialsProvider.resolveCredentials();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
backingCredentialsProvider.refresh();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -51,14 +51,14 @@ public class VaultBootstrapPropertySourceConfigurationTests {
|
||||
.withPropertyValues("spring.cloud.vault.kv.enabled=false",
|
||||
"spring.cloud.vault.config.lifecycle.expiry-threshold=5m",
|
||||
"spring.cloud.vault.config.lifecycle.min-renewal=6m",
|
||||
"spring.cloud.vault.config.lifecycle.lease-endpoints=SysLeases",
|
||||
"spring.cloud.vault.config.lifecycle.lease-endpoints=Leases",
|
||||
"spring.cloud.bootstrap.enabled=true")
|
||||
.run(context -> {
|
||||
|
||||
SecretLeaseContainer container = context.getBean(SecretLeaseContainer.class);
|
||||
verify(container).setExpiryThreshold(Duration.ofMinutes(5));
|
||||
verify(container).setMinRenewal(Duration.ofMinutes(6));
|
||||
verify(container).setLeaseEndpoints(LeaseEndpoints.SysLeases);
|
||||
verify(container).setLeaseEndpoints(LeaseEndpoints.Leases);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.vault.client.ClientHttpRequestFactoryFactory;
|
||||
import org.springframework.vault.client.VaultClients;
|
||||
import org.springframework.vault.client.VaultEndpoint;
|
||||
import org.springframework.vault.config.ClientHttpRequestFactoryFactory;
|
||||
import org.springframework.vault.support.ClientOptions;
|
||||
import org.springframework.vault.support.SslConfiguration;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<description>Spring Cloud Vault Dependencies</description>
|
||||
|
||||
<properties>
|
||||
<spring-vault.version>2.3.2</spring-vault.version>
|
||||
<spring-vault.version>3.0.0-SNAPSHOT</spring-vault.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
Reference in New Issue
Block a user