gnodet-bot commented on code in PR #27718:
URL: https://github.com/apache/camel/pull/27718#discussion_r4247316152


##########
components/camel-oauth/src/main/java/org/apache/camel/oauth/OAuthBearerTokenProcessor.java:
##########
@@ -33,14 +44,14 @@ public void process(Exchange exchange) {
 
         // Validate Authorization header
         //
-        var authHeader = msg.getHeader("Authorization", String.class);
-        if (authHeader == null) {
+        var authHeaders = authorizationHeaders(msg);
+        if (authHeaders.isEmpty()) {
             log.error("No Authorization header in request");
             rejectUnauthorized(exchange, "Authorization header");
             return;
         }
 
-        var toks = authHeader.split(" ");
+        var toks = authHeaders.size() == 1 ? authHeaders.get(0).split(" ") : 
new String[0];
         if (toks.length != 2 || !"Bearer".equals(toks[0])) {

Review Comment:
   ⚠️ **Imprecise log message:** when `authHeaders.size() > 1`, `toks` is set 
to `new String[0]`, which falls through to this branch logging `"Invalid 
Authorization header"`. A more specific message would help distinguish the root 
cause during debugging:
   
   ```suggestion
               log.error("Invalid Authorization header: expected exactly one, 
got {}", authHeaders.size());
   ```



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