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

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


The following commit(s) were added to refs/heads/main by this push:
     new 35a0657eb398 CAMEL-27752: re-resolve OAuth token per request in 
camel-docling (#31106)
35a0657eb398 is described below

commit 35a0657eb398e27e5cd4ea4f40b4a16feb44b3ec
Author: Guillaume Nodet <[email protected]>
AuthorDate: Mon Nov 30 22:36:13 2026 +0100

    CAMEL-27752: re-resolve OAuth token per request in camel-docling (#31106)
    
    camel-docling resolves the OAuth token of oauthProfile on each request, 
through a token supplier in
    BearerTokenDoclingServeClient. Before, it resolved the token once at start, 
so every request failed with 401 once the
    token expired. camel-oauth caches the token until it expires. The startup 
log names the OAuth profile.
    camel-huggingface needs no change, as it only uses the token to download 
the model at start. The 4.25 upgrade guide
    notes that a failure of the identity provider now shows on the first 
request.
    
    Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet.
    
    Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
 .../apache/camel/catalog/docs/docling-serve.adoc   |  4 +-
 .../camel/catalog/docs/huggingface-component.adoc  |  4 +-
 .../camel-docling/src/main/docs/docling-serve.adoc |  4 +-
 .../docling/BearerTokenDoclingServeClient.java     | 13 +++--
 .../camel/component/docling/DoclingProducer.java   | 59 +++++++++++++++-------
 .../component/docling/DoclingProducerAuthTest.java | 34 +++++++++++++
 .../StubOAuthClientAuthenticationFactory.java      | 53 +++++++++++++++++++
 .../camel/oauth-client-authentication-factory      | 17 +++++++
 .../src/main/docs/huggingface-component.adoc       |  4 +-
 .../component/huggingface/HuggingFaceProducer.java |  6 +++
 .../ROOT/pages/camel-4x-upgrade-guide-4_25.adoc    | 17 +++++++
 11 files changed, 189 insertions(+), 26 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/docling-serve.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/docling-serve.adoc
index 09c631fd5119..19333b04dcd8 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/docling-serve.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/docling-serve.adoc
@@ -257,7 +257,9 @@ docling.serve.token=your-bearer-token-here
 
 === OAuth Authentication
 
-When the docling-serve instance is protected by an OAuth identity provider, 
set the `oauthProfile` parameter to acquire an access token via the OAuth 2.0 
Client Credentials grant. The token is used as the `authenticationToken` and 
the `authenticationScheme` is automatically set to `BEARER`. This requires 
`camel-oauth` on the classpath.
+When the docling-serve instance is protected by an OAuth identity provider, 
set the `oauthProfile` parameter to acquire an access token via the OAuth 2.0 
Client Credentials grant. The token is resolved from the camel-oauth cache on 
every outbound request so that short-lived tokens are refreshed automatically 
without restarting the route. No `authenticationScheme` or 
`authenticationToken` configuration is needed. This requires `camel-oauth` on 
the classpath.
+
+NOTE: Because the token is resolved per request, a misconfigured profile name, 
a missing `camel-oauth` dependency, or an unreachable identity provider will 
cause an exception on the first exchange rather than at route start.
 
 [source,properties]
 ----
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/huggingface-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/huggingface-component.adoc
index 0b7c3bcabd36..8adc7b398d1f 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/huggingface-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/huggingface-component.adoc
@@ -145,7 +145,9 @@ written to the log when the `ai.djl.python.engine` logger 
is at DEBUG. Keep that
 
 == OAuth Authentication
 
-When accessing private or gated models behind an OAuth-protected endpoint, set 
the `oauthProfile` parameter to acquire an access token via the OAuth 2.0 
Client Credentials grant. The token is used as the `authToken`. This requires 
`camel-oauth` on the classpath.
+When accessing private or gated models behind an OAuth-protected endpoint, set 
the `oauthProfile` parameter to acquire an access token via the OAuth 2.0 
Client Credentials grant. The token is used as the `authToken` at producer 
startup, before the DJL model loader runs. This requires `camel-oauth` on the 
classpath.
+
+NOTE: The token is only needed during model download at startup. Once the 
model is loaded, inference runs locally and no further calls to Hugging Face 
are made, so a token that expires after the route starts does not affect 
inference.
 
 [source,properties]
 ----
diff --git a/components/camel-ai/camel-docling/src/main/docs/docling-serve.adoc 
b/components/camel-ai/camel-docling/src/main/docs/docling-serve.adoc
index 09c631fd5119..19333b04dcd8 100644
--- a/components/camel-ai/camel-docling/src/main/docs/docling-serve.adoc
+++ b/components/camel-ai/camel-docling/src/main/docs/docling-serve.adoc
@@ -257,7 +257,9 @@ docling.serve.token=your-bearer-token-here
 
 === OAuth Authentication
 
-When the docling-serve instance is protected by an OAuth identity provider, 
set the `oauthProfile` parameter to acquire an access token via the OAuth 2.0 
Client Credentials grant. The token is used as the `authenticationToken` and 
the `authenticationScheme` is automatically set to `BEARER`. This requires 
`camel-oauth` on the classpath.
+When the docling-serve instance is protected by an OAuth identity provider, 
set the `oauthProfile` parameter to acquire an access token via the OAuth 2.0 
Client Credentials grant. The token is resolved from the camel-oauth cache on 
every outbound request so that short-lived tokens are refreshed automatically 
without restarting the route. No `authenticationScheme` or 
`authenticationToken` configuration is needed. This requires `camel-oauth` on 
the classpath.
+
+NOTE: Because the token is resolved per request, a misconfigured profile name, 
a missing `camel-oauth` dependency, or an unreachable identity provider will 
cause an exception on the first exchange rather than at route start.
 
 [source,properties]
 ----
diff --git 
a/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/BearerTokenDoclingServeClient.java
 
b/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/BearerTokenDoclingServeClient.java
index cad0d9d6e04e..5d1aa0cdf9fa 100644
--- 
a/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/BearerTokenDoclingServeClient.java
+++ 
b/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/BearerTokenDoclingServeClient.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.docling;
 
 import java.net.http.HttpRequest;
+import java.util.function.Supplier;
 
 import ai.docling.serve.api.DoclingServeApi;
 import ai.docling.serve.client.DoclingServeClient;
@@ -36,6 +37,10 @@ import tools.jackson.databind.json.JsonMapper;
  * The client leaves {@link #createRequestBuilder(RequestContext)} open for 
subclasses, which is where the header is
  * added here. Everything else, including the JSON codec, mirrors the client 
the builder itself would have created.
  * <p>
+ * The token is obtained from the supplier on every request so that 
short-lived OAuth tokens are renewed automatically
+ * when they expire (camel-oauth caches them until expiry). Passing a 
constant-returning supplier is equivalent to the
+ * old single-token behaviour.
+ * <p>
  * Upstream support for a bearer token is proposed in
  * <a 
href="https://github.com/docling-project/docling-java/pull/785";>docling-java#785</a>;
 this subclass can be
  * replaced by the client option once it lands.
@@ -43,11 +48,11 @@ import tools.jackson.databind.json.JsonMapper;
 final class BearerTokenDoclingServeClient extends DoclingServeClient {
 
     private final JsonMapper jsonMapper = JsonMapper.builder().build();
-    private final String authorization;
+    private final Supplier<String> tokenSupplier;
 
-    BearerTokenDoclingServeClient(DoclingServeClientBuilder<?, ?> builder, 
String token) {
+    BearerTokenDoclingServeClient(DoclingServeClientBuilder<?, ?> builder, 
Supplier<String> tokenSupplier) {
         super(builder);
-        this.authorization = "Bearer " + token;
+        this.tokenSupplier = tokenSupplier;
     }
 
     @Override
@@ -70,7 +75,7 @@ final class BearerTokenDoclingServeClient extends 
DoclingServeClient {
 
     @Override
     protected <I, O> HttpRequest.Builder 
createRequestBuilder(RequestContext<I, O> context) {
-        return super.createRequestBuilder(context).header("Authorization", 
authorization);
+        return super.createRequestBuilder(context).header("Authorization", 
"Bearer " + tokenSupplier.get());
     }
 
     @Override
diff --git 
a/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingProducer.java
 
b/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingProducer.java
index 323f2366da82..8e55e401a6f1 100644
--- 
a/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingProducer.java
+++ 
b/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingProducer.java
@@ -50,6 +50,7 @@ import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.Supplier;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -194,7 +195,6 @@ public class DoclingProducer extends DefaultProducer {
     @Override
     protected void doStart() throws Exception {
         super.doStart();
-        resolveOAuthToken();
         if (configuration.isUseDoclingServe()) {
             String baseUrl = configuration.getDoclingServeUrl();
             if (baseUrl.endsWith("/")) {
@@ -207,29 +207,63 @@ public class DoclingProducer extends DefaultProducer {
                     
.asyncPollInterval(Duration.ofMillis(configuration.getAsyncPollInterval()))
                     
.asyncTimeout(Duration.ofMillis(configuration.getAsyncTimeout()));
 
-            // Apply the authentication configured on the endpoint
+            // Apply the authentication configured on the endpoint.
+            // Note: when oauthProfile is set, the 
BearerTokenDoclingServeClient below always sends
+            // Authorization: Bearer. If authenticationScheme=API_KEY and 
authenticationToken are also set,
+            // the X-Api-Key header is added in addition to the Bearer header 
by the builder below.
+            // This is intentional: oauthProfile overrides the scheme to 
Bearer for per-request token refresh.
             if (configuration.getAuthenticationScheme() == 
AuthenticationScheme.API_KEY
                     && configuration.getAuthenticationToken() != null) {
                 builder.apiKey(configuration.getAuthenticationToken());
             }
 
-            if (configuration.getAuthenticationScheme() == 
AuthenticationScheme.BEARER
-                    && configuration.getAuthenticationToken() != null) {
-                // the client has no bearer token option, so the Authorization 
header is added by this subclass
-                doclingServeApi = new BearerTokenDoclingServeClient(builder, 
configuration.getAuthenticationToken());
+            boolean useBearerToken = configuration.getAuthenticationScheme() 
== AuthenticationScheme.BEARER
+                    || 
ObjectHelper.isNotEmpty(configuration.getOauthProfile());
+            // Only create the bearer-token client when there is actually 
something to send: a static token
+            // or an OAuth profile that will supply one at request time.
+            if (useBearerToken && 
(ObjectHelper.isNotEmpty(configuration.getOauthProfile())
+                    || configuration.getAuthenticationToken() != null)) {
+                // the client has no bearer token option, so the Authorization 
header is added by this subclass.
+                // When oauthProfile is set the token supplier re-resolves the 
token on every request so that
+                // short-lived OAuth tokens are refreshed automatically 
(camel-oauth caches them until expiry).
+                // Otherwise the configured static authenticationToken is used 
directly.
+                doclingServeApi = new BearerTokenDoclingServeClient(builder, 
resolveBearerTokenSupplier());
             } else {
                 doclingServeApi = builder.build();
             }
 
+            String authDesc = 
ObjectHelper.isNotEmpty(configuration.getOauthProfile())
+                    ? "BEARER (OAuth, profile=" + 
configuration.getOauthProfile() + ", per-request)"
+                    : configuration.getAuthenticationScheme().name();
             LOG.info("DoclingProducer configured to use docling-serve API at: 
{} with authentication: {} (async mode: {})",
                     configuration.getDoclingServeUrl(),
-                    configuration.getAuthenticationScheme(),
+                    authDesc,
                     configuration.isUseAsyncMode());
         } else {
             LOG.info("DoclingProducer configured to use docling CLI command");
         }
     }
 
+    /**
+     * Returns a {@link Supplier} for the bearer token used by the {@link 
BearerTokenDoclingServeClient}. When an
+     * {@code oauthProfile} is configured the supplier re-resolves the token 
on every call so that short-lived OAuth
+     * tokens are refreshed automatically; otherwise it returns the configured 
static {@code authenticationToken}.
+     */
+    private Supplier<String> resolveBearerTokenSupplier() {
+        if (ObjectHelper.isNotEmpty(configuration.getOauthProfile())) {
+            String profile = configuration.getOauthProfile();
+            return () -> {
+                try {
+                    return 
OAuthHelper.resolveOAuthToken(getEndpoint().getCamelContext(), profile);
+                } catch (Exception e) {
+                    throw new RuntimeException(
+                            "Failed to resolve OAuth token for oauthProfile '" 
+ profile + "': " + e.getMessage(), e);
+                }
+            };
+        }
+        return () -> configuration.getAuthenticationToken();
+    }
+
     @Override
     protected void doStop() throws Exception {
         super.doStop();
@@ -243,17 +277,6 @@ public class DoclingProducer extends DefaultProducer {
         return doclingServeApi;
     }
 
-    private void resolveOAuthToken() throws Exception {
-        if (ObjectHelper.isEmpty(configuration.getOauthProfile())) {
-            return;
-        }
-        String token = 
OAuthHelper.resolveOAuthToken(getEndpoint().getCamelContext(), 
configuration.getOauthProfile());
-        configuration.setAuthenticationToken(token);
-        if (configuration.getAuthenticationScheme() == 
AuthenticationScheme.NONE) {
-            configuration.setAuthenticationScheme(AuthenticationScheme.BEARER);
-        }
-    }
-
     @Override
     public void process(Exchange exchange) throws Exception {
         LOG.debug("DoclingProducer processing exchange with message ID: {}", 
exchange.getExchangeId());
diff --git 
a/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/DoclingProducerAuthTest.java
 
b/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/DoclingProducerAuthTest.java
index bfe6f8838b52..34d4cfa60508 100644
--- 
a/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/DoclingProducerAuthTest.java
+++ 
b/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/DoclingProducerAuthTest.java
@@ -94,6 +94,40 @@ class DoclingProducerAuthTest extends CamelTestSupport {
         assertThat(requests.get(0).getFirst("X-Api-Key")).isNull();
     }
 
+    /**
+     * When {@code oauthProfile} is configured the token is re-resolved on 
every request via the
+     * {@link StubOAuthClientAuthenticationFactory} instead of being cached at 
startup. This verifies the fix for
+     * CAMEL-27752: changing the stub's token between requests must result in 
different tokens on the wire.
+     */
+    @Test
+    void oauthProfileTokenIsReResolvedOnEveryRequest() throws Exception {
+        StubOAuthClientAuthenticationFactory.setToken("first-token");
+
+        String uri = 
"docling:CONVERT_TO_MARKDOWN?useDoclingServe=true&doclingServeUrl=http://localhost:";
+                     + server.getAddress().getPort()
+                     + "&oauthProfile=test-profile";
+        DoclingEndpoint endpoint = context.getEndpoint(uri, 
DoclingEndpoint.class);
+        DoclingProducer producer = (DoclingProducer) endpoint.createProducer();
+        producer.start();
+        try {
+            // first request: should carry the token that was current at 
request time
+            producer.getDoclingServeApi().health();
+            assertThat(requests).hasSize(1);
+            
assertThat(requests.get(0).getFirst("Authorization")).isEqualTo("Bearer 
first-token");
+
+            // simulate a token rotation (e.g. original token expired)
+            StubOAuthClientAuthenticationFactory.setToken("second-token");
+
+            // second request: must carry the new token, not the one resolved 
at startup
+            producer.getDoclingServeApi().health();
+            assertThat(requests).hasSize(2);
+            
assertThat(requests.get(1).getFirst("Authorization")).isEqualTo("Bearer 
second-token");
+        } finally {
+            producer.stop();
+            StubOAuthClientAuthenticationFactory.setToken("stub-token");
+        }
+    }
+
     private String healthStatus(String authenticationScheme, String 
authenticationToken) throws Exception {
         String uri = 
"docling:CONVERT_TO_MARKDOWN?useDoclingServe=true&doclingServeUrl=http://localhost:";
                      + server.getAddress().getPort()
diff --git 
a/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/StubOAuthClientAuthenticationFactory.java
 
b/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/StubOAuthClientAuthenticationFactory.java
new file mode 100644
index 000000000000..9322493c6ebd
--- /dev/null
+++ 
b/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/StubOAuthClientAuthenticationFactory.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.docling;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.OAuthClientAuthenticationFactory;
+import org.apache.camel.spi.OAuthClientConfig;
+
+/**
+ * Stands in for camel-oauth in tests: returns a configurable token without 
calling a token endpoint. The token to
+ * return can be changed between requests via {@link #setToken(String)} to 
verify that {@code DoclingProducer}
+ * re-resolves it on every outbound request (per-request OAuth token refresh). 
Registered in
+ * {@code 
META-INF/services/org/apache/camel/oauth-client-authentication-factory}.
+ */
+public class StubOAuthClientAuthenticationFactory implements 
OAuthClientAuthenticationFactory {
+
+    private static final AtomicReference<String> TOKEN = new 
AtomicReference<>("stub-token");
+
+    static void setToken(String token) {
+        TOKEN.set(token);
+    }
+
+    @Override
+    public String resolveToken(OAuthClientConfig config) {
+        throw new UnsupportedOperationException("Only named profiles are 
supported by this stub");
+    }
+
+    @Override
+    public String resolveToken(CamelContext context, String profileName) {
+        return TOKEN.get();
+    }
+
+    @Override
+    public String resolveToken(CamelContext context) {
+        throw new UnsupportedOperationException("Only named profiles are 
supported by this stub");
+    }
+}
diff --git 
a/components/camel-ai/camel-docling/src/test/resources/META-INF/services/org/apache/camel/oauth-client-authentication-factory
 
b/components/camel-ai/camel-docling/src/test/resources/META-INF/services/org/apache/camel/oauth-client-authentication-factory
new file mode 100644
index 000000000000..ea0c7953f79b
--- /dev/null
+++ 
b/components/camel-ai/camel-docling/src/test/resources/META-INF/services/org/apache/camel/oauth-client-authentication-factory
@@ -0,0 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+class=org.apache.camel.component.docling.StubOAuthClientAuthenticationFactory
diff --git 
a/components/camel-ai/camel-huggingface/src/main/docs/huggingface-component.adoc
 
b/components/camel-ai/camel-huggingface/src/main/docs/huggingface-component.adoc
index 0b7c3bcabd36..8adc7b398d1f 100644
--- 
a/components/camel-ai/camel-huggingface/src/main/docs/huggingface-component.adoc
+++ 
b/components/camel-ai/camel-huggingface/src/main/docs/huggingface-component.adoc
@@ -145,7 +145,9 @@ written to the log when the `ai.djl.python.engine` logger 
is at DEBUG. Keep that
 
 == OAuth Authentication
 
-When accessing private or gated models behind an OAuth-protected endpoint, set 
the `oauthProfile` parameter to acquire an access token via the OAuth 2.0 
Client Credentials grant. The token is used as the `authToken`. This requires 
`camel-oauth` on the classpath.
+When accessing private or gated models behind an OAuth-protected endpoint, set 
the `oauthProfile` parameter to acquire an access token via the OAuth 2.0 
Client Credentials grant. The token is used as the `authToken` at producer 
startup, before the DJL model loader runs. This requires `camel-oauth` on the 
classpath.
+
+NOTE: The token is only needed during model download at startup. Once the 
model is loaded, inference runs locally and no further calls to Hugging Face 
are made, so a token that expires after the route starts does not affect 
inference.
 
 [source,properties]
 ----
diff --git 
a/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/HuggingFaceProducer.java
 
b/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/HuggingFaceProducer.java
index ac34e3b02d6a..b82f3a712c26 100644
--- 
a/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/HuggingFaceProducer.java
+++ 
b/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/HuggingFaceProducer.java
@@ -42,6 +42,12 @@ public class HuggingFaceProducer extends DefaultProducer {
         predictor.loadModel();
     }
 
+    /**
+     * Resolves the OAuth token from the configured profile and stores it in 
the configuration so that the DJL model
+     * loader can read it via {@code config.getAuthToken()} when it passes 
{@code HF_TOKEN} to the Python process during
+     * model download. This runs once at startup before {@code loadModel()}. 
The token is not needed after the model is
+     * loaded because inference runs locally without further calls to Hugging 
Face.
+     */
     private void resolveOAuthToken() throws Exception {
         HuggingFaceConfiguration config = getEndpoint().getConfiguration();
         if (ObjectHelper.isEmpty(config.getOauthProfile())) {
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
index 2ec4ddfac4a0..9abc5366181a 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
@@ -52,6 +52,23 @@ Additionally, a misconfigured `oauthProfile` on the OpenAI 
API client (the `oaut
 itself, not on a nested `mcpServer.*`) will only be reported on the first 
exchange rather than at route startup. This
 is an intentional trade-off that enables short-lived token refresh.
 
+=== camel-docling - the OAuth token of oauthProfile is resolved per request
+
+With `oauthProfile`, the endpoint used to resolve the access token once at 
startup and bake it into the
+docling-serve client. The token is now resolved from the camel-oauth cache on 
every outbound request so
+that short-lived tokens are automatically renewed when they expire without 
restarting the route. The
+identity provider must issue tokens that docling-serve accepts as `Bearer` 
credentials.
+
+The trade-off: a misconfigured profile name, a missing `camel-oauth` 
dependency, or an unreachable identity
+provider used to fail the route at startup and now causes an exception on the 
first exchange. The exception
+is handled by the route's error handler like any other exchange failure.
+
+If `authenticationScheme=API_KEY` and `authenticationToken` are also set 
together with `oauthProfile`, the
+OAuth token is now sent as `Authorization: Bearer` while the static token is 
sent as `X-Api-Key`. Previously
+the OAuth token was resolved once at startup and also sent as `X-Api-Key`. 
Both headers are sent when both
+are configured; use `oauthProfile` alone (without `authenticationScheme` or 
`authenticationToken`) to send
+only the Bearer token.
+
 === Camel CLI - the Azure Storage Queue dev service runs on Floci AZ
 
 `camel infra run azure storage-queue` now starts the Queue service of 
https://github.com/floci-io/floci-az[Floci AZ]

Reply via email to