You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/03/28 06:46:27 UTC

(camel) branch camel-4.4.x updated: CAMEL-20624: Fix bug in camel-http to avoid duplicate OAuth2 Authorization headers (#13629)

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

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


The following commit(s) were added to refs/heads/camel-4.4.x by this push:
     new 2bcc9130c21 CAMEL-20624: Fix bug in camel-http to avoid duplicate OAuth2 Authorization headers (#13629)
2bcc9130c21 is described below

commit 2bcc9130c2189e1ee97ab8ae72e872a035479761
Author: Joshua Grisham <10...@users.noreply.github.com>
AuthorDate: Thu Mar 28 07:45:55 2024 +0100

    CAMEL-20624: Fix bug in camel-http to avoid duplicate OAuth2 Authorization headers (#13629)
---
 .../java/org/apache/camel/component/http/OAuth2ClientConfigurer.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/OAuth2ClientConfigurer.java b/components/camel-http/src/main/java/org/apache/camel/component/http/OAuth2ClientConfigurer.java
index cceba3c2130..f80cdf18bca 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/OAuth2ClientConfigurer.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/OAuth2ClientConfigurer.java
@@ -61,7 +61,7 @@ public class OAuth2ClientConfigurer implements HttpClientConfigurer {
 
                     if (response.getCode() == 200) {
                         String accessToken = ((JsonObject) Jsoner.deserialize(responseString)).getString("access_token");
-                        request.addHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
+                        request.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
                     } else {
                         throw new HttpException(
                                 "Received error response from token request with Status Code: " + response.getCode());