oscerd opened a new pull request, #28274: URL: https://github.com/apache/camel/pull/28274
Jira: https://issues.apache.org/jira/browse/CAMEL-25918 ### Problem `AS2ConnectionHelper` keeps one `AS2ServerConnection` per `serverPortNumber`, built from the first endpoint created on that port. Since CAMEL-22557 the signing and decrypting material is selected per request path (`AS2ServerConnection.AS2ConsumerConfiguration`, registered by `AS2Consumer.doStart` for the consumer's `requestUriPattern`), but the asynchronous MDN settings (`mdnUserName`, `mdnPassword` and `mdnAccessToken`, added by CAMEL-21875, and `asyncMdnAllowedHosts`) stayed connection-wide fields taken from the first endpoint only. When several `as2://server/listen` consumers share a port with different `requestUriPattern` values: - the asynchronous MDN for a message received on a second consumer's path was delivered with the first consumer's MDN settings, and the second consumer's own values were ignored without anything being logged; - a consumer with the default `/` pattern never registered its own configuration when another endpoint had created the connection (`doStart` only registered when no configuration matched, and the constructor's `/` fallback always matched); - the first consumer's MDN settings stayed in use for the other consumers after the first consumer's route was stopped, because `unlisten` removes only the path's handler and configuration. A single consumer per port is not affected. The four options are documented as endpoint options, so each consumer is expected to apply its own values. ### Change - `camel-as2-api`, `AS2ServerConnection`: `AS2ConsumerConfiguration` carries `mdnUserName`, `mdnPassword`, `mdnAccessToken` and `asyncMdnAllowedHosts` through a new constructor; the existing five-argument constructor stays and delegates with null values. `handleAsynchronousMDN` builds the `AS2AsynchronousMDNManager` from the matched path's configuration instead of the connection-level fields, which are removed. The `/` fallback registered by the constructor carries the constructor's values, so direct users of `AS2ServerConnection` and single-consumer deployments behave as before. The javadoc of `registerConsumerConfiguration` states that each consumer registers its own configuration for its own pattern. - `camel-as2-component`, `AS2Consumer.doStart`: registers the consumer's own configuration (keys, certificates and MDN settings) for its own `requestUriPattern`, replacing the `/` fallback when the pattern is `/`. - `AS2Configuration`: the javadoc of the four options states that they apply to the consumer endpoint they are set on; `as2.json`, the catalog mirror and `AS2EndpointBuilderFactory` are regenerated. - `as2-component.adoc`: a note under Usage that consumers sharing a `serverPortNumber` each apply their own keys and asynchronous MDN settings. - Upgrade guide 4.24: consumers that share a port now use their own settings; a consumer that relied on inheriting the first consumer's values has to set them itself. The backports will add the same note to the 4.22 and 4.18 guides on `main`. ### Tests - `AS2ServerTwoConsumerAsyncMdnSettingsTest` (camel-as2-component): four consumers on one port (a first consumer with basic authentication and an allowed-host list, a second with a bearer token and its own list, one without settings, one on the default `/` pattern) and local receipt endpoints. The asynchronous MDN for the second consumer carries its own bearer token and follows its own allowed-host list; a consumer without settings sends no `Authorization` header; the consumer on `/` uses its own token; the first consumer is unchanged; after the first consumer's route stops, the remaining consumer's settings are used. Without the change, the five tests about the other consumers fail (the MDN carried the first consumer's basic authentication, or followed its allowed-host list). - `AS2ConsumerConfigurationMdnSettingsTest` (camel-as2-api): the per-path configuration carries the settings, the `/` fallback carries the constructor's values, and registering a path again replaces its configuration. - Existing tests kept green: `AS2AsyncMdnBasicAuthHeaderTest`, `AS2AsyncMdnTokenAuthHeaderTest`, `AS2AsyncMdnContextReuseTest`, `AS2AsynchronousMDNManagerDeliveryAddressTest`, the camel-as2-api and camel-as2-component unit tests, and `AS2ServerTwoConsumerSecEncryptedIT`. _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]
