oscerd opened a new pull request, #29819: URL: https://github.com/apache/camel/pull/29819
## Summary Fixes [CAMEL-26919](https://issues.apache.org/jira/browse/CAMEL-26919), a follow-up of [CAMEL-25675](https://issues.apache.org/jira/browse/CAMEL-25675) (#29235, #29619, #29708). Camel on Spring Boot can resolve `hashicorp:` properties early (`camel.component.hashicorp-vault.early-resolve-properties=true`), before there is a CamelContext. That early resolution builds its own `VaultTemplate` with `camel.vault.hashicorp.token`, so the logins of CAMEL-25675 (AppRole, Kubernetes, JWT, cert, cloud) and the TLS options do not apply to it: an application that logs in with AppRole needs a fixed token again just for the early resolution. It cannot use `HashicorpVaultClient` as it is, because the token renewal runs on the executor service manager of the CamelContext. This PR adds what camel-spring-boot needs: - `HashicorpVaultClient.create(HashicorpVaultClientSettings)` creates a client without a CamelContext. It renews its token on a daemon thread of its own (`Camel HashicorpVaultTokenRenewal`), and `close()` stops that thread and revokes the token of the login, as for the clients of the endpoint, the properties function and the secret refresh task. The two `create` methods share their code: only where the renewal runs differs. - `HashicorpVaultClientSettings.fromConfiguration(HashicorpVaultConfiguration)` takes the settings of the `camel.vault.hashicorp` options alone. Spring Boot binds these options itself, and the `CAMEL_HASHICORP_VAULT_*` environment variables belong to the properties function. `fromEnvironmentOrConfiguration` now delegates to it. - The Spring Boot section of the component documentation says that the early resolution logs in as the properties function does, and revokes the token of its login once the properties are resolved. The camel-spring-boot side follows in apache/camel-spring-boot once this change is in the SNAPSHOT: the early resolution binds `camel.vault.hashicorp` with Spring Boot's relaxed binding, logs in with `HashicorpVaultClient.create(settings)`, and closes the client once the properties are resolved. ## Tests - `HashicorpVaultClientTest.aClientWithoutCamelContextRenewsItsTokenOnADaemonThreadAndRevokesItOnClose`: an AppRole login against the fake Vault. The token is renewed on a daemon thread, and closing the client revokes it. - `HashicorpVaultClientSettingsTest.takesTheSettingsOfTheConfigurationAlone`. - All 81 unit tests and all 38 integration tests of the module pass (Vault container). Full reactor build (`mvn clean install -DskipTests -DskipITs`): the only regenerated file is the catalog copy of the component documentation, committed. - The camel-spring-boot change was built against these artifacts. Its tests include an AppRole login of the early resolution against a Vault container, which also checks that the token of the login is revoked once the properties are resolved. _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]
