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


##########
core/camel-api/src/main/java/org/apache/camel/spi/OAuthTokenValidationConfig.java:
##########
@@ -475,6 +479,55 @@ public OAuthTokenValidationConfig 
setAllowInsecureHttp(boolean allowInsecureHttp
         return this;
     }
 
+    /**
+     * Required Authentication Context Class Reference (ACR) values for RFC 
9470 step-up authentication. When set, the
+     * token {@code acr} claim must contain one of these values; otherwise the 
token is rejected with

Review Comment:
   💬 **Doc nit:** `"must contain one of these values"` is ambiguous — `contain` 
suggests substring or collection membership of the token's `acr` value, but the 
code does exact set membership (`requiredAcr.contains(acr)`). The token's `acr` 
claim must *equal* one of the configured values.
   
   ```suggestion
        * Required Authentication Context Class Reference (ACR) values for RFC 
9470 step-up authentication. When set, the
        * token {@code acr} claim must be one of these values; otherwise the 
token is rejected with
   ```



##########
components/camel-http-base/src/test/java/org/apache/camel/http/base/OAuthHttpSecuritySupportTest.java:
##########
@@ -330,4 +330,84 @@ public void validateConfiguration(CamelContext context, 
String profileName) {
             throw new IllegalArgumentException("invalid profile");
         }
     }
+
+    // --- RFC 9470 step-up authentication tests ---
+
+    @Test
+    void rejectsInsufficientUserAuthenticationWithStepUpChallenge() {

Review Comment:
   ⚠️ **Test coverage gap:** This test constructs `OAuthHttpSecuritySupport` 
with the 2-argument constructor, which sets `validationConfig = null`. As a 
result, `Validation.insufficientUserAuthentication(null)` is called — the 
`WWW-Authenticate` challenge carries no `acr_values` or `max_age` hints.
   
   The separate unit tests for 
`Validation.insufficientUserAuthentication(config)` do verify the challenge 
format, but there is no integration-level test that exercises the full path 
where:
   1. a real token fails step-up through `authenticate()`, and  
   2. the `OAuthTokenValidationConfig` containing 
`requiredAcr`/`maxAuthAgeSeconds` is wired into the security support, and  
   3. the resulting `WWW-Authenticate` header carries the expected hints.
   
   Consider adding one test using the 3-argument constructor (or `create()`) 
with a config that has `requiredAcr`/`maxAuthAgeSeconds` set, to cover the 
end-to-end hint propagation through `authenticate()`.



##########
components/camel-oauth/src/main/docs/oauth.adoc:
##########
@@ -173,7 +173,7 @@ values to Camel, they are also treated as malformed.
 
 HTTP integrations reject missing credentials and invalid tokens with HTTP 401. 
Missing
 credentials receive the bare `WWW-Authenticate: Bearer` challenge, while 
invalid tokens receive
-the RFC 6750 `WWW-Authenticate: Bearer error="invalid_token"` challenge. 
Malformed `Authorization`
+the RFC 6750 `WWW-Authenticate: Bearer error="invalid_token"` challenge. When 
a token does not meet the configured step-up requirements (see `required-acr` 
and `max-auth-age-seconds`), it is rejected with HTTP 401 and a 
`WWW-Authenticate: Bearer error="insufficient_user_authentication"` challenge 
including `acr_values` and/or `max_age` hints per RFC 9470. Malformed 
`Authorization`

Review Comment:
   💬 **Doc nit:** The inserted sentence is a ~45-word run-on spliced into the 
middle of an existing paragraph. Split it onto its own lines for readability.
   
   ```suggestion
   the RFC 6750 `WWW-Authenticate: Bearer error="invalid_token"` challenge.
   When a token does not meet the configured step-up requirements (see 
`required-acr` and
   `max-auth-age-seconds`), it is rejected with HTTP 401 and a
   `WWW-Authenticate: Bearer error="insufficient_user_authentication"` 
challenge including
   `acr_values` and/or `max_age` hints per RFC 9470. Malformed `Authorization`
   ```



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