endpointProvider) {
@@ -96,6 +105,8 @@ public class VaultBootstrapConfiguration implements InitializingBean {
this.restOperations = VaultClients.createRestTemplate(endpointProvider,
clientHttpRequestFactory);
+
+ this.externalRestOperations = new RestTemplate(clientHttpRequestFactory);
}
/**
@@ -190,7 +201,7 @@ public class VaultBootstrapConfiguration implements InitializingBean {
public ClientAuthentication clientAuthentication() {
ClientAuthenticationFactory factory = new ClientAuthenticationFactory(
- vaultProperties, restOperations);
+ vaultProperties, restOperations, externalRestOperations);
return factory.createClientAuthentication();
}
diff --git a/spring-cloud-vault-config/src/main/java/org/springframework/cloud/vault/config/VaultProperties.java b/spring-cloud-vault-config/src/main/java/org/springframework/cloud/vault/config/VaultProperties.java
index 57406333..5fc55482 100644
--- a/spring-cloud-vault-config/src/main/java/org/springframework/cloud/vault/config/VaultProperties.java
+++ b/spring-cloud-vault-config/src/main/java/org/springframework/cloud/vault/config/VaultProperties.java
@@ -15,6 +15,8 @@
*/
package org.springframework.cloud.vault.config;
+import java.time.Duration;
+
import javax.validation.constraints.NotEmpty;
import lombok.Data;
@@ -100,6 +102,10 @@ public class VaultProperties implements EnvironmentAware {
private AzureMsiProperties azureMsi = new AzureMsiProperties();
+ private GcpGceProperties gcpGce = new GcpGceProperties();
+
+ private GcpIamProperties gcpIam = new GcpIamProperties();
+
private KubernetesProperties kubernetes = new KubernetesProperties();
private Ssl ssl = new Ssl();
@@ -265,6 +271,79 @@ public class VaultProperties implements EnvironmentAware {
private String role = "";
}
+ @Data
+ public static class GcpGceProperties {
+
+ /**
+ * Mount path of the Kubernetes authentication backend.
+ */
+ @NotEmpty
+ private String gcpPath = "gcp";
+
+ /**
+ * Name of the role against which the login is being attempted.
+ */
+ private String role = "";
+
+ /**
+ * Optional service account id. Using the default id if left unconfigured.
+ */
+ private String serviceAccount = "";
+ }
+
+ @Data
+ public static class GcpIamProperties {
+
+ /**
+ * Mount path of the Kubernetes authentication backend.
+ */
+ @NotEmpty
+ private String gcpPath = "gcp";
+
+ /**
+ * Name of the role against which the login is being attempted.
+ */
+ private String role = "";
+
+ /**
+ * Overrides the GCP project Id.
+ */
+ private String projectId = "";
+
+ /**
+ * Overrides the GCP service account Id.
+ */
+ private String serviceAccountId = "";
+
+ /**
+ * Validity of the JWT token.
+ */
+ private Duration jwtValidity = Duration.ofMinutes(15);
+
+ /**
+ * Credentials configuration.
+ */
+ private final GcpCredentials credentials = new GcpCredentials();
+ }
+
+ @Data
+ public static class GcpCredentials {
+
+ /**
+ * Location of the OAuth2 credentials private key.
+ *
+ *
+ * Since this is a Resource, the private key can be in a multitude of locations,
+ * such as a local file system, classpath, URL, etc.
+ */
+ private Resource location;
+
+ /**
+ * The base64 encoded contents of an OAuth2 account private key in JSON format.
+ */
+ private String encodedKey;
+ }
+
@Data
public static class KubernetesProperties {
@@ -345,6 +424,6 @@ public class VaultProperties implements EnvironmentAware {
}
public enum AuthenticationMethod {
- TOKEN, APPID, APPROLE, AWS_EC2, AWS_IAM, AZURE_MSI, CERT, CUBBYHOLE, KUBERNETES
+ TOKEN, APPID, APPROLE, AWS_EC2, AWS_IAM, AZURE_MSI, CERT, CUBBYHOLE, GCP_GCE, GCP_IAM, KUBERNETES
}
}