This is an automated email from the ASF dual-hosted git repository.

oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git


The following commit(s) were added to refs/heads/main by this push:
     new c93cc78e4 Fix #3257: rest-openapi-sink, ogcapi-features-action and 
azure-functions-sink do not send the Authorization header of the incoming 
message, and take login options (#3258)
c93cc78e4 is described below

commit c93cc78e469ad2e6437f4470e9021fe948660c60
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Nov 19 13:27:49 2026 +0100

    Fix #3257: rest-openapi-sink, ogcapi-features-action and 
azure-functions-sink do not send the Authorization header of the incoming 
message, and take login options (#3258)
    
    All three remove Authorization and Proxy-Authorization from the incoming
    message first, as http-sink does; azure-functions-sink also removes an
    incoming x-functions-key. ogcapi-features-action takes the login options
    of http-sink. rest-openapi-sink takes authUsername and authPassword
    (Basic login after a 401) and authBearerToken, which it sends itself and
    removes from the message after the call; the other login options do not
    work through rest-openapi yet (CAMEL-27234).
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 kamelets/azure-functions-sink.kamelet.yaml         |  8 ++-
 kamelets/ogcapi-features-action.kamelet.yaml       | 73 ++++++++++++++++++-
 kamelets/rest-openapi-sink.kamelet.yaml            | 80 ++++++++++++++++++---
 .../kamelets/catalog/HttpKameletsTargetTest.java   | 83 ++++++++++++++++++++--
 .../main/resources/META-INF/kamelets-index.json    |  6 +-
 .../kamelets/azure-functions-sink.kamelet.yaml     |  8 ++-
 .../kamelets/ogcapi-features-action.kamelet.yaml   | 73 ++++++++++++++++++-
 .../kamelets/rest-openapi-sink.kamelet.yaml        | 80 ++++++++++++++++++---
 8 files changed, 375 insertions(+), 36 deletions(-)

diff --git a/kamelets/azure-functions-sink.kamelet.yaml 
b/kamelets/azure-functions-sink.kamelet.yaml
index 9a4a39610..3f5749c61 100644
--- a/kamelets/azure-functions-sink.kamelet.yaml
+++ b/kamelets/azure-functions-sink.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
 
       Output: when it is used inside a route, the body afterwards is the 
response of the function, and the `CamelHttpResponseCode` header its status 
code.
 
-      Good to know: a response with a status code outside 200 to 299 fails the 
message. The `key` is sent in the `x-functions-key` header, not in the address 
of the request, so error messages and access logs do not show it. The header is 
removed from the message after the call, also when the call fails. Headers that 
start with `CamelHttp` or `CamelRestHttp` are removed from the message first, 
so they cannot change what the Kamelet does.
+      Good to know: a response with a status code outside 200 to 299 fails the 
message. The `key` is sent in the `x-functions-key` header, not in the address 
of the request, so error messages and access logs do not show it. The header is 
removed from the message after the call, also when the call fails. An 
`x-functions-key`, `Authorization` or `Proxy-Authorization` header on the 
incoming message is removed first, so a credential that came with the message 
is not sent on. Headers that sta [...]
     required:
       - url
     type: object
@@ -72,6 +72,12 @@ spec:
       steps:
         - removeHeaders:
             pattern: "Camel(Rest)?Http.*"
+        - removeHeader:
+            name: Authorization
+        - removeHeader:
+            name: Proxy-Authorization
+        - removeHeader:
+            name: x-functions-key
         - setHeader:
             name: CamelHttpMethod
             expression:
diff --git a/kamelets/ogcapi-features-action.kamelet.yaml 
b/kamelets/ogcapi-features-action.kamelet.yaml
index b51b134e6..d6d038e52 100644
--- a/kamelets/ogcapi-features-action.kamelet.yaml
+++ b/kamelets/ogcapi-features-action.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
 
       Output: the body is a GeoJSON feature collection, as JSON text, with at 
most `limit` features. The headers of the HTTP response, such as 
`Content-Type`, are set as headers.
 
-      Good to know: `split` does not change what the next step receives: it 
still gets the whole collection, once per message. An HTTP error from the 
server, such as an unknown collection, fails the message. Headers that start 
with `CamelHttp` or `CamelRestHttp` are removed from the message first, so they 
cannot change what the Kamelet does. A service that cannot be reached within 
`connectTimeout`, or does not answer within `responseTimeout`, fails the 
message; when they are not set, it  [...]
+      Good to know: `split` does not change what the next step receives: it 
still gets the whole collection, once per message. An HTTP error from the 
server, such as an unknown collection, fails the message. Headers that start 
with `CamelHttp` or `CamelRestHttp` are removed from the message first, so they 
cannot change what the Kamelet does. The login comes only from the options: an 
`Authorization` or `Proxy-Authorization` header on the message is removed, so a 
credential that came with  [...]
     required:
       - url
       - collection
@@ -88,6 +88,64 @@ spec:
         description: How long to wait for the answer of the service once the 
request is sent, in milliseconds. When it is not set, it is 180000 (3 minutes). 
A service that does not answer in time fails the message.
         type: integer
         example: 30000
+      authMethod:
+        title: Authentication Method
+        description: The login method, `Basic`, `Digest`, `NTLM`, or `Bearer` 
to send `authBearerToken`. Basic and Digest login with `authUsername` and 
`authPassword` work without it.
+        type: string
+        example: Basic
+      authenticationPreemptive:
+        title: Authentication Preemptive
+        description: If true, `authUsername` and `authPassword` are sent with 
Basic login, or `authBearerToken` as a Bearer token, on the first request. If 
false, they are sent only after the service answers 401 and asks for them, 
which takes a second request.
+        type: boolean
+        default: false
+      authUsername:
+        title: Authentication Username
+        description: The user to log in as, together with `authPassword`.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      authPassword:
+        title: Authentication Password
+        description: The password of `authUsername`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      authBearerToken:
+        title: Bearer Token
+        description: A static token, such as an API key, sent in the 
`Authorization` header as `Bearer` followed by the token. Set `authMethod` to 
`Bearer` with it. Also set `authenticationPreemptive` to true, unless the 
service first answers 401 with a `WWW-Authenticate` header that asks for a 
Bearer token.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      oauth2ClientId:
+        title: OAuth2 Client ID
+        description: The client ID of the application, as registered with the 
OAuth 2.0 provider. With `oauth2ClientSecret`, it is used to get a token from 
`oauth2TokenEndpoint` (client credentials grant).
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      oauth2ClientSecret:
+        title: OAuth2 Client Secret
+        description: The client secret of the application, as given by the 
OAuth 2.0 provider.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      oauth2TokenEndpoint:
+        title: OAuth2 Token URL
+        description: The URL to get the tokens from, as given by the OAuth 2.0 
provider. The Kamelet logs in to it with `oauth2ClientId` and 
`oauth2ClientSecret`.
+        type: string
+        example: https://login.example.com/oauth2/token
+        x-descriptors:
+        - urn:camel:group:credentials
+      oauth2Scope:
+        title: OAuth2 Scope
+        description: The scope to ask for in the token request, when the OAuth 
2.0 provider needs one.
+        type: string
+        example: orders.write
+        x-descriptors:
+        - urn:camel:group:credentials
   types:
     in:
       mediaType: text/plain
@@ -104,6 +162,10 @@ spec:
       steps:
         - removeHeaders:
             pattern: "Camel(Rest)?Http.*"
+        - removeHeader:
+            name: Authorization
+        - removeHeader:
+            name: Proxy-Authorization
         - setHeader:
             name: Accept
             expression:
@@ -122,6 +184,15 @@ spec:
             parameters:
               connectTimeout: "{{?connectTimeout}}"
               responseTimeout: "{{?responseTimeout}}"
+              authMethod: "{{?authMethod}}"
+              authUsername: "{{?authUsername}}"
+              authPassword: "RAW({{?authPassword}})"
+              authBearerToken: "RAW({{?authBearerToken}})"
+              authenticationPreemptive: "{{authenticationPreemptive}}"
+              oauth2ClientId: "RAW({{?oauth2ClientId}})"
+              oauth2ClientSecret: "RAW({{?oauth2ClientSecret}})"
+              oauth2TokenEndpoint: "{{?oauth2TokenEndpoint}}"
+              oauth2Scope: "{{?oauth2Scope}}"
         - removeHeader:
             name: Accept
         - removeHeader:
diff --git a/kamelets/rest-openapi-sink.kamelet.yaml 
b/kamelets/rest-openapi-sink.kamelet.yaml
index 5fc7bd91a..58423cf15 100644
--- a/kamelets/rest-openapi-sink.kamelet.yaml
+++ b/kamelets/rest-openapi-sink.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
 
       Output: when it is used inside a route, the body afterwards is the 
response of the API, as bytes, with the headers of the response and its status 
code in `CamelHttpResponseCode`.
 
-      Good to know: a missing path parameter is not an error; the request is 
sent with `\{petId}` in the path, unless `clientRequestValidation` is true. The 
address of the API is taken from the `servers` of the specification, unless 
`host` or `basePath` is set. The Kamelet has no login options. The Kamelet does 
not start when the specification has no operation with the ID in `operation`. 
Headers that start with `CamelHttp` or `CamelRestHttp` are removed from the 
message first, so they ca [...]
+      Good to know: a missing path parameter is not an error; the request is 
sent with `\{petId}` in the path, unless `clientRequestValidation` is true. The 
address of the API is taken from the `servers` of the specification, unless 
`host` or `basePath` is set. The login comes only from the options: an 
`Authorization` or `Proxy-Authorization` header on the message is removed, so a 
credential that came with the message is not sent on. Log in either with 
`authUsername` and `authPassword`,  [...]
     required:
     - specification
     - operation
@@ -83,6 +83,26 @@ spec:
         type: string
         example: "application/merge-patch+json"
         pattern: "^[A-Za-z0-9*][A-Za-z0-9!$^_.+*/=;,-]*$"
+      authUsername:
+        title: Authentication Username
+        description: The user to log in as with Basic login, together with 
`authPassword`. They are sent only after the service answers 401 and asks for 
them, which takes a second request.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      authPassword:
+        title: Authentication Password
+        description: The password of `authUsername`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      authBearerToken:
+        title: Bearer Token
+        description: A static token, such as an API key, sent on every request 
in the `Authorization` header as `Bearer` followed by the token. The header is 
removed from the message after the call.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
   dependencies:
   - "camel:rest-openapi"
   - "camel:http"
@@ -93,13 +113,51 @@ spec:
       steps:
         - removeHeaders:
             pattern: "Camel(Rest)?Http.*"
-        - to:
-            uri: rest-openapi
-            parameters:
-              specificationUri: "{{specification}}"
-              operationId: "{{operation}}"
-              basePath: "{{?basePath}}"
-              requestValidationEnabled: "{{clientRequestValidation}}"
-              host: "{{?host}}"
-              consumes: "RAW({{?consumes}})"
-              produces: "RAW({{?produces}})"
+        - removeHeader:
+            name: Authorization
+        - removeHeader:
+            name: Proxy-Authorization
+        - choice:
+            precondition: true
+            when:
+              - expression:
+                  simple:
+                    expression: "${propertiesExist:authBearerToken}"
+                steps:
+                  - setHeader:
+                      name: Authorization
+                      expression:
+                        constant:
+                          expression: "Bearer {{authBearerToken}}"
+                  - doTry:
+                      steps:
+                        - to:
+                            uri: rest-openapi
+                            parameters:
+                              specificationUri: "{{specification}}"
+                              operationId: "{{operation}}"
+                              basePath: "{{?basePath}}"
+                              requestValidationEnabled: 
"{{clientRequestValidation}}"
+                              host: "{{?host}}"
+                              consumes: "RAW({{?consumes}})"
+                              produces: "RAW({{?produces}})"
+                              authUsername: "{{?authUsername}}"
+                              authPassword: "RAW({{?authPassword}})"
+                      doFinally:
+                        steps:
+                          - removeHeader:
+                              name: Authorization
+            otherwise:
+              steps:
+                - to:
+                    uri: rest-openapi
+                    parameters:
+                      specificationUri: "{{specification}}"
+                      operationId: "{{operation}}"
+                      basePath: "{{?basePath}}"
+                      requestValidationEnabled: "{{clientRequestValidation}}"
+                      host: "{{?host}}"
+                      consumes: "RAW({{?consumes}})"
+                      produces: "RAW({{?produces}})"
+                      authUsername: "{{?authUsername}}"
+                      authPassword: "RAW({{?authPassword}})"
diff --git 
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/HttpKameletsTargetTest.java
 
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/HttpKameletsTargetTest.java
index c50e4fb8a..9e24b699e 100644
--- 
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/HttpKameletsTargetTest.java
+++ 
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/HttpKameletsTargetTest.java
@@ -21,6 +21,7 @@ import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Path;
+import java.util.Base64;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.BlockingQueue;
@@ -53,12 +54,19 @@ public class HttpKameletsTargetTest {
     private static final Path KAMELETS = Path.of("../../kamelets");
     private static final Path SPEC = 
Path.of("src/test/resources/remove-headers/orders-openapi.yaml");
     private static final String KEY = "secret-key";
+    private static final String TOKEN = "kamelet-token";
+    // the credentials of the caller, on the incoming message, must not be 
sent on
+    private static final String CALLER_AUTHORIZATION = "Bearer caller-token";
+    private static final String CALLER_PROXY_AUTHORIZATION = "Basic 
Y2FsbGVyOnByb3h5";
+    private static final String CALLER_KEY = "caller-key";
 
     private final BlockingQueue<String> configured = new 
LinkedBlockingQueue<>();
     private final BlockingQueue<String> other = new LinkedBlockingQueue<>();
     private HttpServer configuredServer;
     private HttpServer otherServer;
     private int status = 200;
+    // when true, a request without an Authorization header gets 401 with a 
Basic challenge
+    private boolean challenge;
     private CamelContext context;
 
     @BeforeEach
@@ -85,7 +93,7 @@ public class HttpKameletsTargetTest {
         send("kamelet:rest-openapi-sink?specification=file:" + 
SPEC.toAbsolutePath()
              + "&operation=listOrders&host=" + url(configuredServer), "");
 
-        assertEquals("GET /api/orders query=null key=null", configured.poll());
+        assertEquals("GET /api/orders query=null key=null auth=null 
proxy=null", configured.poll());
         assertTrue(other.isEmpty(), "no request goes to the other server");
     }
 
@@ -93,7 +101,7 @@ public class HttpKameletsTargetTest {
     void ogcApiFeaturesActionCallsTheConfiguredService() throws Exception {
         send("kamelet:ogcapi-features-action?url=" + url(configuredServer) + 
"&collection=lakes&limit=1", "");
 
-        assertEquals("GET /collections/lakes/items 
query=limit=1&bbox=-180,-90,180,90&& key=null", configured.poll());
+        assertEquals("GET /collections/lakes/items 
query=limit=1&bbox=-180,-90,180,90&& key=null auth=null proxy=null", 
configured.poll());
         assertTrue(other.isEmpty(), "no request goes to the other server");
     }
 
@@ -101,7 +109,7 @@ public class HttpKameletsTargetTest {
     void azureFunctionsSinkCallsTheConfiguredFunctionWithTheKeyInAHeader() 
throws Exception {
         Exchange result = send("kamelet:azure-functions-sink?url=" + 
url(configuredServer) + "/api/hello&key=" + KEY, "hello");
 
-        assertEquals("POST /api/hello query=null key=" + KEY, 
configured.poll());
+        assertEquals("POST /api/hello query=null key=" + KEY + " auth=null 
proxy=null", configured.poll());
         assertTrue(other.isEmpty(), "no request goes to the other server");
         
assertFalse(result.getMessage().getHeaders().containsKey("x-functions-key"), 
"the key does not go on");
     }
@@ -110,7 +118,7 @@ public class HttpKameletsTargetTest {
     void azureFunctionsSinkCallsAnAnonymousFunctionWithoutAKey() throws 
Exception {
         send("kamelet:azure-functions-sink?url=" + url(configuredServer) + 
"/api/hello", "hello");
 
-        assertEquals("POST /api/hello query=null key=null", configured.poll());
+        assertEquals("POST /api/hello query=null key=null auth=null 
proxy=null", configured.poll());
         assertTrue(other.isEmpty(), "no request goes to the other server");
     }
 
@@ -123,12 +131,59 @@ public class HttpKameletsTargetTest {
                                            + "/api/missing&key=" + KEY,
                 exchange -> exchange.getMessage().setBody("hello"));
 
-        assertEquals("POST /api/missing query=null key=" + KEY, 
configured.poll());
+        assertEquals("POST /api/missing query=null key=" + KEY + " auth=null 
proxy=null", configured.poll());
         assertNotNull(result.getException(), "a 404 fails the message");
         assertFalse(result.getException().getMessage().contains(KEY), 
result.getException().getMessage());
         
assertFalse(result.getMessage().getHeaders().containsKey("x-functions-key"), 
"the key does not go on");
     }
 
+    @Test
+    void restOpenApiSinkSendsTheBearerTokenOfTheOptions() throws Exception {
+        Exchange result = send("kamelet:rest-openapi-sink?specification=file:" 
+ SPEC.toAbsolutePath()
+                               + "&operation=listOrders&host=" + 
url(configuredServer) + "&authBearerToken=" + TOKEN, "");
+
+        assertEquals("GET /api/orders query=null key=null auth=Bearer " + 
TOKEN + " proxy=null", configured.poll());
+        
assertFalse(result.getMessage().getHeaders().containsKey("Authorization"), "the 
token does not go on");
+    }
+
+    @Test
+    void restOpenApiSinkLogsInWithBasicWhenTheServiceAsks() throws Exception {
+        challenge = true;
+        // RAW keeps & and + of the password as they are
+        send("kamelet:rest-openapi-sink?specification=file:" + 
SPEC.toAbsolutePath()
+             + "&operation=listOrders&host=" + url(configuredServer)
+             + "&authUsername=ann&authPassword=RAW(p&ss+word)", "");
+
+        assertEquals("GET /api/orders query=null key=null auth=null 
proxy=null", configured.poll());
+        assertEquals("GET /api/orders query=null key=null auth=" + 
basic("ann", "p&ss+word") + " proxy=null",
+                configured.poll());
+    }
+
+    @Test
+    void ogcApiFeaturesActionSendsTheBearerTokenOfTheOptions() throws 
Exception {
+        send("kamelet:ogcapi-features-action?url=" + url(configuredServer) + 
"&collection=lakes&limit=1"
+             + "&authMethod=Bearer&authBearerToken=" + TOKEN + 
"&authenticationPreemptive=true", "");
+
+        assertEquals("GET /collections/lakes/items 
query=limit=1&bbox=-180,-90,180,90&& key=null auth=Bearer " + TOKEN
+                     + " proxy=null", configured.poll());
+    }
+
+    @Test
+    void ogcApiFeaturesActionLogsInWithBasicWhenTheServiceAsks() throws 
Exception {
+        challenge = true;
+        send("kamelet:ogcapi-features-action?url=" + url(configuredServer) + 
"&collection=lakes&limit=1"
+             + "&authUsername=ann&authPassword=RAW(p&ss+word)", "");
+
+        assertEquals("GET /collections/lakes/items 
query=limit=1&bbox=-180,-90,180,90&& key=null auth=null proxy=null",
+                configured.poll());
+        assertEquals("GET /collections/lakes/items 
query=limit=1&bbox=-180,-90,180,90&& key=null auth="
+                     + basic("ann", "p&ss+word") + " proxy=null", 
configured.poll());
+    }
+
+    private static String basic(String user, String password) {
+        return "Basic " + Base64.getEncoder().encodeToString((user + ":" + 
password).getBytes(StandardCharsets.UTF_8));
+    }
+
     /**
      * Sends a message with the headers that, when the Kamelet keeps them, 
send the request to another server, path,
      * query or method.
@@ -142,6 +197,12 @@ public class HttpKameletsTargetTest {
         headers.put("CamelHttpMethod", "DELETE");
         headers.put("CamelRestHttpUri", url(otherServer) + "/other-rest-uri");
         headers.put("CamelRestHttpQuery", "other=rest-query");
+        headers.put("Authorization", CALLER_AUTHORIZATION);
+        headers.put("Proxy-Authorization", CALLER_PROXY_AUTHORIZATION);
+        if (uri.startsWith("kamelet:azure-functions-sink")) {
+            // a header of the Azure Functions login, which only that Kamelet 
removes
+            headers.put("x-functions-key", CALLER_KEY);
+        }
 
         ProducerTemplate template = context.createProducerTemplate();
         Exchange result = template.request(uri, exchange -> {
@@ -159,7 +220,7 @@ public class HttpKameletsTargetTest {
     }
 
     /**
-     * Starts a server that records each request as "METHOD /path query=... 
key=..." and answers with an empty GeoJSON
+     * Starts a server that records each request as "METHOD /path query=... 
key=... auth=... proxy=..." and answers with an empty GeoJSON
      * feature collection.
      */
     private HttpServer startServer(BlockingQueue<String> requests) throws 
IOException {
@@ -167,8 +228,16 @@ public class HttpKameletsTargetTest {
         server.createContext("/", (HttpExchange http) -> {
             requests.add(http.getRequestMethod() + " " + 
http.getRequestURI().getPath()
                          + " query=" + http.getRequestURI().getRawQuery()
-                         + " key=" + 
http.getRequestHeaders().getFirst("x-functions-key"));
+                         + " key=" + 
http.getRequestHeaders().getFirst("x-functions-key")
+                         + " auth=" + 
http.getRequestHeaders().getFirst("Authorization")
+                         + " proxy=" + 
http.getRequestHeaders().getFirst("Proxy-Authorization"));
             http.getRequestBody().readAllBytes();
+            if (challenge && 
http.getRequestHeaders().getFirst("Authorization") == null) {
+                http.getResponseHeaders().add("WWW-Authenticate", "Basic 
realm=\"orders\"");
+                http.sendResponseHeaders(401, -1);
+                http.close();
+                return;
+            }
             byte[] answer = 
"{\"type\":\"FeatureCollection\",\"features\":[]}".getBytes(StandardCharsets.UTF_8);
             http.getResponseHeaders().add("Content-Type", "application/json");
             http.sendResponseHeaders(status, answer.length);
diff --git 
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json 
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 36a54fb20..97bbca733 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -375,7 +375,7 @@
     "supportLevel" : "Stable",
     "title" : "Azure Function Sink",
     "summary" : "Calls a function in Azure Functions over HTTP for each 
message, with the message as the body of the request.",
-    "description" : "Calls a function in Azure Functions over HTTP for each 
message, with the message as the body of the request.\n\nUse it to run your own 
serverless code on each message, such as an enrichment, a notification or a 
calculation. For any other web service, use `http-sink`.\n\nInput: the body is 
sent as the request body, as text, bytes or a stream. Turn structured data such 
as a Map into JSON text first, for example with `json-serialize-action`. The 
`Content-Type` header is [...]
+    "description" : "Calls a function in Azure Functions over HTTP for each 
message, with the message as the body of the request.\n\nUse it to run your own 
serverless code on each message, such as an enrichment, a notification or a 
calculation. For any other web service, use `http-sink`.\n\nInput: the body is 
sent as the request body, as text, bytes or a stream. Turn structured data such 
as a Map into JSON text first, for example with `json-serialize-action`. The 
`Content-Type` header is [...]
     "group" : "Azure Functions",
     "namespace" : "Azure",
     "provider" : "Apache Software Foundation"
@@ -1625,7 +1625,7 @@
     "supportLevel" : "Stable",
     "title" : "OGC Api Feature Get Item Action",
     "summary" : "Fetches the features of one collection, such as the lakes or 
the buildings of an area, from a server that implements the OGC API Features 
standard, and gives them as GeoJSON.",
-    "description" : "Fetches the features of one collection, such as the lakes 
or the buildings of an area, from a server that implements the OGC API Features 
standard, and gives them as GeoJSON.\n\nUse it to bring map data from a 
geographic data service into a flow, for example to load the features of an 
area into a database or to check them against a list of places.\n\nInput: the 
body, when it is not empty, is added to the query of the request, as text such 
as `name=Lake Baikal`, so ea [...]
+    "description" : "Fetches the features of one collection, such as the lakes 
or the buildings of an area, from a server that implements the OGC API Features 
standard, and gives them as GeoJSON.\n\nUse it to bring map data from a 
geographic data service into a flow, for example to load the features of an 
area into a database or to check them against a list of places.\n\nInput: the 
body, when it is not empty, is added to the query of the request, as text such 
as `name=Lake Baikal`, so ea [...]
     "group" : "Geospatial",
     "namespace" : "Geo",
     "provider" : "Apache Software Foundation"
@@ -1815,7 +1815,7 @@
     "supportLevel" : "Stable",
     "title" : "REST OpenAPI Sink",
     "summary" : "Calls one operation of a REST API for each message, building 
the request (method, path, parameters and content type) from the OpenAPI 
specification of the API.",
-    "description" : "Calls one operation of a REST API for each message, 
building the request (method, path, parameters and content type) from the 
OpenAPI specification of the API.\n\nUse it to call an API that publishes an 
OpenAPI (Swagger) document without writing its URLs by hand, for example to 
create a customer or look up an order in a service of your company. For a call 
to a fixed URL, use `http-sink`.\n\nInput: the body is the request body, such 
as JSON text, and is sent with the  [...]
+    "description" : "Calls one operation of a REST API for each message, 
building the request (method, path, parameters and content type) from the 
OpenAPI specification of the API.\n\nUse it to call an API that publishes an 
OpenAPI (Swagger) document without writing its URLs by hand, for example to 
create a customer or look up an order in a service of your company. For a call 
to a fixed URL, use `http-sink`.\n\nInput: the body is the request body, such 
as JSON text, and is sent with the  [...]
     "group" : "HTTP",
     "namespace" : "HTTP",
     "provider" : "Apache Software Foundation"
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/azure-functions-sink.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/azure-functions-sink.kamelet.yaml
index 9a4a39610..3f5749c61 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/azure-functions-sink.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/azure-functions-sink.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
 
       Output: when it is used inside a route, the body afterwards is the 
response of the function, and the `CamelHttpResponseCode` header its status 
code.
 
-      Good to know: a response with a status code outside 200 to 299 fails the 
message. The `key` is sent in the `x-functions-key` header, not in the address 
of the request, so error messages and access logs do not show it. The header is 
removed from the message after the call, also when the call fails. Headers that 
start with `CamelHttp` or `CamelRestHttp` are removed from the message first, 
so they cannot change what the Kamelet does.
+      Good to know: a response with a status code outside 200 to 299 fails the 
message. The `key` is sent in the `x-functions-key` header, not in the address 
of the request, so error messages and access logs do not show it. The header is 
removed from the message after the call, also when the call fails. An 
`x-functions-key`, `Authorization` or `Proxy-Authorization` header on the 
incoming message is removed first, so a credential that came with the message 
is not sent on. Headers that sta [...]
     required:
       - url
     type: object
@@ -72,6 +72,12 @@ spec:
       steps:
         - removeHeaders:
             pattern: "Camel(Rest)?Http.*"
+        - removeHeader:
+            name: Authorization
+        - removeHeader:
+            name: Proxy-Authorization
+        - removeHeader:
+            name: x-functions-key
         - setHeader:
             name: CamelHttpMethod
             expression:
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/ogcapi-features-action.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/ogcapi-features-action.kamelet.yaml
index b51b134e6..d6d038e52 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/ogcapi-features-action.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/ogcapi-features-action.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
 
       Output: the body is a GeoJSON feature collection, as JSON text, with at 
most `limit` features. The headers of the HTTP response, such as 
`Content-Type`, are set as headers.
 
-      Good to know: `split` does not change what the next step receives: it 
still gets the whole collection, once per message. An HTTP error from the 
server, such as an unknown collection, fails the message. Headers that start 
with `CamelHttp` or `CamelRestHttp` are removed from the message first, so they 
cannot change what the Kamelet does. A service that cannot be reached within 
`connectTimeout`, or does not answer within `responseTimeout`, fails the 
message; when they are not set, it  [...]
+      Good to know: `split` does not change what the next step receives: it 
still gets the whole collection, once per message. An HTTP error from the 
server, such as an unknown collection, fails the message. Headers that start 
with `CamelHttp` or `CamelRestHttp` are removed from the message first, so they 
cannot change what the Kamelet does. The login comes only from the options: an 
`Authorization` or `Proxy-Authorization` header on the message is removed, so a 
credential that came with  [...]
     required:
       - url
       - collection
@@ -88,6 +88,64 @@ spec:
         description: How long to wait for the answer of the service once the 
request is sent, in milliseconds. When it is not set, it is 180000 (3 minutes). 
A service that does not answer in time fails the message.
         type: integer
         example: 30000
+      authMethod:
+        title: Authentication Method
+        description: The login method, `Basic`, `Digest`, `NTLM`, or `Bearer` 
to send `authBearerToken`. Basic and Digest login with `authUsername` and 
`authPassword` work without it.
+        type: string
+        example: Basic
+      authenticationPreemptive:
+        title: Authentication Preemptive
+        description: If true, `authUsername` and `authPassword` are sent with 
Basic login, or `authBearerToken` as a Bearer token, on the first request. If 
false, they are sent only after the service answers 401 and asks for them, 
which takes a second request.
+        type: boolean
+        default: false
+      authUsername:
+        title: Authentication Username
+        description: The user to log in as, together with `authPassword`.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      authPassword:
+        title: Authentication Password
+        description: The password of `authUsername`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      authBearerToken:
+        title: Bearer Token
+        description: A static token, such as an API key, sent in the 
`Authorization` header as `Bearer` followed by the token. Set `authMethod` to 
`Bearer` with it. Also set `authenticationPreemptive` to true, unless the 
service first answers 401 with a `WWW-Authenticate` header that asks for a 
Bearer token.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      oauth2ClientId:
+        title: OAuth2 Client ID
+        description: The client ID of the application, as registered with the 
OAuth 2.0 provider. With `oauth2ClientSecret`, it is used to get a token from 
`oauth2TokenEndpoint` (client credentials grant).
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      oauth2ClientSecret:
+        title: OAuth2 Client Secret
+        description: The client secret of the application, as given by the 
OAuth 2.0 provider.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      oauth2TokenEndpoint:
+        title: OAuth2 Token URL
+        description: The URL to get the tokens from, as given by the OAuth 2.0 
provider. The Kamelet logs in to it with `oauth2ClientId` and 
`oauth2ClientSecret`.
+        type: string
+        example: https://login.example.com/oauth2/token
+        x-descriptors:
+        - urn:camel:group:credentials
+      oauth2Scope:
+        title: OAuth2 Scope
+        description: The scope to ask for in the token request, when the OAuth 
2.0 provider needs one.
+        type: string
+        example: orders.write
+        x-descriptors:
+        - urn:camel:group:credentials
   types:
     in:
       mediaType: text/plain
@@ -104,6 +162,10 @@ spec:
       steps:
         - removeHeaders:
             pattern: "Camel(Rest)?Http.*"
+        - removeHeader:
+            name: Authorization
+        - removeHeader:
+            name: Proxy-Authorization
         - setHeader:
             name: Accept
             expression:
@@ -122,6 +184,15 @@ spec:
             parameters:
               connectTimeout: "{{?connectTimeout}}"
               responseTimeout: "{{?responseTimeout}}"
+              authMethod: "{{?authMethod}}"
+              authUsername: "{{?authUsername}}"
+              authPassword: "RAW({{?authPassword}})"
+              authBearerToken: "RAW({{?authBearerToken}})"
+              authenticationPreemptive: "{{authenticationPreemptive}}"
+              oauth2ClientId: "RAW({{?oauth2ClientId}})"
+              oauth2ClientSecret: "RAW({{?oauth2ClientSecret}})"
+              oauth2TokenEndpoint: "{{?oauth2TokenEndpoint}}"
+              oauth2Scope: "{{?oauth2Scope}}"
         - removeHeader:
             name: Accept
         - removeHeader:
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/rest-openapi-sink.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/rest-openapi-sink.kamelet.yaml
index 5fc7bd91a..58423cf15 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/rest-openapi-sink.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/rest-openapi-sink.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
 
       Output: when it is used inside a route, the body afterwards is the 
response of the API, as bytes, with the headers of the response and its status 
code in `CamelHttpResponseCode`.
 
-      Good to know: a missing path parameter is not an error; the request is 
sent with `\{petId}` in the path, unless `clientRequestValidation` is true. The 
address of the API is taken from the `servers` of the specification, unless 
`host` or `basePath` is set. The Kamelet has no login options. The Kamelet does 
not start when the specification has no operation with the ID in `operation`. 
Headers that start with `CamelHttp` or `CamelRestHttp` are removed from the 
message first, so they ca [...]
+      Good to know: a missing path parameter is not an error; the request is 
sent with `\{petId}` in the path, unless `clientRequestValidation` is true. The 
address of the API is taken from the `servers` of the specification, unless 
`host` or `basePath` is set. The login comes only from the options: an 
`Authorization` or `Proxy-Authorization` header on the message is removed, so a 
credential that came with the message is not sent on. Log in either with 
`authUsername` and `authPassword`,  [...]
     required:
     - specification
     - operation
@@ -83,6 +83,26 @@ spec:
         type: string
         example: "application/merge-patch+json"
         pattern: "^[A-Za-z0-9*][A-Za-z0-9!$^_.+*/=;,-]*$"
+      authUsername:
+        title: Authentication Username
+        description: The user to log in as with Basic login, together with 
`authPassword`. They are sent only after the service answers 401 and asks for 
them, which takes a second request.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      authPassword:
+        title: Authentication Password
+        description: The password of `authUsername`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      authBearerToken:
+        title: Bearer Token
+        description: A static token, such as an API key, sent on every request 
in the `Authorization` header as `Bearer` followed by the token. The header is 
removed from the message after the call.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
   dependencies:
   - "camel:rest-openapi"
   - "camel:http"
@@ -93,13 +113,51 @@ spec:
       steps:
         - removeHeaders:
             pattern: "Camel(Rest)?Http.*"
-        - to:
-            uri: rest-openapi
-            parameters:
-              specificationUri: "{{specification}}"
-              operationId: "{{operation}}"
-              basePath: "{{?basePath}}"
-              requestValidationEnabled: "{{clientRequestValidation}}"
-              host: "{{?host}}"
-              consumes: "RAW({{?consumes}})"
-              produces: "RAW({{?produces}})"
+        - removeHeader:
+            name: Authorization
+        - removeHeader:
+            name: Proxy-Authorization
+        - choice:
+            precondition: true
+            when:
+              - expression:
+                  simple:
+                    expression: "${propertiesExist:authBearerToken}"
+                steps:
+                  - setHeader:
+                      name: Authorization
+                      expression:
+                        constant:
+                          expression: "Bearer {{authBearerToken}}"
+                  - doTry:
+                      steps:
+                        - to:
+                            uri: rest-openapi
+                            parameters:
+                              specificationUri: "{{specification}}"
+                              operationId: "{{operation}}"
+                              basePath: "{{?basePath}}"
+                              requestValidationEnabled: 
"{{clientRequestValidation}}"
+                              host: "{{?host}}"
+                              consumes: "RAW({{?consumes}})"
+                              produces: "RAW({{?produces}})"
+                              authUsername: "{{?authUsername}}"
+                              authPassword: "RAW({{?authPassword}})"
+                      doFinally:
+                        steps:
+                          - removeHeader:
+                              name: Authorization
+            otherwise:
+              steps:
+                - to:
+                    uri: rest-openapi
+                    parameters:
+                      specificationUri: "{{specification}}"
+                      operationId: "{{operation}}"
+                      basePath: "{{?basePath}}"
+                      requestValidationEnabled: "{{clientRequestValidation}}"
+                      host: "{{?host}}"
+                      consumes: "RAW({{?consumes}})"
+                      produces: "RAW({{?produces}})"
+                      authUsername: "{{?authUsername}}"
+                      authPassword: "RAW({{?authPassword}})"

Reply via email to