smolnar82 opened a new pull request, #1558: URL: https://github.com/apache/knox/pull/1558
[KNOX-3627](https://issues.apache.org/jira/browse/KNOX-3627) - Make JWKS HTTP connect/read timeouts configurable ## What changes were proposed in this pull request? JWKS downloads (`knox.token.jwks.url`, `sso.token.verification.jwks.urls`, trusted OIDC issuers) used Nimbus's hard-coded 500 ms connect/read timeouts with one retry. A slow endpoint, such as a Knox replica still warming up, therefore caused 401s. Nimbus's rate limiter counts the failed downloads, which can stretch the 401s to ~30 s. - New gateway-site properties `gateway.jwks.http.connect.timeout.ms` (default `2000`, also bounds the TLS handshake) and `gateway.jwks.http.read.timeout.ms` (default `5000`). With the one retry, the worst case of 14 s stays below the 15 s `gateway.jwks.cache.refresh.interval`. - Values must be positive: in HttpClient, 0 or a negative value means unbounded, and a hung download blocks the JWK cache. Such values are ignored with a WARN, and the default is used. - Docs: `config.md` and `knoxidf/configuration.md`. The `trusted.oidc.issuer.discovery.*` timeouts are now correctly described as covering only the discovery document. ## How was this patch tested? New `JwksHttpTimeoutTest`, run against a JWKS server that delays its response by 1 s: - with a 3 s read timeout, verification succeeds; - with a 300 ms read timeout, it fails after 2 attempts; - a 0 or -1 timeout falls back to the default and logs a WARN. Also extended `IssuerJwksCaAcceptanceTest` (the `jwksCa` path) and `GatewayConfigImplTest`. `mvn -pl gateway-server verify` passes. ## Integration Tests None. Covering this end to end would need a deliberately slow JWKS endpoint in Docker Compose. The unit tests already run the real HttpClient and Nimbus code against a delayed local server. ## Performance implications None on the hot path: the timeouts apply only when the JWKS is downloaded, not to cached keys. A hung endpoint now holds a request for up to ~14 s instead of ~1 s. In return, slow but working endpoints no longer fail verification or use up the rate limiter. -- 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]
