This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new d4c644f83f87 CAMEL-27918: camel-hashicorp-vault - the gcp-iam login
(#31187)
d4c644f83f87 is described below
commit d4c644f83f876b25a934e93624e5bcfd7aeecbab
Author: Andrea Cosentino <[email protected]>
AuthorDate: Wed Dec 2 11:54:25 2026 +0100
CAMEL-27918: camel-hashicorp-vault - the gcp-iam login (#31187)
The gcp-iam login of the HashiCorp Vault component signs a JWT for a Google
service
account through the IAM Credentials API, for a Vault GCP role of type iam,
and also works
outside Compute Engine. New options gcpServiceAccountId and
gcpCredentialsFile (service
account key or external account configuration, read by the loader of its
type); without
a file the Application Default Credentials are used. Available as endpoint
options,
camel.vault.hashicorp options and environment variables.
Claude Code on behalf of oscerd.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../camel/catalog/components/hashicorp-vault.json | 28 +--
.../catalog/docs/hashicorp-vault-component.adoc | 18 +-
.../org/apache/camel/catalog/docs/main.adoc | 10 +-
.../main/camel-main-configuration-metadata.json | 8 +-
components/camel-hashicorp-vault/pom.xml | 8 +
.../vault/HashicorpVaultEndpointConfigurer.java | 12 +
.../vault/HashicorpVaultEndpointUriFactory.java | 4 +-
.../component/hashicorp/vault/hashicorp-vault.json | 28 +--
.../src/main/docs/hashicorp-vault-component.adoc | 18 +-
.../vault/HashicorpVaultAuthentication.java | 3 +-
.../hashicorp/vault/HashicorpVaultClient.java | 12 +
.../vault/HashicorpVaultClientSettings.java | 26 ++-
.../vault/HashicorpVaultConfiguration.java | 46 +++-
.../hashicorp/vault/HashicorpVaultEndpoint.java | 2 +
.../hashicorp/vault/HashicorpVaultGcpIam.java | 118 ++++++++++
.../vault/HashicorpVaultPropertiesFunction.java | 5 +-
.../vault/HashicorpVaultClientSettingsTest.java | 11 +-
.../hashicorp/vault/HashicorpVaultClientTest.java | 2 +-
.../hashicorp/vault/HashicorpVaultGcpIamTest.java | 253 +++++++++++++++++++++
.../camel/vault/HashicorpVaultConfiguration.java | 59 ++++-
.../HashicorpVaultConfigurationConfigurer.java | 12 +
...corpVaultConfigurationPropertiesConfigurer.java | 14 ++
.../camel-main-configuration-metadata.json | 8 +-
.../org/apache/camel/main/main-options.properties | 2 +
core/camel-main/src/main/docs/main.adoc | 10 +-
.../HashicorpVaultConfigurationProperties.java | 18 ++
.../dsl/HashicorpVaultEndpointBuilderFactory.java | 56 ++++-
parent/pom.xml | 1 +
28 files changed, 721 insertions(+), 71 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hashicorp-vault.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hashicorp-vault.json
index 72534b06d1c2..c1bb4a033084 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hashicorp-vault.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hashicorp-vault.json
@@ -49,23 +49,25 @@
"secretPath": { "index": 7, "kind": "parameter", "displayName": "Secret
Path", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The path of the secret
in the secrets engine, such as myapp\/database, for the createSecret, getS [...]
"vaultTemplate": { "index": 8, "kind": "parameter", "displayName": "Vault
Template", "group": "producer", "label": "", "required": false, "type":
"object", "javaType": "org.springframework.vault.core.VaultTemplate",
"deprecated": false, "autowired": true, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The Spring Vault
VaultTemplate to access HashiCorp Vault with, i [...]
"lazyStartProducer": { "index": 9, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
- "authentication": { "index": 10, "kind": "parameter", "displayName":
"Authentication", "group": "security", "label": "security", "required": false,
"type": "enum", "javaType": "java.lang.String", "enum": [ "token", "approle",
"kubernetes", "jwt", "cert", "aws-iam", "azure-msi", "gcp-gce" ], "deprecated":
false, "autowired": false, "secret": false, "defaultValue": "token",
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationFie [...]
- "authMountPath": { "index": 11, "kind": "parameter", "displayName": "Auth
Mount Path", "group": "security", "label": "security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The path the login
method is mounted at in HashiCorp Vault (without auth\/), when [...]
+ "authentication": { "index": 10, "kind": "parameter", "displayName":
"Authentication", "group": "security", "label": "security", "required": false,
"type": "enum", "javaType": "java.lang.String", "enum": [ "token", "approle",
"kubernetes", "jwt", "cert", "aws-iam", "azure-msi", "gcp-gce", "gcp-iam" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"token", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"confi [...]
+ "authMountPath": { "index": 11, "kind": "parameter", "displayName": "Auth
Mount Path", "group": "security", "label": "security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The path the login
method is mounted at in HashiCorp Vault (without auth\/), when [...]
"awsIamServerId": { "index": 12, "kind": "parameter", "displayName": "Aws
Iam Server Id", "group": "security", "label": "security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The value of the
X-Vault-AWS-IAM-Server-ID header of the aws-iam login, when t [...]
"awsRegion": { "index": 13, "kind": "parameter", "displayName": "Aws
Region", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The AWS region the
aws-iam login signs its request for, which must be the region of awsSts [...]
"awsStsEndpoint": { "index": 14, "kind": "parameter", "displayName": "Aws
Sts Endpoint", "group": "security", "label": "security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The AWS STS endpoint of
the aws-iam login, which the AWS login of HashiCorp Vau [...]
"azureClientId": { "index": 15, "kind": "parameter", "displayName": "Azure
Client Id", "group": "security", "label": "security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The client ID of a
user-assigned managed identity, for the azure-msi login. When [...]
"azureResource": { "index": 16, "kind": "parameter", "displayName": "Azure
Resource", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "https:\/\/management.azure.com\/",
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The resource (audience)
of the [...]
- "jwt": { "index": 17, "kind": "parameter", "displayName": "Jwt", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The JWT to log in with,
for the jwt and kubernetes logins. For a JWT that is repla [...]
- "jwtFile": { "index": 18, "kind": "parameter", "displayName": "Jwt File",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file to read the JWT
from at every login, for the jwt and kubernetes logins. The kubernete [...]
- "keyStore": { "index": 19, "kind": "parameter", "displayName": "Key
Store", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file with the TLS
client certificate and its private key, which the endpoint presents to [...]
- "keyStorePassword": { "index": 20, "kind": "parameter", "displayName":
"Key Store Password", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The password of the key
store and of its private key, [...]
- "role": { "index": 21, "kind": "parameter", "displayName": "Role",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The HashiCorp Vault role
to log in as, for the kubernetes, jwt, cert, aws-iam, azure-msi and gcp-gce
[...]
- "roleId": { "index": 22, "kind": "parameter", "displayName": "Role Id",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The role ID of the
AppRole, for the approle login" },
- "secretId": { "index": 23, "kind": "parameter", "displayName": "Secret
Id", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The secret ID of the
AppRole, for the approle login" },
- "sslContextParameters": { "index": 24, "kind": "parameter", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The TLS configuration of
the conn [...]
- "token": { "index": 25, "kind": "parameter", "displayName": "Token",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The HashiCorp Vault
token, for the token login, sent with every request to Vau [...]
- "trustStore": { "index": 26, "kind": "parameter", "displayName": "Trust
Store", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file with the
certificates to trust for the TLS connection to HashiCorp Vault, such [...]
- "trustStorePassword": { "index": 27, "kind": "parameter", "displayName":
"Trust Store Password", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The password of the
trust store, when it is a PKCS [...]
+ "gcpCredentialsFile": { "index": 17, "kind": "parameter", "displayName":
"Gcp Credentials File", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file with the Google
credentials of the gcp-iam login: a service ac [...]
+ "gcpServiceAccountId": { "index": 18, "kind": "parameter", "displayName":
"Gcp Service Account Id", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The service account to
sign the JWT of the gcp-iam login as: its ema [...]
+ "jwt": { "index": 19, "kind": "parameter", "displayName": "Jwt", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The JWT to log in with,
for the jwt and kubernetes logins. For a JWT that is repla [...]
+ "jwtFile": { "index": 20, "kind": "parameter", "displayName": "Jwt File",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file to read the JWT
from at every login, for the jwt and kubernetes logins. The kubernete [...]
+ "keyStore": { "index": 21, "kind": "parameter", "displayName": "Key
Store", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file with the TLS
client certificate and its private key, which the endpoint presents to [...]
+ "keyStorePassword": { "index": 22, "kind": "parameter", "displayName":
"Key Store Password", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The password of the key
store and of its private key, [...]
+ "role": { "index": 23, "kind": "parameter", "displayName": "Role",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The HashiCorp Vault role
to log in as, for the kubernetes, jwt, cert, aws-iam, azure-msi, gcp-gce and
[...]
+ "roleId": { "index": 24, "kind": "parameter", "displayName": "Role Id",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The role ID of the
AppRole, for the approle login" },
+ "secretId": { "index": 25, "kind": "parameter", "displayName": "Secret
Id", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The secret ID of the
AppRole, for the approle login" },
+ "sslContextParameters": { "index": 26, "kind": "parameter", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The TLS configuration of
the conn [...]
+ "token": { "index": 27, "kind": "parameter", "displayName": "Token",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The HashiCorp Vault
token, for the token login, sent with every request to Vau [...]
+ "trustStore": { "index": 28, "kind": "parameter", "displayName": "Trust
Store", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file with the
certificates to trust for the TLS connection to HashiCorp Vault, such [...]
+ "trustStorePassword": { "index": 29, "kind": "parameter", "displayName":
"Trust Store Password", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The password of the
trust store, when it is a PKCS [...]
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/hashicorp-vault-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/hashicorp-vault-component.adoc
index a84f1dd10af2..b250af0fd112 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/hashicorp-vault-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/hashicorp-vault-component.adoc
@@ -89,10 +89,16 @@ it, Vault tries every certificate role that trusts the
certificate. The login ne
| `gcp-gce`
| `role`: the Vault role of the application, which logs in with the service
account of its Google Compute Engine
instance, see <<_cloud_logins,Cloud logins>>.
+
+| `gcp-iam`
+| `role`: the Vault role of the application, which logs in with a JWT signed
for a Google service account, see
+<<_cloud_logins,Cloud logins>>. `gcpServiceAccountId` names the service
account, unless the credentials are a service
+account key.
|===
When the login method is not mounted at its default path in Vault (`approle`,
`kubernetes`, `jwt`, `cert`, `aws` for
-`aws-iam`, `azure` for `azure-msi` or `gcp` for `gcp-gce`), set the path with
`authMountPath`, without `auth/`.
+`aws-iam`, `azure` for `azure-msi` or `gcp` for `gcp-gce` and `gcp-iam`), set
the path with `authMountPath`, without
+`auth/`.
Camel renews the token before it expires, and logs in again when the token can
no longer be renewed, such as when it
reached its maximum time to live. A JWT read from a file is read again at
every login, so a token that the platform
@@ -197,6 +203,16 @@ sets. A pod of Azure Kubernetes Service with workload
identity has a token in th
The `gcp-gce` login asks the metadata server of a Google Compute Engine
instance for an identity token of the default
service account of the instance, for a role of type `gce` of the GCP login of
Vault.
+The `gcp-iam` login signs a JWT for a Google service account through the IAM
Credentials API, for a role of type `iam`
+of the GCP login of Vault, also outside Compute Engine. It takes the Google
credentials of `gcpCredentialsFile`, a
+service account key or an external account configuration (workload identity
federation), or else those of the Google
+default chain (Application Default Credentials), such as the workload identity
of GKE.
+`gcpServiceAccountId` is the service account to sign the JWT as, by its email
or unique ID: it can be left out with a
+service account key, which names its service account. The credentials need the
`iam.serviceAccounts.signJwt`
+permission on that service account, such as with the Service Account Token
Creator role. The login needs the Google
+Cloud IAM Credentials library: add the
`com.google.cloud:google-cloud-iamcredentials` dependency, in the version of the
+Google Cloud libraries of the Camel Google components.
+
The metadata services are reached directly, never through an HTTP proxy.
=== OpenBao
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/main.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/main.adoc
index 5f2a2b7cc46a..cac1d8baee84 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/main.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/main.adoc
@@ -563,19 +563,21 @@ The camel.vault.kubernetescm supports 2 options, which
are listed below.
=== Camel Hashicorp Vault configurations
-The camel.vault.hashicorp supports 25 options, which are listed below.
+The camel.vault.hashicorp supports 27 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| `camel.vault.hashicorp.authentication` | How to log in to hashicorp vault:
token (a fixed token), approle (a role ID and a secret ID), kubernetes (the
service account token of the pod), jwt (a JWT, such as a workload identity
token), cert (the TLS client certificate of the keyStore), aws-iam (the AWS
credentials of the application), azure-msi (the Azure managed identity) or
gcp-gce (the service account of the Google Compute Engine instance). Camel
renews the token before it expires, an [...]
-| `camel.vault.hashicorp.authMountPath` | The path the login method is mounted
at in hashicorp vault (without auth/), when it is not the default path of the
login method: approle, kubernetes, jwt, cert, aws (for aws-iam), azure (for
azure-msi) or gcp (for gcp-gce) | | String
+| `camel.vault.hashicorp.authentication` | How to log in to hashicorp vault:
token (a fixed token), approle (a role ID and a secret ID), kubernetes (the
service account token of the pod), jwt (a JWT, such as a workload identity
token), cert (the TLS client certificate of the keyStore), aws-iam (the AWS
credentials of the application), azure-msi (the Azure managed identity),
gcp-gce (the service account of the Google Compute Engine instance) or gcp-iam
(a JWT signed for a Google service a [...]
+| `camel.vault.hashicorp.authMountPath` | The path the login method is mounted
at in hashicorp vault (without auth/), when it is not the default path of the
login method: approle, kubernetes, jwt, cert, aws (for aws-iam), azure (for
azure-msi) or gcp (for gcp-gce and gcp-iam) | | String
| `camel.vault.hashicorp.awsIamServerId` | The value of the
X-Vault-AWS-IAM-Server-ID header of the aws-iam login, when the AWS login of
hashicorp vault requires one (iam_server_id_header_value) | | String
| `camel.vault.hashicorp.awsRegion` | The AWS region the aws-iam login signs
its request for, which must be the region of awsStsEndpoint. When not set:
us-east-1 with the global endpoint, else the region of the AWS SDK default
region chain (such as the AWS_REGION environment variable). | | String
| `camel.vault.hashicorp.awsStsEndpoint` | The AWS STS endpoint of the aws-iam
login, which the AWS login of hashicorp vault must accept (its sts_endpoint).
When not set, the global endpoint \https://sts.amazonaws.com/. | | String
| `camel.vault.hashicorp.azureClientId` | The client ID of a user-assigned
managed identity, for the azure-msi login. When not set, the system-assigned
managed identity. | | String
| `camel.vault.hashicorp.azureResource` | The resource (audience) of the
managed identity token of the azure-msi login, which must be the resource of
the Azure login of hashicorp vault | https://management.azure.com/ | String
| `camel.vault.hashicorp.cloud` | Whether hashicorp vault runs on HashiCorp
Cloud Platform: Camel then logs in and reads the secrets in namespace. | false
| boolean
+| `camel.vault.hashicorp.gcpCredentialsFile` | The file with the Google
credentials of the gcp-iam login: a service account key, or an external account
configuration (workload identity federation). When not set, the credentials of
the Google default chain (Application Default Credentials), such as the
workload identity of GKE. | | String
+| `camel.vault.hashicorp.gcpServiceAccountId` | The service account to sign
the JWT of the gcp-iam login as: its email address or its unique ID. It can be
left out when the credentials are a service account key, which names its
service account. | | String
| `camel.vault.hashicorp.host` | Host to access hashicorp vault | | String
| `camel.vault.hashicorp.jwt` | The JWT to log in with, for the jwt and
kubernetes logins. For a JWT that is replaced over time, such as a projected
service account token, use jwtFile instead. | | String
| `camel.vault.hashicorp.jwtFile` | The file to read the JWT from at every
login, for the jwt and kubernetes logins. The kubernetes login reads
/var/run/secrets/kubernetes.io/serviceaccount/token when neither jwt nor
jwtFile is set. | | String
@@ -585,7 +587,7 @@ The camel.vault.hashicorp supports 25 options, which are
listed below.
| `camel.vault.hashicorp.port` | Port to access hashicorp vault | | String
| `camel.vault.hashicorp.refreshEnabled` | Whether to reload the CamelContext
when a new version of a secret is written in hashicorp vault. Camel reads the
current version of each secret from its metadata (KV secrets engine version 2)
every refreshPeriod. | false | boolean
| `camel.vault.hashicorp.refreshPeriod` | The period (millis) between checking
Hashicorp Vault for updated secrets. | 60000 | long
-| `camel.vault.hashicorp.role` | The hashicorp vault role to log in as, for
the kubernetes, jwt, cert, aws-iam, azure-msi and gcp-gce logins. The jwt login
can leave it out when the login method has a default role, the aws-iam login to
log in as the role named as the IAM principal, and the cert login to let Vault
pick the certificate role that trusts the certificate. | | String
+| `camel.vault.hashicorp.role` | The hashicorp vault role to log in as, for
the kubernetes, jwt, cert, aws-iam, azure-msi, gcp-gce and gcp-iam logins. The
jwt login can leave it out when the login method has a default role, the
aws-iam login to log in as the role named as the IAM principal, and the cert
login to let Vault pick the certificate role that trusts the certificate. | |
String
| `camel.vault.hashicorp.roleId` | The role ID of the AppRole, for the approle
login | | String
| `camel.vault.hashicorp.scheme` | The scheme to access hashicorp vault: http
or https. | | String
| `camel.vault.hashicorp.secretId` | The secret ID of the AppRole, for the
approle login | | String
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index 5f20813ccc9e..adfc0732db73 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -617,14 +617,16 @@
{ "name": "camel.vault.gcp.serviceAccountKey", "required": false,
"description": "The JSON key file of the service account to authenticate with,
loaded as a resource: from the classpath by default, or from the file system
with the file: prefix.", "sourceType":
"org.apache.camel.vault.GcpVaultConfiguration", "type": "string", "javaType":
"java.lang.String", "secret": true, "security": "secret" },
{ "name": "camel.vault.gcp.subscriptionName", "required": false,
"description": "The name of the Google Cloud Pub\/Sub subscription, in the
project in projectId, that receives the Secret Manager events, for the secret
refresh.", "sourceType": "org.apache.camel.vault.GcpVaultConfiguration",
"type": "string", "javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.gcp.useDefaultInstance", "required": false,
"description": "Whether to authenticate with the Application Default
Credentials of the Google Cloud client libraries, when serviceAccountKey is not
set. Requires projectId.", "sourceType":
"org.apache.camel.vault.GcpVaultConfiguration", "type": "boolean", "javaType":
"boolean", "defaultValue": false, "secret": false },
- { "name": "camel.vault.hashicorp.authentication", "required": false,
"description": "How to log in to hashicorp vault: token (a fixed token),
approle (a role ID and a secret ID), kubernetes (the service account token of
the pod), jwt (a JWT, such as a workload identity token), cert (the TLS client
certificate of the keyStore), aws-iam (the AWS credentials of the application),
azure-msi (the Azure managed identity) or gcp-gce (the service account of the
Google Compute Engine instance) [...]
- { "name": "camel.vault.hashicorp.authMountPath", "required": false,
"description": "The path the login method is mounted at in hashicorp vault
(without auth\/), when it is not the default path of the login method: approle,
kubernetes, jwt, cert, aws (for aws-iam), azure (for azure-msi) or gcp (for
gcp-gce)", "sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration",
"type": "string", "javaType": "java.lang.String", "secret": false },
+ { "name": "camel.vault.hashicorp.authentication", "required": false,
"description": "How to log in to hashicorp vault: token (a fixed token),
approle (a role ID and a secret ID), kubernetes (the service account token of
the pod), jwt (a JWT, such as a workload identity token), cert (the TLS client
certificate of the keyStore), aws-iam (the AWS credentials of the application),
azure-msi (the Azure managed identity), gcp-gce (the service account of the
Google Compute Engine instance) o [...]
+ { "name": "camel.vault.hashicorp.authMountPath", "required": false,
"description": "The path the login method is mounted at in hashicorp vault
(without auth\/), when it is not the default path of the login method: approle,
kubernetes, jwt, cert, aws (for aws-iam), azure (for azure-msi) or gcp (for
gcp-gce and gcp-iam)", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.awsIamServerId", "required": false,
"description": "The value of the X-Vault-AWS-IAM-Server-ID header of the
aws-iam login, when the AWS login of hashicorp vault requires one
(iam_server_id_header_value)", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.awsRegion", "required": false,
"description": "The AWS region the aws-iam login signs its request for, which
must be the region of awsStsEndpoint. When not set: us-east-1 with the global
endpoint, else the region of the AWS SDK default region chain (such as the
AWS_REGION environment variable).", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.awsStsEndpoint", "required": false,
"description": "The AWS STS endpoint of the aws-iam login, which the AWS login
of hashicorp vault must accept (its sts_endpoint). When not set, the global
endpoint https:\/\/sts.amazonaws.com\/.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.azureClientId", "required": false,
"description": "The client ID of a user-assigned managed identity, for the
azure-msi login. When not set, the system-assigned managed identity.",
"sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration", "type":
"string", "javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.azureResource", "required": false,
"description": "The resource (audience) of the managed identity token of the
azure-msi login, which must be the resource of the Azure login of hashicorp
vault", "sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration",
"type": "string", "javaType": "java.lang.String", "defaultValue":
"https:\/\/management.azure.com\/", "secret": false },
{ "name": "camel.vault.hashicorp.cloud", "required": false, "description":
"Whether hashicorp vault runs on HashiCorp Cloud Platform: Camel then logs in
and reads the secrets in namespace.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "boolean",
"javaType": "boolean", "defaultValue": false, "secret": false },
+ { "name": "camel.vault.hashicorp.gcpCredentialsFile", "required": false,
"description": "The file with the Google credentials of the gcp-iam login: a
service account key, or an external account configuration (workload identity
federation). When not set, the credentials of the Google default chain
(Application Default Credentials), such as the workload identity of GKE.",
"sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration", "type":
"string", "javaType": "java.lang.String [...]
+ { "name": "camel.vault.hashicorp.gcpServiceAccountId", "required": false,
"description": "The service account to sign the JWT of the gcp-iam login as:
its email address or its unique ID. It can be left out when the credentials are
a service account key, which names its service account.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.host", "required": true, "description":
"Host to access hashicorp vault", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.jwt", "required": false, "description":
"The JWT to log in with, for the jwt and kubernetes logins. For a JWT that is
replaced over time, such as a projected service account token, use jwtFile
instead.", "sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration",
"type": "string", "javaType": "java.lang.String", "secret": true, "security":
"secret" },
{ "name": "camel.vault.hashicorp.jwtFile", "required": false,
"description": "The file to read the JWT from at every login, for the jwt and
kubernetes logins. The kubernetes login reads
\/var\/run\/secrets\/kubernetes.io\/serviceaccount\/token when neither jwt nor
jwtFile is set.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
@@ -634,7 +636,7 @@
{ "name": "camel.vault.hashicorp.port", "required": true, "description":
"Port to access hashicorp vault", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.refreshEnabled", "required": false,
"description": "Whether to reload the CamelContext when a new version of a
secret is written in hashicorp vault. Camel reads the current version of each
secret from its metadata (KV secrets engine version 2) every refreshPeriod.",
"sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration", "type":
"boolean", "javaType": "boolean", "defaultValue": false, "secret": false },
{ "name": "camel.vault.hashicorp.refreshPeriod", "required": false,
"description": "The period (millis) between checking Hashicorp Vault for
updated secrets.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "integer",
"javaType": "long", "defaultValue": 60000, "secret": false },
- { "name": "camel.vault.hashicorp.role", "required": false, "description":
"The hashicorp vault role to log in as, for the kubernetes, jwt, cert, aws-iam,
azure-msi and gcp-gce logins. The jwt login can leave it out when the login
method has a default role, the aws-iam login to log in as the role named as the
IAM principal, and the cert login to let Vault pick the certificate role that
trusts the certificate.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type" [...]
+ { "name": "camel.vault.hashicorp.role", "required": false, "description":
"The hashicorp vault role to log in as, for the kubernetes, jwt, cert, aws-iam,
azure-msi, gcp-gce and gcp-iam logins. The jwt login can leave it out when the
login method has a default role, the aws-iam login to log in as the role named
as the IAM principal, and the cert login to let Vault pick the certificate role
that trusts the certificate.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration [...]
{ "name": "camel.vault.hashicorp.roleId", "required": false,
"description": "The role ID of the AppRole, for the approle login",
"sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration", "type":
"string", "javaType": "java.lang.String", "secret": true, "security": "secret"
},
{ "name": "camel.vault.hashicorp.scheme", "required": true, "description":
"The scheme to access hashicorp vault: http or https.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.secretId", "required": false,
"description": "The secret ID of the AppRole, for the approle login",
"sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration", "type":
"string", "javaType": "java.lang.String", "secret": true, "security": "secret"
},
diff --git a/components/camel-hashicorp-vault/pom.xml
b/components/camel-hashicorp-vault/pom.xml
index 41d2fda85d48..680afaf6c080 100644
--- a/components/camel-hashicorp-vault/pom.xml
+++ b/components/camel-hashicorp-vault/pom.xml
@@ -62,6 +62,14 @@
<optional>true</optional>
</dependency>
+ <!-- the gcp-iam login: an application that uses it adds the
dependency -->
+ <dependency>
+ <groupId>com.google.cloud</groupId>
+ <artifactId>google-cloud-iamcredentials</artifactId>
+ <version>${google-cloud-iamcredentials-version}</version>
+ <optional>true</optional>
+ </dependency>
+
<!-- for testing -->
<dependency>
<groupId>org.apache.camel</groupId>
diff --git
a/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointConfigurer.java
b/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointConfigurer.java
index 022b8ea36dc2..7cb2f8abc0e6 100644
---
a/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointConfigurer.java
+++
b/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointConfigurer.java
@@ -38,6 +38,10 @@ public class HashicorpVaultEndpointConfigurer extends
PropertyConfigurerSupport
case "azureresource":
case "azureResource":
target.getConfiguration().setAzureResource(property(camelContext,
java.lang.String.class, value)); return true;
case "cloud":
target.getConfiguration().setCloud(property(camelContext, boolean.class,
value)); return true;
+ case "gcpcredentialsfile":
+ case "gcpCredentialsFile":
target.getConfiguration().setGcpCredentialsFile(property(camelContext,
java.lang.String.class, value)); return true;
+ case "gcpserviceaccountid":
+ case "gcpServiceAccountId":
target.getConfiguration().setGcpServiceAccountId(property(camelContext,
java.lang.String.class, value)); return true;
case "host": target.getConfiguration().setHost(property(camelContext,
java.lang.String.class, value)); return true;
case "jwt": target.getConfiguration().setJwt(property(camelContext,
java.lang.String.class, value)); return true;
case "jwtfile":
@@ -94,6 +98,10 @@ public class HashicorpVaultEndpointConfigurer extends
PropertyConfigurerSupport
case "azureresource":
case "azureResource": return java.lang.String.class;
case "cloud": return boolean.class;
+ case "gcpcredentialsfile":
+ case "gcpCredentialsFile": return java.lang.String.class;
+ case "gcpserviceaccountid":
+ case "gcpServiceAccountId": return java.lang.String.class;
case "host": return java.lang.String.class;
case "jwt": return java.lang.String.class;
case "jwtfile":
@@ -146,6 +154,10 @@ public class HashicorpVaultEndpointConfigurer extends
PropertyConfigurerSupport
case "azureresource":
case "azureResource": return
target.getConfiguration().getAzureResource();
case "cloud": return target.getConfiguration().isCloud();
+ case "gcpcredentialsfile":
+ case "gcpCredentialsFile": return
target.getConfiguration().getGcpCredentialsFile();
+ case "gcpserviceaccountid":
+ case "gcpServiceAccountId": return
target.getConfiguration().getGcpServiceAccountId();
case "host": return target.getConfiguration().getHost();
case "jwt": return target.getConfiguration().getJwt();
case "jwtfile":
diff --git
a/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointUriFactory.java
b/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointUriFactory.java
index 6728c5ae9635..6863ec023099 100644
---
a/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointUriFactory.java
+++
b/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointUriFactory.java
@@ -24,7 +24,7 @@ public class HashicorpVaultEndpointUriFactory extends
org.apache.camel.support.c
private static final Set<String> ENDPOINT_IDENTITY_PROPERTY_NAMES;
private static final Map<String, String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(28);
+ Set<String> props = new HashSet<>(30);
props.add("authMountPath");
props.add("authentication");
props.add("awsIamServerId");
@@ -33,6 +33,8 @@ public class HashicorpVaultEndpointUriFactory extends
org.apache.camel.support.c
props.add("azureClientId");
props.add("azureResource");
props.add("cloud");
+ props.add("gcpCredentialsFile");
+ props.add("gcpServiceAccountId");
props.add("host");
props.add("jwt");
props.add("jwtFile");
diff --git
a/components/camel-hashicorp-vault/src/generated/resources/META-INF/org/apache/camel/component/hashicorp/vault/hashicorp-vault.json
b/components/camel-hashicorp-vault/src/generated/resources/META-INF/org/apache/camel/component/hashicorp/vault/hashicorp-vault.json
index 72534b06d1c2..c1bb4a033084 100644
---
a/components/camel-hashicorp-vault/src/generated/resources/META-INF/org/apache/camel/component/hashicorp/vault/hashicorp-vault.json
+++
b/components/camel-hashicorp-vault/src/generated/resources/META-INF/org/apache/camel/component/hashicorp/vault/hashicorp-vault.json
@@ -49,23 +49,25 @@
"secretPath": { "index": 7, "kind": "parameter", "displayName": "Secret
Path", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The path of the secret
in the secrets engine, such as myapp\/database, for the createSecret, getS [...]
"vaultTemplate": { "index": 8, "kind": "parameter", "displayName": "Vault
Template", "group": "producer", "label": "", "required": false, "type":
"object", "javaType": "org.springframework.vault.core.VaultTemplate",
"deprecated": false, "autowired": true, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The Spring Vault
VaultTemplate to access HashiCorp Vault with, i [...]
"lazyStartProducer": { "index": 9, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
- "authentication": { "index": 10, "kind": "parameter", "displayName":
"Authentication", "group": "security", "label": "security", "required": false,
"type": "enum", "javaType": "java.lang.String", "enum": [ "token", "approle",
"kubernetes", "jwt", "cert", "aws-iam", "azure-msi", "gcp-gce" ], "deprecated":
false, "autowired": false, "secret": false, "defaultValue": "token",
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationFie [...]
- "authMountPath": { "index": 11, "kind": "parameter", "displayName": "Auth
Mount Path", "group": "security", "label": "security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The path the login
method is mounted at in HashiCorp Vault (without auth\/), when [...]
+ "authentication": { "index": 10, "kind": "parameter", "displayName":
"Authentication", "group": "security", "label": "security", "required": false,
"type": "enum", "javaType": "java.lang.String", "enum": [ "token", "approle",
"kubernetes", "jwt", "cert", "aws-iam", "azure-msi", "gcp-gce", "gcp-iam" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"token", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"confi [...]
+ "authMountPath": { "index": 11, "kind": "parameter", "displayName": "Auth
Mount Path", "group": "security", "label": "security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The path the login
method is mounted at in HashiCorp Vault (without auth\/), when [...]
"awsIamServerId": { "index": 12, "kind": "parameter", "displayName": "Aws
Iam Server Id", "group": "security", "label": "security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The value of the
X-Vault-AWS-IAM-Server-ID header of the aws-iam login, when t [...]
"awsRegion": { "index": 13, "kind": "parameter", "displayName": "Aws
Region", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The AWS region the
aws-iam login signs its request for, which must be the region of awsSts [...]
"awsStsEndpoint": { "index": 14, "kind": "parameter", "displayName": "Aws
Sts Endpoint", "group": "security", "label": "security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The AWS STS endpoint of
the aws-iam login, which the AWS login of HashiCorp Vau [...]
"azureClientId": { "index": 15, "kind": "parameter", "displayName": "Azure
Client Id", "group": "security", "label": "security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The client ID of a
user-assigned managed identity, for the azure-msi login. When [...]
"azureResource": { "index": 16, "kind": "parameter", "displayName": "Azure
Resource", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "https:\/\/management.azure.com\/",
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The resource (audience)
of the [...]
- "jwt": { "index": 17, "kind": "parameter", "displayName": "Jwt", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The JWT to log in with,
for the jwt and kubernetes logins. For a JWT that is repla [...]
- "jwtFile": { "index": 18, "kind": "parameter", "displayName": "Jwt File",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file to read the JWT
from at every login, for the jwt and kubernetes logins. The kubernete [...]
- "keyStore": { "index": 19, "kind": "parameter", "displayName": "Key
Store", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file with the TLS
client certificate and its private key, which the endpoint presents to [...]
- "keyStorePassword": { "index": 20, "kind": "parameter", "displayName":
"Key Store Password", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The password of the key
store and of its private key, [...]
- "role": { "index": 21, "kind": "parameter", "displayName": "Role",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The HashiCorp Vault role
to log in as, for the kubernetes, jwt, cert, aws-iam, azure-msi and gcp-gce
[...]
- "roleId": { "index": 22, "kind": "parameter", "displayName": "Role Id",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The role ID of the
AppRole, for the approle login" },
- "secretId": { "index": 23, "kind": "parameter", "displayName": "Secret
Id", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The secret ID of the
AppRole, for the approle login" },
- "sslContextParameters": { "index": 24, "kind": "parameter", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The TLS configuration of
the conn [...]
- "token": { "index": 25, "kind": "parameter", "displayName": "Token",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The HashiCorp Vault
token, for the token login, sent with every request to Vau [...]
- "trustStore": { "index": 26, "kind": "parameter", "displayName": "Trust
Store", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file with the
certificates to trust for the TLS connection to HashiCorp Vault, such [...]
- "trustStorePassword": { "index": 27, "kind": "parameter", "displayName":
"Trust Store Password", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The password of the
trust store, when it is a PKCS [...]
+ "gcpCredentialsFile": { "index": 17, "kind": "parameter", "displayName":
"Gcp Credentials File", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file with the Google
credentials of the gcp-iam login: a service ac [...]
+ "gcpServiceAccountId": { "index": 18, "kind": "parameter", "displayName":
"Gcp Service Account Id", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The service account to
sign the JWT of the gcp-iam login as: its ema [...]
+ "jwt": { "index": 19, "kind": "parameter", "displayName": "Jwt", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The JWT to log in with,
for the jwt and kubernetes logins. For a JWT that is repla [...]
+ "jwtFile": { "index": 20, "kind": "parameter", "displayName": "Jwt File",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file to read the JWT
from at every login, for the jwt and kubernetes logins. The kubernete [...]
+ "keyStore": { "index": 21, "kind": "parameter", "displayName": "Key
Store", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file with the TLS
client certificate and its private key, which the endpoint presents to [...]
+ "keyStorePassword": { "index": 22, "kind": "parameter", "displayName":
"Key Store Password", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The password of the key
store and of its private key, [...]
+ "role": { "index": 23, "kind": "parameter", "displayName": "Role",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The HashiCorp Vault role
to log in as, for the kubernetes, jwt, cert, aws-iam, azure-msi, gcp-gce and
[...]
+ "roleId": { "index": 24, "kind": "parameter", "displayName": "Role Id",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The role ID of the
AppRole, for the approle login" },
+ "secretId": { "index": 25, "kind": "parameter", "displayName": "Secret
Id", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The secret ID of the
AppRole, for the approle login" },
+ "sslContextParameters": { "index": 26, "kind": "parameter", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The TLS configuration of
the conn [...]
+ "token": { "index": 27, "kind": "parameter", "displayName": "Token",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The HashiCorp Vault
token, for the token login, sent with every request to Vau [...]
+ "trustStore": { "index": 28, "kind": "parameter", "displayName": "Trust
Store", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The file with the
certificates to trust for the TLS connection to HashiCorp Vault, such [...]
+ "trustStorePassword": { "index": 29, "kind": "parameter", "displayName":
"Trust Store Password", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "The password of the
trust store, when it is a PKCS [...]
}
}
diff --git
a/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc
b/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc
index a84f1dd10af2..b250af0fd112 100644
---
a/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc
+++
b/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc
@@ -89,10 +89,16 @@ it, Vault tries every certificate role that trusts the
certificate. The login ne
| `gcp-gce`
| `role`: the Vault role of the application, which logs in with the service
account of its Google Compute Engine
instance, see <<_cloud_logins,Cloud logins>>.
+
+| `gcp-iam`
+| `role`: the Vault role of the application, which logs in with a JWT signed
for a Google service account, see
+<<_cloud_logins,Cloud logins>>. `gcpServiceAccountId` names the service
account, unless the credentials are a service
+account key.
|===
When the login method is not mounted at its default path in Vault (`approle`,
`kubernetes`, `jwt`, `cert`, `aws` for
-`aws-iam`, `azure` for `azure-msi` or `gcp` for `gcp-gce`), set the path with
`authMountPath`, without `auth/`.
+`aws-iam`, `azure` for `azure-msi` or `gcp` for `gcp-gce` and `gcp-iam`), set
the path with `authMountPath`, without
+`auth/`.
Camel renews the token before it expires, and logs in again when the token can
no longer be renewed, such as when it
reached its maximum time to live. A JWT read from a file is read again at
every login, so a token that the platform
@@ -197,6 +203,16 @@ sets. A pod of Azure Kubernetes Service with workload
identity has a token in th
The `gcp-gce` login asks the metadata server of a Google Compute Engine
instance for an identity token of the default
service account of the instance, for a role of type `gce` of the GCP login of
Vault.
+The `gcp-iam` login signs a JWT for a Google service account through the IAM
Credentials API, for a role of type `iam`
+of the GCP login of Vault, also outside Compute Engine. It takes the Google
credentials of `gcpCredentialsFile`, a
+service account key or an external account configuration (workload identity
federation), or else those of the Google
+default chain (Application Default Credentials), such as the workload identity
of GKE.
+`gcpServiceAccountId` is the service account to sign the JWT as, by its email
or unique ID: it can be left out with a
+service account key, which names its service account. The credentials need the
`iam.serviceAccounts.signJwt`
+permission on that service account, such as with the Service Account Token
Creator role. The login needs the Google
+Cloud IAM Credentials library: add the
`com.google.cloud:google-cloud-iamcredentials` dependency, in the version of the
+Google Cloud libraries of the Camel Google components.
+
The metadata services are reached directly, never through an HTTP proxy.
=== OpenBao
diff --git
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultAuthentication.java
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultAuthentication.java
index bb271d2a31ef..5dc011c63ef0 100644
---
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultAuthentication.java
+++
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultAuthentication.java
@@ -34,7 +34,8 @@ enum HashicorpVaultAuthentication {
CERT("cert", "TLS certificate"),
AWS_IAM("aws-iam", "AWS IAM"),
AZURE_MSI("azure-msi", "Azure managed identity"),
- GCP_GCE("gcp-gce", "Google Compute Engine");
+ GCP_GCE("gcp-gce", "Google Compute Engine"),
+ GCP_IAM("gcp-iam", "Google Cloud IAM");
private final String value;
private final String displayName;
diff --git
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClient.java
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClient.java
index a3fd429c21d9..699a2e9ff5b8 100644
---
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClient.java
+++
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClient.java
@@ -84,6 +84,8 @@ public final class HashicorpVaultClient implements Closeable {
// a class of the AWS SDK that the aws-iam login needs
private static final String AWS_SDK_CLASS =
"software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider";
+ // a class of the Google Cloud IAM Credentials library that the gcp-iam
login needs
+ private static final String GCP_IAM_CLASS =
"com.google.cloud.iam.credentials.v1.IamCredentialsClient";
// the resource of the Azure login in the documentation of HashiCorp Vault
static final String DEFAULT_AZURE_RESOURCE =
"https://management.azure.com/";
private static final String RENEWAL_THREAD = "HashicorpVaultTokenRenewal";
@@ -257,6 +259,14 @@ public final class HashicorpVaultClient implements
Closeable {
}
case AZURE_MSI -> validateRole(settings, "azure-msi");
case GCP_GCE -> validateRole(settings, "gcp-gce");
+ case GCP_IAM -> {
+ validateRole(settings, "gcp-iam");
+ if (ObjectHelper.loadClass(GCP_IAM_CLASS,
HashicorpVaultClient.class.getClassLoader()) == null) {
+ throw new IllegalArgumentException(
+ "The gcp-iam login needs the Google Cloud IAM
Credentials library: add the"
+ + "
com.google.cloud:google-cloud-iamcredentials dependency");
+ }
+ }
default -> throw new IllegalStateException("Unexpected login: " +
settings.getAuthentication());
}
}
@@ -310,6 +320,8 @@ public final class HashicorpVaultClient implements
Closeable {
case AWS_IAM -> HashicorpVaultAwsIam.authentication(settings,
loginClient, closeOnStop);
case AZURE_MSI -> new
AzureMsiAuthentication(azureMsiOptions(settings), loginClient,
metadataClient());
case GCP_GCE -> new
GcpComputeAuthentication(gcpComputeOptions(settings), loginClient,
metadataClient());
+ // in a class of its own, as it needs the Google Cloud IAM
Credentials library, an optional dependency
+ case GCP_IAM -> HashicorpVaultGcpIam.authentication(settings,
loginClient);
};
}
diff --git
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientSettings.java
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientSettings.java
index eabacbfb4ed2..cee848cf625d 100644
---
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientSettings.java
+++
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientSettings.java
@@ -50,13 +50,15 @@ public final class HashicorpVaultClientSettings {
static final String AWS_STS_ENDPOINT_ENV =
"CAMEL_HASHICORP_VAULT_AWS_STS_ENDPOINT";
static final String AZURE_RESOURCE_ENV =
"CAMEL_HASHICORP_VAULT_AZURE_RESOURCE";
static final String AZURE_CLIENT_ID_ENV =
"CAMEL_HASHICORP_VAULT_AZURE_CLIENT_ID";
+ static final String GCP_SERVICE_ACCOUNT_ID_ENV =
"CAMEL_HASHICORP_VAULT_GCP_SERVICE_ACCOUNT_ID";
+ static final String GCP_CREDENTIALS_FILE_ENV =
"CAMEL_HASHICORP_VAULT_GCP_CREDENTIALS_FILE";
// any of these set means the settings come from the environment variables
(the cloud variable alone does not)
private static final List<String> ENVIRONMENT_SETTINGS = List.of(
TOKEN_ENV, HOST_ENV, PORT_ENV, SCHEME_ENV, NAMESPACE_ENV,
AUTHENTICATION_ENV, ROLE_ID_ENV, SECRET_ID_ENV,
ROLE_ENV, JWT_ENV, JWT_FILE_ENV, AUTH_MOUNT_PATH_ENV,
TRUST_STORE_ENV, TRUST_STORE_PASSWORD_ENV, KEY_STORE_ENV,
KEY_STORE_PASSWORD_ENV, AWS_IAM_SERVER_ID_ENV, AWS_REGION_ENV,
AWS_STS_ENDPOINT_ENV, AZURE_RESOURCE_ENV,
- AZURE_CLIENT_ID_ENV);
+ AZURE_CLIENT_ID_ENV, GCP_SERVICE_ACCOUNT_ID_ENV,
GCP_CREDENTIALS_FILE_ENV);
private String host;
private String port;
@@ -81,6 +83,8 @@ public final class HashicorpVaultClientSettings {
private String awsStsEndpoint;
private String azureResource;
private String azureClientId;
+ private String gcpServiceAccountId;
+ private String gcpCredentialsFile;
/**
* The settings of the properties function and the secret refresh task,
and of the early resolution of properties of
@@ -120,6 +124,8 @@ public final class HashicorpVaultClientSettings {
settings.setAwsStsEndpoint(environment.apply(AWS_STS_ENDPOINT_ENV));
settings.setAzureResource(environment.apply(AZURE_RESOURCE_ENV));
settings.setAzureClientId(environment.apply(AZURE_CLIENT_ID_ENV));
+
settings.setGcpServiceAccountId(environment.apply(GCP_SERVICE_ACCOUNT_ID_ENV));
+
settings.setGcpCredentialsFile(environment.apply(GCP_CREDENTIALS_FILE_ENV));
} else if (configuration != null) {
settings = fromConfiguration(configuration);
}
@@ -157,6 +163,8 @@ public final class HashicorpVaultClientSettings {
settings.setAwsStsEndpoint(configuration.getAwsStsEndpoint());
settings.setAzureResource(configuration.getAzureResource());
settings.setAzureClientId(configuration.getAzureClientId());
+
settings.setGcpServiceAccountId(configuration.getGcpServiceAccountId());
+ settings.setGcpCredentialsFile(configuration.getGcpCredentialsFile());
return settings;
}
@@ -358,4 +366,20 @@ public final class HashicorpVaultClientSettings {
public void setAzureClientId(String azureClientId) {
this.azureClientId = azureClientId;
}
+
+ public String getGcpServiceAccountId() {
+ return gcpServiceAccountId;
+ }
+
+ public void setGcpServiceAccountId(String gcpServiceAccountId) {
+ this.gcpServiceAccountId = gcpServiceAccountId;
+ }
+
+ public String getGcpCredentialsFile() {
+ return gcpCredentialsFile;
+ }
+
+ public void setGcpCredentialsFile(String gcpCredentialsFile) {
+ this.gcpCredentialsFile = gcpCredentialsFile;
+ }
}
diff --git
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultConfiguration.java
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultConfiguration.java
index 25c598d692ce..505f4e1e832a 100644
---
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultConfiguration.java
+++
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultConfiguration.java
@@ -50,7 +50,8 @@ public class HashicorpVaultConfiguration implements Cloneable
{
+ " getSecret and deleteSecret operations. The
CamelHashicorpVaultSecretPath header overrides it."
+ " listSecrets does not use it.")
private String secretPath;
- @UriParam(label = "security", defaultValue = "token", enums =
"token,approle,kubernetes,jwt,cert,aws-iam,azure-msi,gcp-gce")
+ @UriParam(label = "security", defaultValue = "token",
+ enums =
"token,approle,kubernetes,jwt,cert,aws-iam,azure-msi,gcp-gce,gcp-iam")
private String authentication = "token";
@UriParam(label = "security", security = "secret",
description = "The HashiCorp Vault token, for the token login,
sent with every request to Vault. A renewable"
@@ -88,6 +89,10 @@ public class HashicorpVaultConfiguration implements
Cloneable {
private String azureResource = "https://management.azure.com/";
@UriParam(label = "security")
private String azureClientId;
+ @UriParam(label = "security")
+ private String gcpServiceAccountId;
+ @UriParam(label = "security")
+ private String gcpCredentialsFile;
@UriParam(description = "Whether HashiCorp Vault runs on the HashiCorp
Cloud Platform (HCP Vault Dedicated), where"
+ " the secrets engines and login methods are in a
namespace. Only then is the namespace option"
+ " used.")
@@ -129,8 +134,9 @@ public class HashicorpVaultConfiguration implements
Cloneable {
* How to log in to HashiCorp Vault: token (a fixed token), approle (a
role ID and a secret ID), kubernetes (the
* service account token of the pod), jwt (a JWT, such as a workload
identity token), cert (the TLS client
* certificate of the keyStore), aws-iam (the AWS credentials of the
application), azure-msi (the Azure managed
- * identity) or gcp-gce (the service account of the Google Compute Engine
instance). The token is renewed before it
- * expires, and the endpoint logs in again when the token can no longer be
renewed.
+ * identity), gcp-gce (the service account of the Google Compute Engine
instance) or gcp-iam (a JWT signed for a
+ * Google service account, with the Google credentials of the
application). The token is renewed before it expires,
+ * and the endpoint logs in again when the token can no longer be renewed.
*/
public String getAuthentication() {
return authentication;
@@ -171,9 +177,9 @@ public class HashicorpVaultConfiguration implements
Cloneable {
}
/**
- * The HashiCorp Vault role to log in as, for the kubernetes, jwt, cert,
aws-iam, azure-msi and gcp-gce logins. The
- * jwt login can leave it out when the login method has a default role,
the aws-iam login to log in as the role
- * named as the IAM principal, and the cert login to let Vault pick the
certificate role that trusts the
+ * The HashiCorp Vault role to log in as, for the kubernetes, jwt, cert,
aws-iam, azure-msi, gcp-gce and gcp-iam
+ * logins. The jwt login can leave it out when the login method has a
default role, the aws-iam login to log in as
+ * the role named as the IAM principal, and the cert login to let Vault
pick the certificate role that trusts the
* certificate.
*/
public String getRole() {
@@ -210,7 +216,8 @@ public class HashicorpVaultConfiguration implements
Cloneable {
/**
* The path the login method is mounted at in HashiCorp Vault (without
auth/), when it is not the default path of
- * the login method: approle, kubernetes, jwt, cert, aws (for aws-iam),
azure (for azure-msi) or gcp (for gcp-gce)
+ * the login method: approle, kubernetes, jwt, cert, aws (for aws-iam),
azure (for azure-msi) or gcp (for gcp-gce
+ * and gcp-iam)
*/
public String getAuthMountPath() {
return authMountPath;
@@ -343,6 +350,31 @@ public class HashicorpVaultConfiguration implements
Cloneable {
this.azureClientId = azureClientId;
}
+ /**
+ * The service account to sign the JWT of the gcp-iam login as: its email
address or its unique ID. It can be left
+ * out when the credentials are a service account key, which names its
service account.
+ */
+ public String getGcpServiceAccountId() {
+ return gcpServiceAccountId;
+ }
+
+ public void setGcpServiceAccountId(String gcpServiceAccountId) {
+ this.gcpServiceAccountId = gcpServiceAccountId;
+ }
+
+ /**
+ * The file with the Google credentials of the gcp-iam login: a service
account key, or an external account
+ * configuration (workload identity federation). When not set, the
credentials of the Google default chain
+ * (Application Default Credentials), such as the workload identity of GKE.
+ */
+ public String getGcpCredentialsFile() {
+ return gcpCredentialsFile;
+ }
+
+ public void setGcpCredentialsFile(String gcpCredentialsFile) {
+ this.gcpCredentialsFile = gcpCredentialsFile;
+ }
+
public String getHost() {
return host;
}
diff --git
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpoint.java
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpoint.java
index 14ae0ed4b675..16385e263e9b 100644
---
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpoint.java
+++
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpoint.java
@@ -126,6 +126,8 @@ public class HashicorpVaultEndpoint extends DefaultEndpoint
{
settings.setAwsStsEndpoint(configuration.getAwsStsEndpoint());
settings.setAzureResource(configuration.getAzureResource());
settings.setAzureClientId(configuration.getAzureClientId());
+
settings.setGcpServiceAccountId(configuration.getGcpServiceAccountId());
+ settings.setGcpCredentialsFile(configuration.getGcpCredentialsFile());
return settings;
}
diff --git
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultGcpIam.java
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultGcpIam.java
new file mode 100644
index 000000000000..0806e8fc217c
--- /dev/null
+++
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultGcpIam.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.hashicorp.vault;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import com.google.auth.oauth2.ExternalAccountCredentials;
+import com.google.auth.oauth2.GoogleCredentials;
+import com.google.auth.oauth2.ServiceAccountCredentials;
+import org.apache.camel.util.ObjectHelper;
+import org.springframework.vault.authentication.ClientAuthentication;
+import
org.springframework.vault.authentication.GcpIamCredentialsAuthentication;
+import
org.springframework.vault.authentication.GcpIamCredentialsAuthenticationOptions;
+import org.springframework.vault.client.VaultClient;
+import tools.jackson.databind.json.JsonMapper;
+
+/**
+ * The gcp-iam login, in a class of its own: it needs the Google Cloud IAM
Credentials library, an optional dependency,
+ * which is then loaded only for this login.
+ */
+final class HashicorpVaultGcpIam {
+
+ // the scope of the IAM Credentials API, for credentials that have no
scope of their own
+ static final String CLOUD_PLATFORM_SCOPE =
"https://www.googleapis.com/auth/cloud-platform";
+
+ private static final JsonMapper JSON = JsonMapper.builder().build();
+
+ private HashicorpVaultGcpIam() {
+ }
+
+ /**
+ * The gcp-iam login, which signs a JWT for the service account through
the IAM Credentials API, with the Google
+ * credentials of gcpCredentialsFile, else of the Google default chain
(such as the workload identity of GKE).
+ *
+ * @throws IllegalArgumentException when the credentials cannot be read,
or the service account is not known
+ */
+ static ClientAuthentication authentication(HashicorpVaultClientSettings
settings, VaultClient loginClient) {
+ return new GcpIamCredentialsAuthentication(options(settings,
credentials(settings)), loginClient);
+ }
+
+ /**
+ * The options of the gcp-iam login with the given credentials
+ *
+ * @throws IllegalArgumentException when there is no gcpServiceAccountId
and the credentials are not a service
+ * account key, which names its service
account
+ */
+ static GcpIamCredentialsAuthenticationOptions options(
+ HashicorpVaultClientSettings settings, GoogleCredentials
credentials) {
+
GcpIamCredentialsAuthenticationOptions.GcpIamCredentialsAuthenticationOptionsBuilder
builder
+ =
GcpIamCredentialsAuthenticationOptions.builder().role(settings.getRole()).credentials(credentials);
+ if (ObjectHelper.isNotEmpty(settings.getAuthMountPath())) {
+ builder.path(settings.getAuthMountPath());
+ }
+ if (ObjectHelper.isNotEmpty(settings.getGcpServiceAccountId())) {
+ builder.serviceAccountId(settings.getGcpServiceAccountId());
+ } else if (!(credentials instanceof ServiceAccountCredentials)) {
+ throw new IllegalArgumentException(
+ "The gcp-iam login needs gcpServiceAccountId, the service
account to sign the JWT as, unless its"
+ + " credentials are a service
account key");
+ }
+ return builder.build();
+ }
+
+ /**
+ * The Google credentials of gcpCredentialsFile, else of the Google
default chain, with the scope of the IAM
+ * Credentials API when they have no scope of their own
+ *
+ * @throws IllegalArgumentException when the credentials cannot be read
+ */
+ static GoogleCredentials credentials(HashicorpVaultClientSettings
settings) {
+ GoogleCredentials credentials;
+ try {
+ credentials =
ObjectHelper.isNotEmpty(settings.getGcpCredentialsFile())
+ ? credentialsFile(settings.getGcpCredentialsFile())
+ : GoogleCredentials.getApplicationDefault();
+ } catch (IOException e) {
+ throw new IllegalArgumentException(
+ "Cannot read the Google credentials of the gcp-iam login:
" + e.getMessage(), e);
+ }
+ return credentials.createScopedRequired() ?
credentials.createScoped(CLOUD_PLATFORM_SCOPE) : credentials;
+ }
+
+ /**
+ * The credentials of the file, read by the loader of their type, as
Google recommends: a service account key, or an
+ * external account (workload identity federation)
+ */
+ private static GoogleCredentials credentialsFile(String file) throws
IOException {
+ byte[] json = Files.readAllBytes(Path.of(file));
+ String type = JSON.readTree(json).path("type").asString("");
+ try (InputStream in = new ByteArrayInputStream(json)) {
+ return switch (type) {
+ case "service_account" ->
ServiceAccountCredentials.fromStream(in);
+ case "external_account" ->
ExternalAccountCredentials.fromStream(in);
+ default -> throw new IOException(
+ file + " is not a service account key
(service_account) or an external account"
+ + " (external_account): " +
type);
+ };
+ }
+ }
+}
diff --git
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java
index 54c4c1e93297..17b97440cd24 100644
---
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java
+++
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java
@@ -43,7 +43,7 @@ import org.springframework.vault.support.VaultResponse;
* <li><tt>CAMEL_HASHICORP_VAULT_PORT</tt></li>
* <li><tt>CAMEL_HASHICORP_VAULT_SCHEME</tt></li>
* <li><tt>CAMEL_HASHICORP_VAULT_AUTHENTICATION</tt>: token (the default),
approle, kubernetes, jwt, cert, aws-iam,
- * azure-msi or gcp-gce</li>
+ * azure-msi, gcp-gce or gcp-iam</li>
* <li><tt>CAMEL_HASHICORP_VAULT_TOKEN</tt>, for the token login</li>
* <li><tt>CAMEL_HASHICORP_VAULT_ROLE_ID</tt> and
<tt>CAMEL_HASHICORP_VAULT_SECRET_ID</tt>, for the approle login</li>
* <li><tt>CAMEL_HASHICORP_VAULT_ROLE</tt>, the Vault role to log in as, for
the kubernetes, jwt, cert and cloud
@@ -59,6 +59,8 @@ import org.springframework.vault.support.VaultResponse;
* <tt>CAMEL_HASHICORP_VAULT_AWS_STS_ENDPOINT</tt>, for the aws-iam login</li>
* <li><tt>CAMEL_HASHICORP_VAULT_AZURE_RESOURCE</tt> and
<tt>CAMEL_HASHICORP_VAULT_AZURE_CLIENT_ID</tt>, for the
* azure-msi login</li>
+ * <li><tt>CAMEL_HASHICORP_VAULT_GCP_SERVICE_ACCOUNT_ID</tt> and
<tt>CAMEL_HASHICORP_VAULT_GCP_CREDENTIALS_FILE</tt>,
+ * for the gcp-iam login</li>
* </ul>
* <p/>
*
@@ -79,6 +81,7 @@ import org.springframework.vault.support.VaultResponse;
* <li><tt>camel.vault.hashicorp.awsIamServerId</tt>,
<tt>camel.vault.hashicorp.awsRegion</tt> and
* <tt>camel.vault.hashicorp.awsStsEndpoint</tt></li>
* <li><tt>camel.vault.hashicorp.azureResource</tt> and
<tt>camel.vault.hashicorp.azureClientId</tt></li>
+ * <li><tt>camel.vault.hashicorp.gcpServiceAccountId</tt> and
<tt>camel.vault.hashicorp.gcpCredentialsFile</tt></li>
* </ul>
* <p/>
*
diff --git
a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientSettingsTest.java
b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientSettingsTest.java
index 5d99a3666fe4..a43c969da422 100644
---
a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientSettingsTest.java
+++
b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientSettingsTest.java
@@ -29,6 +29,8 @@ import static
org.apache.camel.component.hashicorp.vault.HashicorpVaultClientSet
import static
org.apache.camel.component.hashicorp.vault.HashicorpVaultClientSettings.AZURE_CLIENT_ID_ENV;
import static
org.apache.camel.component.hashicorp.vault.HashicorpVaultClientSettings.AZURE_RESOURCE_ENV;
import static
org.apache.camel.component.hashicorp.vault.HashicorpVaultClientSettings.CLOUD_ENV;
+import static
org.apache.camel.component.hashicorp.vault.HashicorpVaultClientSettings.GCP_CREDENTIALS_FILE_ENV;
+import static
org.apache.camel.component.hashicorp.vault.HashicorpVaultClientSettings.GCP_SERVICE_ACCOUNT_ID_ENV;
import static
org.apache.camel.component.hashicorp.vault.HashicorpVaultClientSettings.HOST_ENV;
import static
org.apache.camel.component.hashicorp.vault.HashicorpVaultClientSettings.JWT_FILE_ENV;
import static
org.apache.camel.component.hashicorp.vault.HashicorpVaultClientSettings.KEY_STORE_ENV;
@@ -119,7 +121,8 @@ class HashicorpVaultClientSettingsTest {
Map<String, String> environment = Map.of(
AWS_IAM_SERVER_ID_ENV, "vault.example.com", AWS_REGION_ENV,
"eu-west-1",
AWS_STS_ENDPOINT_ENV, "https://sts.eu-west-1.amazonaws.com",
AZURE_RESOURCE_ENV, "https://vault.hashicorp.com",
- AZURE_CLIENT_ID_ENV, "1b2c3d4e");
+ AZURE_CLIENT_ID_ENV, "1b2c3d4e", GCP_SERVICE_ACCOUNT_ID_ENV,
"[email protected]",
+ GCP_CREDENTIALS_FILE_ENV, "/etc/gcp/key.json");
HashicorpVaultClientSettings settings
=
HashicorpVaultClientSettings.fromEnvironmentOrConfiguration(configuration(),
environment::get);
@@ -129,6 +132,8 @@ class HashicorpVaultClientSettingsTest {
assertEquals("https://sts.eu-west-1.amazonaws.com",
settings.getAwsStsEndpoint());
assertEquals("https://vault.hashicorp.com",
settings.getAzureResource());
assertEquals("1b2c3d4e", settings.getAzureClientId());
+ assertEquals("[email protected]",
settings.getGcpServiceAccountId());
+ assertEquals("/etc/gcp/key.json", settings.getGcpCredentialsFile());
assertNull(settings.getHost());
}
@@ -139,6 +144,8 @@ class HashicorpVaultClientSettingsTest {
configuration.setAwsRegion("eu-west-1");
configuration.setAwsStsEndpoint("https://sts.eu-west-1.amazonaws.com");
configuration.setAzureClientId("1b2c3d4e");
+
configuration.setGcpServiceAccountId("[email protected]");
+ configuration.setGcpCredentialsFile("/etc/gcp/key.json");
HashicorpVaultClientSettings settings
=
HashicorpVaultClientSettings.fromEnvironmentOrConfiguration(configuration, name
-> null);
@@ -149,6 +156,8 @@ class HashicorpVaultClientSettingsTest {
// the default resource of the configuration
assertEquals("https://management.azure.com/",
settings.getAzureResource());
assertEquals("1b2c3d4e", settings.getAzureClientId());
+ assertEquals("[email protected]",
settings.getGcpServiceAccountId());
+ assertEquals("/etc/gcp/key.json", settings.getGcpCredentialsFile());
}
@Test
diff --git
a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientTest.java
b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientTest.java
index 0fee1e27c54f..5dec00d07b81 100644
---
a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientTest.java
+++
b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultClientTest.java
@@ -323,7 +323,7 @@ class HashicorpVaultClientTest {
settings = settings("ldap");
assertInvalid(
- "Unknown HashiCorp Vault login: ldap. Use one of: token,
approle, kubernetes, jwt, cert, aws-iam, azure-msi, gcp-gce",
+ "Unknown HashiCorp Vault login: ldap. Use one of: token,
approle, kubernetes, jwt, cert, aws-iam, azure-msi, gcp-gce, gcp-iam",
settings);
settings = approle();
diff --git
a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultGcpIamTest.java
b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultGcpIamTest.java
new file mode 100644
index 000000000000..86a7c7e47c65
--- /dev/null
+++
b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultGcpIamTest.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.hashicorp.vault;
+
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.security.KeyPairGenerator;
+import java.time.Instant;
+import java.util.Base64;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import com.google.api.gax.grpc.GrpcTransportChannel;
+import com.google.api.gax.rpc.FixedTransportChannelProvider;
+import com.google.auth.oauth2.AccessToken;
+import com.google.auth.oauth2.GoogleCredentials;
+import com.google.auth.oauth2.ServiceAccountCredentials;
+import com.google.cloud.iam.credentials.v1.SignJwtRequest;
+import com.google.cloud.iam.credentials.v1.SignJwtResponse;
+import io.grpc.ManagedChannel;
+import io.grpc.MethodDescriptor;
+import io.grpc.Server;
+import io.grpc.ServerServiceDefinition;
+import io.grpc.inprocess.InProcessChannelBuilder;
+import io.grpc.inprocess.InProcessServerBuilder;
+import io.grpc.protobuf.ProtoUtils;
+import io.grpc.stub.ServerCalls;
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import
org.springframework.vault.authentication.GcpIamCredentialsAuthentication;
+import
org.springframework.vault.authentication.GcpIamCredentialsAuthenticationOptions;
+import org.springframework.vault.client.VaultClient;
+import org.springframework.vault.client.VaultEndpoint;
+import org.springframework.vault.support.VaultToken;
+import tools.jackson.databind.json.JsonMapper;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The gcp-iam login, which signs its JWT through a fake of the IAM
Credentials API in process, and logs in against a
+ * fake Vault. The credentials are fake too: the tests never read the Google
default chain (Application Default
+ * Credentials), which could find real credentials on the machine that runs
them.
+ */
+class HashicorpVaultGcpIamTest {
+
+ private static final JsonMapper JSON = JsonMapper.builder().build();
+ private static final String SERVICE_ACCOUNT =
"[email protected]";
+
+ @TempDir
+ Path dir;
+
+ private FakeVault vault;
+ private CamelContext context;
+
+ @BeforeEach
+ void startVault() throws Exception {
+ vault = new FakeVault();
+ vault.on("auth/token/revoke-self", request -> FakeVault.noContent());
+ context = new DefaultCamelContext();
+ context.start();
+ }
+
+ @AfterEach
+ void stopVault() {
+ context.stop();
+ vault.close();
+ }
+
+ @Test
+ void logsInWithAJwtSignedForTheServiceAccountThroughTheIamCredentialsApi()
throws Exception {
+ vault.on("auth/gcp/login", request -> FakeVault.login("gcp-token",
3600));
+ HashicorpVaultClientSettings settings = settings();
+ settings.setGcpServiceAccountId(SERVICE_ACCOUNT);
+ List<SignJwtRequest> signed = new CopyOnWriteArrayList<>();
+ String name = InProcessServerBuilder.generateName();
+ Server iam =
InProcessServerBuilder.forName(name).directExecutor().addService(iamCredentials(signed)).build().start();
+ ManagedChannel channel =
InProcessChannelBuilder.forName(name).directExecutor().build();
+ try {
+ GcpIamCredentialsAuthentication login = new
GcpIamCredentialsAuthentication(
+ HashicorpVaultGcpIam.options(settings, fakeCredentials()),
loginClient(),
+
FixedTransportChannelProvider.create(GrpcTransportChannel.create(channel)));
+
+ VaultToken token = login.login();
+
+ assertEquals("gcp-token", token.getToken());
+ assertEquals(Map.of("role", "camel", "jwt", "signed.jwt"),
vault.requests("auth/gcp/login").get(0).json());
+ assertEquals("projects/-/serviceAccounts/" + SERVICE_ACCOUNT,
signed.get(0).getName());
+ Map<?, ?> payload = JSON.readValue(signed.get(0).getPayload(),
Map.class);
+ assertEquals(SERVICE_ACCOUNT, payload.get("sub"));
+ assertEquals("vault/camel", payload.get("aud"));
+ } finally {
+ channel.shutdownNow();
+ iam.shutdownNow();
+ }
+ }
+
+ @Test
+ void takesTheRoleAndTheMountPath() {
+ HashicorpVaultClientSettings settings = settings();
+ settings.setGcpServiceAccountId(SERVICE_ACCOUNT);
+
+ GcpIamCredentialsAuthenticationOptions options =
HashicorpVaultGcpIam.options(settings, fakeCredentials());
+ assertEquals("camel", options.getRole());
+ assertEquals("gcp", options.getPath());
+
+ settings.setAuthMountPath("my-gcp");
+ assertEquals("my-gcp", HashicorpVaultGcpIam.options(settings,
fakeCredentials()).getPath());
+ }
+
+ @Test
+ void signsAsTheServiceAccountOfAServiceAccountKey() throws Exception {
+ HashicorpVaultClientSettings settings = settings();
+ settings.setGcpCredentialsFile(serviceAccountKey().toString());
+
+ GoogleCredentials credentials =
HashicorpVaultGcpIam.credentials(settings);
+ assertInstanceOf(ServiceAccountCredentials.class, credentials);
+ assertEquals(List.of(HashicorpVaultGcpIam.CLOUD_PLATFORM_SCOPE),
+ List.copyOf(((ServiceAccountCredentials)
credentials).getScopes()));
+
+ GcpIamCredentialsAuthenticationOptions options =
HashicorpVaultGcpIam.options(settings, credentials);
+ assertEquals(SERVICE_ACCOUNT,
options.getServiceAccountIdAccessor().getServiceAccountId(credentials));
+ }
+
+ @Test
+ void needsTheServiceAccountUnlessTheCredentialsAreAServiceAccountKey() {
+ IllegalArgumentException e =
assertThrows(IllegalArgumentException.class,
+ () -> HashicorpVaultGcpIam.options(settings(),
fakeCredentials()));
+ assertEquals("The gcp-iam login needs gcpServiceAccountId, the service
account to sign the JWT as, unless its"
+ + " credentials are a service account key",
+ e.getMessage());
+ }
+
+ @Test
+ void refusesCredentialsOfAnotherType() throws Exception {
+ Path file = dir.resolve("user.json");
+ Files.writeString(file,
+
"{\"type\":\"authorized_user\",\"client_id\":\"id\",\"client_secret\":\"s\",\"refresh_token\":\"t\"}");
+ HashicorpVaultClientSettings settings = settings();
+ settings.setGcpCredentialsFile(file.toString());
+
+ IllegalArgumentException e
+ = assertThrows(IllegalArgumentException.class, () ->
HashicorpVaultGcpIam.credentials(settings));
+ assertTrue(e.getMessage().startsWith("Cannot read the Google
credentials of the gcp-iam login: "), e.getMessage());
+ assertTrue(e.getMessage().endsWith("is not a service account key
(service_account) or an external account"
+ + " (external_account):
authorized_user"),
+ e.getMessage());
+ }
+
+ @Test
+ void needsARole() {
+ HashicorpVaultClientSettings settings = settings();
+ settings.setRole(null);
+
+ IllegalArgumentException e
+ = assertThrows(IllegalArgumentException.class, () ->
HashicorpVaultClient.validate(settings));
+ assertEquals("The gcp-iam login needs a role", e.getMessage());
+ }
+
+ @Test
+ void createsAndClosesAClientWithoutReachingGoogle() throws Exception {
+ HashicorpVaultClientSettings settings = settings();
+ settings.setGcpCredentialsFile(serviceAccountKey().toString());
+
+ // the login happens at the first request
+ HashicorpVaultClient.create(context, this, settings).close();
+ }
+
+ private HashicorpVaultClientSettings settings() {
+ HashicorpVaultClientSettings settings = new
HashicorpVaultClientSettings();
+ settings.setHost("localhost");
+ settings.setPort(String.valueOf(vault.port()));
+ settings.setScheme("http");
+ settings.setAuthentication("gcp-iam");
+ settings.setRole("camel");
+ return settings;
+ }
+
+ private VaultClient loginClient() {
+ VaultEndpoint endpoint = VaultEndpoint.create("localhost",
vault.port());
+ endpoint.setScheme("http");
+ return VaultClient.builder().endpoint(endpoint).build();
+ }
+
+ /**
+ * Credentials that are not a service account key, such as those of the
workload identity of GKE
+ */
+ private static GoogleCredentials fakeCredentials() {
+ return GoogleCredentials.create(new AccessToken("google-token",
Date.from(Instant.now().plusSeconds(3600))));
+ }
+
+ /**
+ * A service account key with a key made for the test
+ */
+ private Path serviceAccountKey() throws Exception {
+ KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
+ generator.initialize(2048);
+ String key = "-----BEGIN PRIVATE KEY-----\n"
+ + Base64.getMimeEncoder(64,
"\n".getBytes(StandardCharsets.US_ASCII))
+
.encodeToString(generator.generateKeyPair().getPrivate().getEncoded())
+ + "\n-----END PRIVATE KEY-----\n";
+ Path file = dir.resolve("key.json");
+ Files.writeString(file, JSON.writeValueAsString(Map.of(
+ "type", "service_account", "project_id", "my-project",
"private_key_id", "key-id", "private_key", key,
+ "client_email", SERVICE_ACCOUNT, "client_id", "1234567890",
"token_uri",
+ "https://oauth2.googleapis.com/token")));
+ return file;
+ }
+
+ /**
+ * A fake of the SignJwt method of the IAM Credentials API, which records
the requests and signs nothing
+ */
+ private static ServerServiceDefinition iamCredentials(List<SignJwtRequest>
requests) {
+ MethodDescriptor<SignJwtRequest, SignJwtResponse> signJwt
+ = MethodDescriptor.<SignJwtRequest, SignJwtResponse>
newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+
MethodDescriptor.generateFullMethodName("google.iam.credentials.v1.IAMCredentials",
"SignJwt"))
+
.setRequestMarshaller(ProtoUtils.marshaller(SignJwtRequest.getDefaultInstance()))
+
.setResponseMarshaller(ProtoUtils.marshaller(SignJwtResponse.getDefaultInstance()))
+ .build();
+ return
ServerServiceDefinition.builder("google.iam.credentials.v1.IAMCredentials")
+ .addMethod(signJwt, ServerCalls.asyncUnaryCall((request,
response) -> {
+ requests.add(request);
+
response.onNext(SignJwtResponse.newBuilder().setKeyId("key-id").setSignedJwt("signed.jwt").build());
+ response.onCompleted();
+ }))
+ .build();
+ }
+}
diff --git
a/core/camel-api/src/main/java/org/apache/camel/vault/HashicorpVaultConfiguration.java
b/core/camel-api/src/main/java/org/apache/camel/vault/HashicorpVaultConfiguration.java
index 4d06c6d2150b..9881fee6d631 100644
---
a/core/camel-api/src/main/java/org/apache/camel/vault/HashicorpVaultConfiguration.java
+++
b/core/camel-api/src/main/java/org/apache/camel/vault/HashicorpVaultConfiguration.java
@@ -26,7 +26,7 @@ import org.jspecify.annotations.Nullable;
*/
public class HashicorpVaultConfiguration extends VaultConfiguration {
- @Metadata(defaultValue = "token", enums =
"token,approle,kubernetes,jwt,cert,aws-iam,azure-msi,gcp-gce")
+ @Metadata(defaultValue = "token", enums =
"token,approle,kubernetes,jwt,cert,aws-iam,azure-msi,gcp-gce,gcp-iam")
private @Nullable String authentication = "token";
@Metadata(security = "secret")
private @Nullable String token;
@@ -60,6 +60,10 @@ public class HashicorpVaultConfiguration extends
VaultConfiguration {
private @Nullable String azureResource = "https://management.azure.com/";
@Metadata
private @Nullable String azureClientId;
+ @Metadata
+ private @Nullable String gcpServiceAccountId;
+ @Metadata
+ private @Nullable String gcpCredentialsFile;
@Metadata(required = true)
private @Nullable String host;
@Metadata(required = true)
@@ -99,8 +103,9 @@ public class HashicorpVaultConfiguration extends
VaultConfiguration {
* How to log in to hashicorp vault: token (a fixed token), approle (a
role ID and a secret ID), kubernetes (the
* service account token of the pod), jwt (a JWT, such as a workload
identity token), cert (the TLS client
* certificate of the keyStore), aws-iam (the AWS credentials of the
application), azure-msi (the Azure managed
- * identity) or gcp-gce (the service account of the Google Compute Engine
instance). Camel renews the token before
- * it expires, and logs in again when the token can no longer be renewed.
+ * identity), gcp-gce (the service account of the Google Compute Engine
instance) or gcp-iam (a JWT signed for a
+ * Google service account, with the Google credentials of the
application). Camel renews the token before it
+ * expires, and logs in again when the token can no longer be renewed.
*
* @since 4.24
*/
@@ -148,9 +153,9 @@ public class HashicorpVaultConfiguration extends
VaultConfiguration {
}
/**
- * The hashicorp vault role to log in as, for the kubernetes, jwt, cert,
aws-iam, azure-msi and gcp-gce logins. The
- * jwt login can leave it out when the login method has a default role,
the aws-iam login to log in as the role
- * named as the IAM principal, and the cert login to let Vault pick the
certificate role that trusts the
+ * The hashicorp vault role to log in as, for the kubernetes, jwt, cert,
aws-iam, azure-msi, gcp-gce and gcp-iam
+ * logins. The jwt login can leave it out when the login method has a
default role, the aws-iam login to log in as
+ * the role named as the IAM principal, and the cert login to let Vault
pick the certificate role that trusts the
* certificate.
*
* @since 4.24
@@ -202,7 +207,8 @@ public class HashicorpVaultConfiguration extends
VaultConfiguration {
/**
* The path the login method is mounted at in hashicorp vault (without
auth/), when it is not the default path of
- * the login method: approle, kubernetes, jwt, cert, aws (for aws-iam),
azure (for azure-msi) or gcp (for gcp-gce)
+ * the login method: approle, kubernetes, jwt, cert, aws (for aws-iam),
azure (for azure-msi) or gcp (for gcp-gce
+ * and gcp-iam)
*
* @since 4.24
*/
@@ -364,6 +370,45 @@ public class HashicorpVaultConfiguration extends
VaultConfiguration {
this.azureClientId = azureClientId;
}
+ /**
+ * The service account to sign the JWT of the gcp-iam login as
+ *
+ * @since 4.25
+ */
+ public @Nullable String getGcpServiceAccountId() {
+ return gcpServiceAccountId;
+ }
+
+ /**
+ * The service account to sign the JWT of the gcp-iam login as: its email
address or its unique ID. It can be left
+ * out when the credentials are a service account key, which names its
service account.
+ *
+ * @since 4.25
+ */
+ public void setGcpServiceAccountId(@Nullable String gcpServiceAccountId) {
+ this.gcpServiceAccountId = gcpServiceAccountId;
+ }
+
+ /**
+ * The file with the Google credentials of the gcp-iam login
+ *
+ * @since 4.25
+ */
+ public @Nullable String getGcpCredentialsFile() {
+ return gcpCredentialsFile;
+ }
+
+ /**
+ * The file with the Google credentials of the gcp-iam login: a service
account key, or an external account
+ * configuration (workload identity federation). When not set, the
credentials of the Google default chain
+ * (Application Default Credentials), such as the workload identity of GKE.
+ *
+ * @since 4.25
+ */
+ public void setGcpCredentialsFile(@Nullable String gcpCredentialsFile) {
+ this.gcpCredentialsFile = gcpCredentialsFile;
+ }
+
public @Nullable String getHost() {
return host;
}
diff --git
a/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationConfigurer.java
b/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationConfigurer.java
index 312d56a49318..074bf67c726a 100644
---
a/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationConfigurer.java
+++
b/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationConfigurer.java
@@ -44,6 +44,10 @@ public class HashicorpVaultConfigurationConfigurer extends
org.apache.camel.supp
case "cloud": target.setCloud(property(camelContext, boolean.class,
value)); return true;
case "cyberarkvaultconfiguration":
case "cyberArkVaultConfiguration":
target.setCyberArkVaultConfiguration(property(camelContext,
org.apache.camel.vault.CyberArkVaultConfiguration.class, value)); return true;
+ case "gcpcredentialsfile":
+ case "gcpCredentialsFile":
target.setGcpCredentialsFile(property(camelContext, java.lang.String.class,
value)); return true;
+ case "gcpserviceaccountid":
+ case "gcpServiceAccountId":
target.setGcpServiceAccountId(property(camelContext, java.lang.String.class,
value)); return true;
case "gcpvaultconfiguration":
case "gcpVaultConfiguration":
target.setGcpVaultConfiguration(property(camelContext,
org.apache.camel.vault.GcpVaultConfiguration.class, value)); return true;
case "hashicorpvaultconfiguration":
@@ -109,6 +113,10 @@ public class HashicorpVaultConfigurationConfigurer extends
org.apache.camel.supp
case "cloud": return boolean.class;
case "cyberarkvaultconfiguration":
case "cyberArkVaultConfiguration": return
org.apache.camel.vault.CyberArkVaultConfiguration.class;
+ case "gcpcredentialsfile":
+ case "gcpCredentialsFile": return java.lang.String.class;
+ case "gcpserviceaccountid":
+ case "gcpServiceAccountId": return java.lang.String.class;
case "gcpvaultconfiguration":
case "gcpVaultConfiguration": return
org.apache.camel.vault.GcpVaultConfiguration.class;
case "hashicorpvaultconfiguration":
@@ -175,6 +183,10 @@ public class HashicorpVaultConfigurationConfigurer extends
org.apache.camel.supp
case "cloud": return target.isCloud();
case "cyberarkvaultconfiguration":
case "cyberArkVaultConfiguration": return
target.getCyberArkVaultConfiguration();
+ case "gcpcredentialsfile":
+ case "gcpCredentialsFile": return target.getGcpCredentialsFile();
+ case "gcpserviceaccountid":
+ case "gcpServiceAccountId": return target.getGcpServiceAccountId();
case "gcpvaultconfiguration":
case "gcpVaultConfiguration": return target.getGcpVaultConfiguration();
case "hashicorpvaultconfiguration":
diff --git
a/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationPropertiesConfigurer.java
b/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationPropertiesConfigurer.java
index cc3c175c2ae6..48702b91fffc 100644
---
a/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationPropertiesConfigurer.java
+++
b/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationPropertiesConfigurer.java
@@ -34,6 +34,8 @@ public class HashicorpVaultConfigurationPropertiesConfigurer
extends org.apache.
map.put("AzureVaultConfiguration",
org.apache.camel.vault.AzureVaultConfiguration.class);
map.put("Cloud", boolean.class);
map.put("CyberArkVaultConfiguration",
org.apache.camel.vault.CyberArkVaultConfiguration.class);
+ map.put("GcpCredentialsFile", java.lang.String.class);
+ map.put("GcpServiceAccountId", java.lang.String.class);
map.put("GcpVaultConfiguration",
org.apache.camel.vault.GcpVaultConfiguration.class);
map.put("HashicorpVaultConfiguration",
org.apache.camel.vault.HashicorpVaultConfiguration.class);
map.put("Host", java.lang.String.class);
@@ -84,6 +86,10 @@ public class HashicorpVaultConfigurationPropertiesConfigurer
extends org.apache.
case "cloud": target.setCloud(property(camelContext, boolean.class,
value)); return true;
case "cyberarkvaultconfiguration":
case "cyberArkVaultConfiguration":
target.setCyberArkVaultConfiguration(property(camelContext,
org.apache.camel.vault.CyberArkVaultConfiguration.class, value)); return true;
+ case "gcpcredentialsfile":
+ case "gcpCredentialsFile":
target.setGcpCredentialsFile(property(camelContext, java.lang.String.class,
value)); return true;
+ case "gcpserviceaccountid":
+ case "gcpServiceAccountId":
target.setGcpServiceAccountId(property(camelContext, java.lang.String.class,
value)); return true;
case "gcpvaultconfiguration":
case "gcpVaultConfiguration":
target.setGcpVaultConfiguration(property(camelContext,
org.apache.camel.vault.GcpVaultConfiguration.class, value)); return true;
case "hashicorpvaultconfiguration":
@@ -154,6 +160,10 @@ public class
HashicorpVaultConfigurationPropertiesConfigurer extends org.apache.
case "cloud": return boolean.class;
case "cyberarkvaultconfiguration":
case "cyberArkVaultConfiguration": return
org.apache.camel.vault.CyberArkVaultConfiguration.class;
+ case "gcpcredentialsfile":
+ case "gcpCredentialsFile": return java.lang.String.class;
+ case "gcpserviceaccountid":
+ case "gcpServiceAccountId": return java.lang.String.class;
case "gcpvaultconfiguration":
case "gcpVaultConfiguration": return
org.apache.camel.vault.GcpVaultConfiguration.class;
case "hashicorpvaultconfiguration":
@@ -220,6 +230,10 @@ public class
HashicorpVaultConfigurationPropertiesConfigurer extends org.apache.
case "cloud": return target.isCloud();
case "cyberarkvaultconfiguration":
case "cyberArkVaultConfiguration": return
target.getCyberArkVaultConfiguration();
+ case "gcpcredentialsfile":
+ case "gcpCredentialsFile": return target.getGcpCredentialsFile();
+ case "gcpserviceaccountid":
+ case "gcpServiceAccountId": return target.getGcpServiceAccountId();
case "gcpvaultconfiguration":
case "gcpVaultConfiguration": return target.getGcpVaultConfiguration();
case "hashicorpvaultconfiguration":
diff --git
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index 5f20813ccc9e..adfc0732db73 100644
---
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -617,14 +617,16 @@
{ "name": "camel.vault.gcp.serviceAccountKey", "required": false,
"description": "The JSON key file of the service account to authenticate with,
loaded as a resource: from the classpath by default, or from the file system
with the file: prefix.", "sourceType":
"org.apache.camel.vault.GcpVaultConfiguration", "type": "string", "javaType":
"java.lang.String", "secret": true, "security": "secret" },
{ "name": "camel.vault.gcp.subscriptionName", "required": false,
"description": "The name of the Google Cloud Pub\/Sub subscription, in the
project in projectId, that receives the Secret Manager events, for the secret
refresh.", "sourceType": "org.apache.camel.vault.GcpVaultConfiguration",
"type": "string", "javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.gcp.useDefaultInstance", "required": false,
"description": "Whether to authenticate with the Application Default
Credentials of the Google Cloud client libraries, when serviceAccountKey is not
set. Requires projectId.", "sourceType":
"org.apache.camel.vault.GcpVaultConfiguration", "type": "boolean", "javaType":
"boolean", "defaultValue": false, "secret": false },
- { "name": "camel.vault.hashicorp.authentication", "required": false,
"description": "How to log in to hashicorp vault: token (a fixed token),
approle (a role ID and a secret ID), kubernetes (the service account token of
the pod), jwt (a JWT, such as a workload identity token), cert (the TLS client
certificate of the keyStore), aws-iam (the AWS credentials of the application),
azure-msi (the Azure managed identity) or gcp-gce (the service account of the
Google Compute Engine instance) [...]
- { "name": "camel.vault.hashicorp.authMountPath", "required": false,
"description": "The path the login method is mounted at in hashicorp vault
(without auth\/), when it is not the default path of the login method: approle,
kubernetes, jwt, cert, aws (for aws-iam), azure (for azure-msi) or gcp (for
gcp-gce)", "sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration",
"type": "string", "javaType": "java.lang.String", "secret": false },
+ { "name": "camel.vault.hashicorp.authentication", "required": false,
"description": "How to log in to hashicorp vault: token (a fixed token),
approle (a role ID and a secret ID), kubernetes (the service account token of
the pod), jwt (a JWT, such as a workload identity token), cert (the TLS client
certificate of the keyStore), aws-iam (the AWS credentials of the application),
azure-msi (the Azure managed identity), gcp-gce (the service account of the
Google Compute Engine instance) o [...]
+ { "name": "camel.vault.hashicorp.authMountPath", "required": false,
"description": "The path the login method is mounted at in hashicorp vault
(without auth\/), when it is not the default path of the login method: approle,
kubernetes, jwt, cert, aws (for aws-iam), azure (for azure-msi) or gcp (for
gcp-gce and gcp-iam)", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.awsIamServerId", "required": false,
"description": "The value of the X-Vault-AWS-IAM-Server-ID header of the
aws-iam login, when the AWS login of hashicorp vault requires one
(iam_server_id_header_value)", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.awsRegion", "required": false,
"description": "The AWS region the aws-iam login signs its request for, which
must be the region of awsStsEndpoint. When not set: us-east-1 with the global
endpoint, else the region of the AWS SDK default region chain (such as the
AWS_REGION environment variable).", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.awsStsEndpoint", "required": false,
"description": "The AWS STS endpoint of the aws-iam login, which the AWS login
of hashicorp vault must accept (its sts_endpoint). When not set, the global
endpoint https:\/\/sts.amazonaws.com\/.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.azureClientId", "required": false,
"description": "The client ID of a user-assigned managed identity, for the
azure-msi login. When not set, the system-assigned managed identity.",
"sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration", "type":
"string", "javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.azureResource", "required": false,
"description": "The resource (audience) of the managed identity token of the
azure-msi login, which must be the resource of the Azure login of hashicorp
vault", "sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration",
"type": "string", "javaType": "java.lang.String", "defaultValue":
"https:\/\/management.azure.com\/", "secret": false },
{ "name": "camel.vault.hashicorp.cloud", "required": false, "description":
"Whether hashicorp vault runs on HashiCorp Cloud Platform: Camel then logs in
and reads the secrets in namespace.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "boolean",
"javaType": "boolean", "defaultValue": false, "secret": false },
+ { "name": "camel.vault.hashicorp.gcpCredentialsFile", "required": false,
"description": "The file with the Google credentials of the gcp-iam login: a
service account key, or an external account configuration (workload identity
federation). When not set, the credentials of the Google default chain
(Application Default Credentials), such as the workload identity of GKE.",
"sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration", "type":
"string", "javaType": "java.lang.String [...]
+ { "name": "camel.vault.hashicorp.gcpServiceAccountId", "required": false,
"description": "The service account to sign the JWT of the gcp-iam login as:
its email address or its unique ID. It can be left out when the credentials are
a service account key, which names its service account.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.host", "required": true, "description":
"Host to access hashicorp vault", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.jwt", "required": false, "description":
"The JWT to log in with, for the jwt and kubernetes logins. For a JWT that is
replaced over time, such as a projected service account token, use jwtFile
instead.", "sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration",
"type": "string", "javaType": "java.lang.String", "secret": true, "security":
"secret" },
{ "name": "camel.vault.hashicorp.jwtFile", "required": false,
"description": "The file to read the JWT from at every login, for the jwt and
kubernetes logins. The kubernetes login reads
\/var\/run\/secrets\/kubernetes.io\/serviceaccount\/token when neither jwt nor
jwtFile is set.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
@@ -634,7 +636,7 @@
{ "name": "camel.vault.hashicorp.port", "required": true, "description":
"Port to access hashicorp vault", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.refreshEnabled", "required": false,
"description": "Whether to reload the CamelContext when a new version of a
secret is written in hashicorp vault. Camel reads the current version of each
secret from its metadata (KV secrets engine version 2) every refreshPeriod.",
"sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration", "type":
"boolean", "javaType": "boolean", "defaultValue": false, "secret": false },
{ "name": "camel.vault.hashicorp.refreshPeriod", "required": false,
"description": "The period (millis) between checking Hashicorp Vault for
updated secrets.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "integer",
"javaType": "long", "defaultValue": 60000, "secret": false },
- { "name": "camel.vault.hashicorp.role", "required": false, "description":
"The hashicorp vault role to log in as, for the kubernetes, jwt, cert, aws-iam,
azure-msi and gcp-gce logins. The jwt login can leave it out when the login
method has a default role, the aws-iam login to log in as the role named as the
IAM principal, and the cert login to let Vault pick the certificate role that
trusts the certificate.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type" [...]
+ { "name": "camel.vault.hashicorp.role", "required": false, "description":
"The hashicorp vault role to log in as, for the kubernetes, jwt, cert, aws-iam,
azure-msi, gcp-gce and gcp-iam logins. The jwt login can leave it out when the
login method has a default role, the aws-iam login to log in as the role named
as the IAM principal, and the cert login to let Vault pick the certificate role
that trusts the certificate.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration [...]
{ "name": "camel.vault.hashicorp.roleId", "required": false,
"description": "The role ID of the AppRole, for the approle login",
"sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration", "type":
"string", "javaType": "java.lang.String", "secret": true, "security": "secret"
},
{ "name": "camel.vault.hashicorp.scheme", "required": true, "description":
"The scheme to access hashicorp vault: http or https.", "sourceType":
"org.apache.camel.vault.HashicorpVaultConfiguration", "type": "string",
"javaType": "java.lang.String", "secret": false },
{ "name": "camel.vault.hashicorp.secretId", "required": false,
"description": "The secret ID of the AppRole, for the approle login",
"sourceType": "org.apache.camel.vault.HashicorpVaultConfiguration", "type":
"string", "javaType": "java.lang.String", "secret": true, "security": "secret"
},
diff --git
a/core/camel-main/src/generated/resources/org/apache/camel/main/main-options.properties
b/core/camel-main/src/generated/resources/org/apache/camel/main/main-options.properties
index 38b53ceab8f6..f1e79a30410f 100644
---
a/core/camel-main/src/generated/resources/org/apache/camel/main/main-options.properties
+++
b/core/camel-main/src/generated/resources/org/apache/camel/main/main-options.properties
@@ -583,6 +583,8 @@ camel.vault.hashicorp.awsStsEndpoint
camel.vault.hashicorp.azureClientId
camel.vault.hashicorp.azureResource
camel.vault.hashicorp.cloud
+camel.vault.hashicorp.gcpCredentialsFile
+camel.vault.hashicorp.gcpServiceAccountId
camel.vault.hashicorp.host
camel.vault.hashicorp.jwt
camel.vault.hashicorp.jwtFile
diff --git a/core/camel-main/src/main/docs/main.adoc
b/core/camel-main/src/main/docs/main.adoc
index 5f2a2b7cc46a..cac1d8baee84 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -563,19 +563,21 @@ The camel.vault.kubernetescm supports 2 options, which
are listed below.
=== Camel Hashicorp Vault configurations
-The camel.vault.hashicorp supports 25 options, which are listed below.
+The camel.vault.hashicorp supports 27 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| `camel.vault.hashicorp.authentication` | How to log in to hashicorp vault:
token (a fixed token), approle (a role ID and a secret ID), kubernetes (the
service account token of the pod), jwt (a JWT, such as a workload identity
token), cert (the TLS client certificate of the keyStore), aws-iam (the AWS
credentials of the application), azure-msi (the Azure managed identity) or
gcp-gce (the service account of the Google Compute Engine instance). Camel
renews the token before it expires, an [...]
-| `camel.vault.hashicorp.authMountPath` | The path the login method is mounted
at in hashicorp vault (without auth/), when it is not the default path of the
login method: approle, kubernetes, jwt, cert, aws (for aws-iam), azure (for
azure-msi) or gcp (for gcp-gce) | | String
+| `camel.vault.hashicorp.authentication` | How to log in to hashicorp vault:
token (a fixed token), approle (a role ID and a secret ID), kubernetes (the
service account token of the pod), jwt (a JWT, such as a workload identity
token), cert (the TLS client certificate of the keyStore), aws-iam (the AWS
credentials of the application), azure-msi (the Azure managed identity),
gcp-gce (the service account of the Google Compute Engine instance) or gcp-iam
(a JWT signed for a Google service a [...]
+| `camel.vault.hashicorp.authMountPath` | The path the login method is mounted
at in hashicorp vault (without auth/), when it is not the default path of the
login method: approle, kubernetes, jwt, cert, aws (for aws-iam), azure (for
azure-msi) or gcp (for gcp-gce and gcp-iam) | | String
| `camel.vault.hashicorp.awsIamServerId` | The value of the
X-Vault-AWS-IAM-Server-ID header of the aws-iam login, when the AWS login of
hashicorp vault requires one (iam_server_id_header_value) | | String
| `camel.vault.hashicorp.awsRegion` | The AWS region the aws-iam login signs
its request for, which must be the region of awsStsEndpoint. When not set:
us-east-1 with the global endpoint, else the region of the AWS SDK default
region chain (such as the AWS_REGION environment variable). | | String
| `camel.vault.hashicorp.awsStsEndpoint` | The AWS STS endpoint of the aws-iam
login, which the AWS login of hashicorp vault must accept (its sts_endpoint).
When not set, the global endpoint \https://sts.amazonaws.com/. | | String
| `camel.vault.hashicorp.azureClientId` | The client ID of a user-assigned
managed identity, for the azure-msi login. When not set, the system-assigned
managed identity. | | String
| `camel.vault.hashicorp.azureResource` | The resource (audience) of the
managed identity token of the azure-msi login, which must be the resource of
the Azure login of hashicorp vault | https://management.azure.com/ | String
| `camel.vault.hashicorp.cloud` | Whether hashicorp vault runs on HashiCorp
Cloud Platform: Camel then logs in and reads the secrets in namespace. | false
| boolean
+| `camel.vault.hashicorp.gcpCredentialsFile` | The file with the Google
credentials of the gcp-iam login: a service account key, or an external account
configuration (workload identity federation). When not set, the credentials of
the Google default chain (Application Default Credentials), such as the
workload identity of GKE. | | String
+| `camel.vault.hashicorp.gcpServiceAccountId` | The service account to sign
the JWT of the gcp-iam login as: its email address or its unique ID. It can be
left out when the credentials are a service account key, which names its
service account. | | String
| `camel.vault.hashicorp.host` | Host to access hashicorp vault | | String
| `camel.vault.hashicorp.jwt` | The JWT to log in with, for the jwt and
kubernetes logins. For a JWT that is replaced over time, such as a projected
service account token, use jwtFile instead. | | String
| `camel.vault.hashicorp.jwtFile` | The file to read the JWT from at every
login, for the jwt and kubernetes logins. The kubernetes login reads
/var/run/secrets/kubernetes.io/serviceaccount/token when neither jwt nor
jwtFile is set. | | String
@@ -585,7 +587,7 @@ The camel.vault.hashicorp supports 25 options, which are
listed below.
| `camel.vault.hashicorp.port` | Port to access hashicorp vault | | String
| `camel.vault.hashicorp.refreshEnabled` | Whether to reload the CamelContext
when a new version of a secret is written in hashicorp vault. Camel reads the
current version of each secret from its metadata (KV secrets engine version 2)
every refreshPeriod. | false | boolean
| `camel.vault.hashicorp.refreshPeriod` | The period (millis) between checking
Hashicorp Vault for updated secrets. | 60000 | long
-| `camel.vault.hashicorp.role` | The hashicorp vault role to log in as, for
the kubernetes, jwt, cert, aws-iam, azure-msi and gcp-gce logins. The jwt login
can leave it out when the login method has a default role, the aws-iam login to
log in as the role named as the IAM principal, and the cert login to let Vault
pick the certificate role that trusts the certificate. | | String
+| `camel.vault.hashicorp.role` | The hashicorp vault role to log in as, for
the kubernetes, jwt, cert, aws-iam, azure-msi, gcp-gce and gcp-iam logins. The
jwt login can leave it out when the login method has a default role, the
aws-iam login to log in as the role named as the IAM principal, and the cert
login to let Vault pick the certificate role that trusts the certificate. | |
String
| `camel.vault.hashicorp.roleId` | The role ID of the AppRole, for the approle
login | | String
| `camel.vault.hashicorp.scheme` | The scheme to access hashicorp vault: http
or https. | | String
| `camel.vault.hashicorp.secretId` | The secret ID of the AppRole, for the
approle login | | String
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/HashicorpVaultConfigurationProperties.java
b/core/camel-main/src/main/java/org/apache/camel/main/HashicorpVaultConfigurationProperties.java
index 16383c5ce56b..f56dcfc53ee3 100644
---
a/core/camel-main/src/main/java/org/apache/camel/main/HashicorpVaultConfigurationProperties.java
+++
b/core/camel-main/src/main/java/org/apache/camel/main/HashicorpVaultConfigurationProperties.java
@@ -186,6 +186,24 @@ public class HashicorpVaultConfigurationProperties extends
HashicorpVaultConfigu
return this;
}
+ /**
+ * The service account to sign the JWT of the gcp-iam login as, by its
email or unique ID. It can be left out when
+ * the credentials are a service account key, which names its service
account.
+ */
+ public HashicorpVaultConfigurationProperties
withGcpServiceAccountId(String gcpServiceAccountId) {
+ setGcpServiceAccountId(gcpServiceAccountId);
+ return this;
+ }
+
+ /**
+ * The file with the Google credentials of the gcp-iam login: a service
account key, or an external account
+ * configuration. When not set, the credentials of the Google default
chain.
+ */
+ public HashicorpVaultConfigurationProperties withGcpCredentialsFile(String
gcpCredentialsFile) {
+ setGcpCredentialsFile(gcpCredentialsFile);
+ return this;
+ }
+
/**
* The Hashicorp Vault host
*/
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HashicorpVaultEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HashicorpVaultEndpointBuilderFactory.java
index 0bdb5a544313..f4e48747af71 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HashicorpVaultEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HashicorpVaultEndpointBuilderFactory.java
@@ -252,10 +252,12 @@ public interface HashicorpVaultEndpointBuilderFactory {
* role ID and a secret ID), kubernetes (the service account token of
* the pod), jwt (a JWT, such as a workload identity token), cert (the
* TLS client certificate of the keyStore), aws-iam (the AWS
credentials
- * of the application), azure-msi (the Azure managed identity) or
- * gcp-gce (the service account of the Google Compute Engine instance).
- * The token is renewed before it expires, and the endpoint logs in
- * again when the token can no longer be renewed.
+ * of the application), azure-msi (the Azure managed identity), gcp-gce
+ * (the service account of the Google Compute Engine instance) or
+ * gcp-iam (a JWT signed for a Google service account, with the Google
+ * credentials of the application). The token is renewed before it
+ * expires, and the endpoint logs in again when the token can no longer
+ * be renewed.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -273,7 +275,7 @@ public interface HashicorpVaultEndpointBuilderFactory {
* The path the login method is mounted at in HashiCorp Vault (without
* auth/), when it is not the default path of the login method:
approle,
* kubernetes, jwt, cert, aws (for aws-iam), azure (for azure-msi) or
- * gcp (for gcp-gce).
+ * gcp (for gcp-gce and gcp-iam).
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -367,6 +369,41 @@ public interface HashicorpVaultEndpointBuilderFactory {
doSetProperty("azureResource", azureResource);
return this;
}
+ /**
+ * The file with the Google credentials of the gcp-iam login: a service
+ * account key, or an external account configuration (workload identity
+ * federation). When not set, the credentials of the Google default
+ * chain (Application Default Credentials), such as the workload
+ * identity of GKE.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: security
+ *
+ * @param gcpCredentialsFile the value to set
+ * @return the dsl builder
+ */
+ default HashicorpVaultEndpointBuilder gcpCredentialsFile(String
gcpCredentialsFile) {
+ doSetProperty("gcpCredentialsFile", gcpCredentialsFile);
+ return this;
+ }
+ /**
+ * The service account to sign the JWT of the gcp-iam login as: its
+ * email address or its unique ID. It can be left out when the
+ * credentials are a service account key, which names its service
+ * account.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: security
+ *
+ * @param gcpServiceAccountId the value to set
+ * @return the dsl builder
+ */
+ default HashicorpVaultEndpointBuilder gcpServiceAccountId(String
gcpServiceAccountId) {
+ doSetProperty("gcpServiceAccountId", gcpServiceAccountId);
+ return this;
+ }
/**
* The JWT to log in with, for the jwt and kubernetes logins. For a JWT
* that is replaced over time, such as a projected service account
@@ -435,10 +472,11 @@ public interface HashicorpVaultEndpointBuilderFactory {
}
/**
* The HashiCorp Vault role to log in as, for the kubernetes, jwt,
cert,
- * aws-iam, azure-msi and gcp-gce logins. The jwt login can leave it
out
- * when the login method has a default role, the aws-iam login to log
in
- * as the role named as the IAM principal, and the cert login to let
- * Vault pick the certificate role that trusts the certificate.
+ * aws-iam, azure-msi, gcp-gce and gcp-iam logins. The jwt login can
+ * leave it out when the login method has a default role, the aws-iam
+ * login to log in as the role named as the IAM principal, and the cert
+ * login to let Vault pick the certificate role that trusts the
+ * certificate.
*
* The option is a: <code>java.lang.String</code> type.
*
diff --git a/parent/pom.xml b/parent/pom.xml
index e3dde9835e8d..5c5af645aa3d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -217,6 +217,7 @@
<google-cloud-firestore-version>3.53.0</google-cloud-firestore-version>
<google-cloud-functions-version>2.88.0</google-cloud-functions-version>
<google-cloud-http-client-version>2.2.0</google-cloud-http-client-version>
+
<google-cloud-iamcredentials-version>2.103.0</google-cloud-iamcredentials-version>
<google-cloud-pubsub-version>1.161.0</google-cloud-pubsub-version>
<google-cloud-secretmanager-version>2.103.0</google-cloud-secretmanager-version>
<google-cloud-storage-version>2.79.0</google-cloud-storage-version>