Dhairya-007 opened a new pull request, #30040:
URL: https://github.com/apache/camel/pull/30040
## Problem
`lifecycleRotateKey` needs three headers, and rejects the exchange without
any of them:
```java
private void lifecycleRotateKey(Exchange exchange) throws Exception {
KeyLifecycleManager klm = getRequiredKeyLifecycleManager();
String oldKeyId = exchange.getMessage().getHeader(PQCConstants.KEY_ID,
String.class);
String newKeyId = exchange.getMessage().getHeader("CamelPQCNewKeyId",
String.class);
String algorithm =
exchange.getMessage().getHeader(PQCConstants.ALGORITHM, String.class);
...
if (ObjectHelper.isEmpty(newKeyId)) {
throw new IllegalArgumentException("New Key ID header
(CamelPQCNewKeyId) is required for rotateKey");
}
```
Two of them come from `PQCConstants`. The third is a bare string literal,
and it is the only hard-coded `CamelPQC*` header name in the component - every
other one of the ~30 headers is a documented constant in `PQCConstants`:
```
PQCProducer.java:1178:"CamelPQCNewKeyId" <- only occurrence outside a
Javadoc
PQCConstants.java:48:"CamelPQCKeyId"
PQCConstants.java:66:"CamelPQCAlgorithm"
...
```
Because there is no constant, there is no `@Metadata`, so `CamelPQCNewKeyId`
is absent from `pqc.json`, from the catalog and from the component's generated
header table. A header that is *mandatory* for one of the component's
operations is the one header a user cannot look up; the only way to learn its
name is to trigger the `IllegalArgumentException` and read the message.
## Fix
Add `NEW_KEY_ID` to `PQCConstants` with `@Metadata`, next to `KEY_ID`, and
use it in the producer for both the lookup and the error message - matching how
`KEY_ID` and `ALGORITHM` are already handled two lines above and below. The
header name is unchanged, so no route breaks.
The regenerated `pqc.json` files are included.
--
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]