oscerd opened a new pull request, #2091:
URL: https://github.com/apache/camel-spring-boot/pull/2091

   ## Summary
   
   [CAMEL-26919](https://issues.apache.org/jira/browse/CAMEL-26919): the early 
resolution of `hashicorp:` properties 
(`camel.component.hashicorp-vault.early-resolve-properties=true`) built its own 
`VaultTemplate` with `camel.vault.hashicorp.token`. So the logins of 
[CAMEL-25675](https://issues.apache.org/jira/browse/CAMEL-25675) (AppRole, 
Kubernetes, JWT, cert, aws-iam, azure-msi, gcp-gce) and the trust store and key 
store options did not apply to it. With this change it logs in with the 
`camel.vault.hashicorp` options, as the properties function of the CamelContext 
does.
   
   - `SpringBootHashicorpVaultPropertiesParser` binds `camel.vault.hashicorp` 
to the camel-api `HashicorpVaultConfiguration` with the Spring Boot `Binder`. 
The relaxed names work as for the CamelContext 
(`camel.vault.hashicorp.role-id`), and every option of the Camel version is 
bound, including those not yet in `HashicorpVaultConfigurationProperties` (the 
cloud logins of apache/camel#29708). The parser creates the client with 
`HashicorpVaultClient.create(HashicorpVaultClientSettings.fromConfiguration(...))`
 from apache/camel#29819, which needs no CamelContext and renews its token on a 
daemon thread while the properties are resolved.
   - `AbstractEarlyResolutionPropertiesParser` calls a new 
`release(PropertiesFunction)` hook once the properties are resolved, also when 
they could not be. It does nothing by default, so the other vault parsers are 
unchanged. The hashicorp parser closes its client there, which stops the 
renewal and revokes the token of the login (a token given for the token login 
is not revoked).
   - The messages for a missing host, port, scheme or token (token login) are 
unchanged. An incomplete login, such as AppRole without a secret ID, fails with 
a `RuntimeCamelException` that names the `camel.vault.hashicorp` options.
   
   **Draft until apache/camel#29819 is merged and published in the 
4.24.0-SNAPSHOT**: this change uses its new methods, so the CI fails until then.
   
   cc @Croway, since you mirrored the `camel.vault.hashicorp` options of 
CAMEL-25675 in `HashicorpVaultConfigurationProperties`. This PR changes only 
the early resolution. The cloud login options of apache/camel#29708 
(`awsIamServerId`, `awsRegion`, `awsStsEndpoint`, `azureResource`, 
`azureClientId`) are not mirrored there yet: the early resolution binds them 
already, but the CamelContext gets them only from that class.
   
   ## Tests
   
   - `AbstractEarlyResolutionPropertiesParserTest`: the properties function is 
released once the properties are resolved, and also when the resolution fails.
   - `SpringBootHashicorpVaultPropertiesParserTest`: an AppRole login with the 
kebab-case names needs no token, and an incomplete login fails as a 
`RuntimeCamelException` naming the options. The existing tests are unchanged.
   - `EarlyResolvedPropertiesAppRoleTest`: the early resolution logs in with 
AppRole against a Vault container, resolves the properties, and revokes the 
token of its login: no token of the AppRole login is left in 
`auth/token/accessors`. With the `release` of the parser disabled, the test 
fails on that check.
   - Built against the Camel artifacts of apache/camel#29819: all 15 tests of 
`AbstractEarlyResolutionPropertiesParserTest` and all 12 tests of 
`camel-hashicorp-vault-starter` pass.
   
   _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]

Reply via email to