gnodet opened a new pull request, #26500:
URL: https://github.com/apache/camel/pull/26500

   ## Summary
   
   Implements `SecretRotationAware` (added by CAMEL-24636 / #26166) on 
`HttpComponent` so that rotated secrets are picked up by HTTP endpoints on the 
next route start — without recreating the shared 
`PoolingHttpClientConnectionManager`.
   
   ## Root Cause
   
   `HttpComponent` holds authentication configuration (via `HttpConfiguration`, 
`proxyAuthUsername`/`proxyAuthPassword`, and related fields) that is resolved 
from property placeholders once at startup. When a vault component detects a 
rotated secret and triggers a context reload, `DefaultContextReloadStrategy` 
re-applies the component options (so the new password reaches 
`httpConfiguration.authPassword`, etc.) and then calls `onSecretRotation()` on 
every `SecretRotationAware` component — but `HttpComponent` did not implement 
the SPI, so the callback was never fired.
   
   ## Fix
   
   Implement `SecretRotationAware` on `HttpComponent`. The `onSecretRotation()` 
method:
   
   1. Logs the rotation event.
   2. Does nothing else — the framework's `reloadAllRoutes()` (which fires 
immediately after) removes all routes, **clears the endpoint registry**, and 
restarts the route definitions. Because the component's auth fields were 
already updated before the callback, the fresh endpoints built during route 
restart pick up the new credentials via the existing 
`configureBasicAuthentication()` / `configureHttpProxy()` path.
   
   The shared `PoolingHttpClientConnectionManager` is left untouched. 
`HttpEndpoint.createHttpClient()` already marks the connection manager as 
shared (via `setConnectionManagerShared(true)`) when it belongs to the 
component, so the pool drains gracefully rather than being shut down abruptly.
   
   ## Test
   
   `HttpComponentSecretRotationAwareTest` covers:
   
   - `httpComponentImplementsSecretRotationAware` — asserts the class 
implements the SPI.
   - `onSecretRotationDoesNotThrow` — asserts the callback completes cleanly 
(including with a `null` source).
   - `credentialsArePickedUpAfterRotationAndRouteRestart` — end-to-end: 
configures basic-auth credentials on the component, verifies requests succeed, 
rotates the secret (mutates `HttpConfiguration` + updates the test server 
expectation), calls `onSecretRotation()`, simulates `reloadAllRoutes()` (clear 
endpoint registry + re-add route), and asserts that the restarted route 
authenticates successfully with the new credentials.
   
   ---
   _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


-- 
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