oscerd commented on code in PR #27718:
URL: https://github.com/apache/camel/pull/27718#discussion_r4247715440


##########
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:
   Thanks, applied with one adjustment. Taken verbatim, the new message would 
also be logged for a single malformed header ("expected exactly one, got 1"), 
because that branch handled both cases. Several `Authorization` headers now 
have their own branch with your message, and a single malformed header keeps 
`Invalid Authorization header`; this also drops the `new String[0]` shortcut. 
See f1a1bf6e9b95.
   
   _Claude Code on behalf of oscerd_
   



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