oscerd opened a new pull request, #31187: URL: https://github.com/apache/camel/pull/31187
## Summary [CAMEL-27918](https://issues.apache.org/jira/browse/CAMEL-27918), the last of the three follow-ups of [CAMEL-25675](https://issues.apache.org/jira/browse/CAMEL-25675), which added the `gcp-gce` login and deferred `gcp-iam`. The `gcp-iam` login signs a JWT for a Google service account through the IAM Credentials API (Spring Vault `GcpIamCredentialsAuthentication`), for a role of type `iam` of the GCP login of Vault. Unlike `gcp-gce`, it also works outside Compute Engine. - **`authentication=gcp-iam`**, with `role` and `authMountPath` as for `gcp-gce`. - **Credentials.** `gcpCredentialsFile` takes a service account key or an external account configuration (workload identity federation). Without it, the login takes the credentials of the Google default chain (Application Default Credentials), such as the workload identity of GKE. Credentials without a scope get the `cloud-platform` scope of the IAM Credentials API. - **The credentials file is read by the loader of its type** (`ServiceAccountCredentials` or `ExternalAccountCredentials`), as Google recommends: `GoogleCredentials.fromStream` is marked `@ObsoleteApi`, since it also takes configurations that run commands or reach any URL. Other types are refused with a message. - **`gcpServiceAccountId`**: the service account to sign the JWT as, by its email or unique ID. It is needed unless the credentials are a service account key, which names its service account; without it, creating the client fails with a message. - **Configuration.** As for the other logins, the endpoint options, the `camel.vault.hashicorp` options (with `withGcpServiceAccountId` and `withGcpCredentialsFile` in camel-main) and the `CAMEL_HASHICORP_VAULT_GCP_SERVICE_ACCOUNT_ID` and `CAMEL_HASHICORP_VAULT_GCP_CREDENTIALS_FILE` environment variables. - **Optional dependency.** `com.google.cloud:google-cloud-iamcredentials` (gRPC) is needed only for this login, as the AWS SDK is for `aws-iam`: the login is in a class of its own, loaded only for `gcp-iam`, and the validation says which dependency to add when it is missing. Its version, 2.103.0, is a new property of the parent POM, from the same Google Cloud libraries release as `google-cloud-secretmanager` 2.103.0 of the Camel Google components. - The documentation describes the login, including the `iam.serviceAccounts.signJwt` permission that the credentials need on the service account. camel-spring-boot mirrors the `camel.vault.hashicorp` options in `HashicorpVaultConfigurationProperties`: the two new ones follow there once this is in the SNAPSHOT. ## Tests - `HashicorpVaultGcpIamTest`: - logs in with Spring Vault's `GcpIamCredentialsAuthentication`, the options of the component, an in-process fake of the `SignJwt` method of the IAM Credentials API and a fake Vault. It checks the signed service account, the `sub` and `aud` of the JWT payload, and the `role` and `jwt` of the Vault login; - the role and mount path; - a service account key file gives the service account and the `cloud-platform` scope; - credentials that are not a service account key need `gcpServiceAccountId`; - a credentials file of another type is refused; - the role is required; - a client is created and closed without reaching Google. The tests never read the Google default chain, since it could find real credentials on the machine that runs them: the credentials are a fake access token or a service account key made for the test. - `HashicorpVaultClientSettingsTest`: the two settings from the environment variables and from the configuration. - All 93 unit tests and all 38 integration tests of the module pass (Vault container). Full reactor build (`mvn clean install -DskipTests -DskipITs`): the catalog, the camel-main metadata, configurers and `main.adoc`, the configurers and the endpoint DSL are regenerated and committed. _Claude Code on behalf of oscerd_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
