oscerd opened a new pull request, #31347:
URL: https://github.com/apache/camel/pull/31347
CAMEL-28103: Apply the HashiCorp Vault namespace consistently to all key
lifecycle operations
### Summary
In `HashicorpVaultKeyLifecycleManager`, read and list operations (`getKey`,
`getKeyMetadata`, `listKeys`, `loadExistingKeys`) prepend the configured
`namespace` when `cloud` is `true` (`namespace/secretsEngine/data/...` and
`namespace/secretsEngine/metadata/...`), whereas write, metadata update, and
delete operations (`storeKey`, `updateKeyMetadata`, `deleteKey`) passed only
`secretsEngine` to `vaultTemplate.opsForKeyValue(...)`.
This change extracts `getEnginePath()` (matching `HashicorpVaultProducer` in
`camel-hashicorp-vault`) so that `opsForKeyValue`, `buildDataPath`, and
`buildMetadataPath` all resolve the same engine path (`namespace/secretsEngine`
when `cloud` is `true` and `namespace` is non-empty, otherwise `secretsEngine`).
### Changes
-
`components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/HashicorpVaultKeyLifecycleManager.java`:
- Added `getEnginePath()` helper and updated `storeKey`,
`updateKeyMetadata`, `deleteKey`, `buildDataPath`, and `buildMetadataPath` to
use it.
-
`components/camel-pqc/src/test/java/org/apache/camel/component/pqc/lifecycle/HashicorpVaultNamespacePathConsistencyTest.java`:
- Added unit tests verifying write/read/list/update/delete path
consistency with `cloud=true` + namespace, `cloud=false`, and `cloud=true` with
an empty namespace.
### Testing
- Ran `components/camel-pqc` formatter, import sort, and unit tests
(`../../mvnw -B formatter:format impsort:sort test` with private Maven repo):
- `HashicorpVaultNamespacePathConsistencyTest`: 4 tests run, 0 failures, 0
errors, 0 skipped.
- `camel-pqc` module total: 481 tests run, 0 failures, 0 errors, 1 skipped.
- Full-reactor `mvn -B clean install -DskipTests -DskipITs` was not run in
this step.
_Antigravity on behalf of oscerd_
--
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]