davsclaus opened a new pull request, #3258:
URL: https://github.com/apache/camel-kamelets/pull/3258

   Fixes #3257. It also covers the "authentication for `rest-openapi-sink` and 
`ogcapi-features-action`" item that #3170 left for later.
   
   Three Kamelets that send HTTP requests sent the `Authorization` and 
`Proxy-Authorization` headers of the incoming message on to the service, which 
#3245 stopped for `http-sink`. Behind `webhook-source`, for example, the 
caller's token went to the API.
   
   ### What changed
   | Kamelet | Incoming headers removed first | Login options |
   |---|---|---|
   | `rest-openapi-sink` | `Authorization`, `Proxy-Authorization` | new: 
`authUsername` and `authPassword` (Basic, sent after the service answers 401), 
and `authBearerToken` (sent as `Bearer` on every request; removed from the 
message after the call, also when it fails) |
   | `ogcapi-features-action` | `Authorization`, `Proxy-Authorization` | new: 
those of `http-sink`: `authMethod`, `authUsername`, `authPassword`, 
`authBearerToken`, `authenticationPreemptive`, `oauth2ClientId`, 
`oauth2ClientSecret`, `oauth2TokenEndpoint`, `oauth2Scope` |
   | `azure-functions-sink` | `Authorization`, `Proxy-Authorization`, 
`x-functions-key` | `key`, as before |
   
   Each description says where the login comes from, and that a credential on 
the message is not sent on. Secrets are `format: password` with the credentials 
descriptor and go in `RAW()`.
   
   **Why `rest-openapi-sink` sets the bearer header itself.** `rest-openapi` 
passes options it does not know on to the `http` endpoint, but of the login 
options only Basic after a 401 has an effect that way. Preemptive Basic, 
`authMethod: Bearer` and OAuth2 are dropped (checked with `camel run`), so the 
Kamelet sets `Authorization: Bearer …` itself, inside a `doTry` whose 
`doFinally` removes it. The rest is CAMEL-27234.
   
   **Found on the way:** with OAuth2, a token endpoint on the same host and 
port as the API makes the call fail with `Connection pool shut down`. That 
affects the OAuth2 options of `http-sink` and `http-source` too, and now 
`ogcapi-features-action`: CAMEL-27233.
   
   This changes behaviour: a flow that relied on the incoming `Authorization` 
reaching the service must use the options. I'll add the note to #3190 and 
apache/camel#30331 when it is merged.
   
   ### Tests
   `HttpKameletsTargetTest` now sends every message with a caller 
`Authorization` and `Proxy-Authorization` (and `x-functions-key` to the Azure 
Kamelet), and the local server records both headers:
   - the existing tests check that none of them reaches the server;
   - `rest-openapi-sink`: the `authBearerToken` arrives as `Bearer …` and is 
not on the message afterwards; with `authUsername`/`authPassword`, the first 
request gets 401 and the second carries Basic with a password containing `&` 
and `+`;
   - `ogcapi-features-action`: preemptive Bearer, and Basic after a 401, the 
same way.
   
   9 tests, 0 failures. `./mvnw clean install` passes and regenerated the 
library copy and the index.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 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