Andrea Cosentino created CAMEL-25022:
----------------------------------------

             Summary: camel-oauth: honor the JWT nbf (not before) claim when 
authenticating bearer tokens with the servlet backend
                 Key: CAMEL-25022
                 URL: https://issues.apache.org/jira/browse/CAMEL-25022
             Project: Camel
          Issue Type: Improvement
          Components: camel-oauth
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.23.0


When {{OAuthBearerTokenProcessor}} authenticates an access token through the 
Jakarta servlet backend ({{ServletOAuth}}), {{UserProfile}} validates the JWS 
signature and the issuer, and {{UserProfile.expired()}} evaluates the {{exp}} 
claim. The {{nbf}} (not before) claim is copied into the profile attributes but 
is never evaluated. RFC 7519 section 4.1.5 specifies that a JWT must not be 
accepted for processing before its {{nbf}} time.

The other token validation paths of the module already evaluate {{nbf}}: the 
Vert.x backend ({{VertxOAuth}}, through Vert.x {{User.expired(leeway)}}) and 
the {{OAuthTokenValidationFactory}} SPI ({{JwtTokenValidator}}).

Proposed change:
* In {{UserProfile}}, reject a token whose {{nbf}} is later than the current 
time plus the leeway configured in {{JWTOptions}} ({{getLeeway()}}, default 0, 
the same default as the Vert.x backend and the SPI {{clock-skew-seconds}} 
option).
* Add unit tests for a token with a future {{nbf}}, a past {{nbf}}, and an 
{{nbf}} within the leeway.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to